Search in sources :

Example 1 with IntsHolder

use of org.opengrok.suggest.query.data.IntsHolder in project OpenGrok by OpenGrok.

the class SuggesterSearcher method getPhraseScore.

private int getPhraseScore(final ComplexQueryData data, final int docBase, final PostingsEnum postingsEnum) throws IOException {
    int weight = 0;
    while (postingsEnum.nextDoc() != DocIdSetIterator.NO_MORE_DOCS) {
        int docId = postingsEnum.docID();
        if (data.documentIds.has(docBase + docId)) {
            IntsHolder positions = data.scorer.getPositions(docBase + docId);
            if (positions == null) {
                continue;
            }
            int freq = postingsEnum.freq();
            for (int i = 0; i < freq; i++) {
                int pos = postingsEnum.nextPosition();
                if (positions.has(pos)) {
                    weight++;
                }
            }
        }
    }
    return weight;
}
Also used : IntsHolder(org.opengrok.suggest.query.data.IntsHolder) BitIntsHolder(org.opengrok.suggest.query.data.BitIntsHolder)

Aggregations

BitIntsHolder (org.opengrok.suggest.query.data.BitIntsHolder)1 IntsHolder (org.opengrok.suggest.query.data.IntsHolder)1