Search in sources :

Example 1 with FastHit

use of com.yahoo.prelude.fastsearch.FastHit in project vespa by vespa-engine.

the class GetDocSumsPacket method setFieldsFromHits.

private void setFieldsFromHits() {
    for (Iterator<Hit> i = result.hits().unorderedDeepIterator(); i.hasNext(); ) {
        Hit h = i.next();
        if (h instanceof FastHit) {
            FastHit hit = (FastHit) h;
            if (hit.shouldIgnoreRowBits()) {
                flags |= GDFLAG_IGNORE_ROW;
            }
            QueryPacketData tag = hit.getQueryPacketData();
            if (tag != null) {
                this.queryPacketData = tag;
                break;
            }
        }
    }
}
Also used : Hit(com.yahoo.search.result.Hit) FastHit(com.yahoo.prelude.fastsearch.FastHit) FastHit(com.yahoo.prelude.fastsearch.FastHit)

Example 2 with FastHit

use of com.yahoo.prelude.fastsearch.FastHit in project vespa by vespa-engine.

the class GetDocSumsPacket method encodeDocIds.

private void encodeDocIds(ByteBuffer buffer) {
    byte[] emptyGid = new byte[GlobalId.LENGTH];
    for (Iterator<Hit> i = result.hits().unorderedDeepIterator(); i.hasNext(); ) {
        Hit hit = i.next();
        if (hit instanceof FastHit && !hit.isFilled(summaryClass)) {
            FastHit fastHit = (FastHit) hit;
            buffer.put(fastHit.getGlobalId() != null ? fastHit.getGlobalId().getRawId() : emptyGid);
            buffer.putInt(fastHit.getPartId());
            // Unused, was docstamp
            buffer.putInt(0);
        }
    }
}
Also used : Hit(com.yahoo.search.result.Hit) FastHit(com.yahoo.prelude.fastsearch.FastHit) FastHit(com.yahoo.prelude.fastsearch.FastHit)

Example 3 with FastHit

use of com.yahoo.prelude.fastsearch.FastHit in project vespa by vespa-engine.

the class JuniperSearcher method highlight.

private void highlight(boolean bolding, Iterator<Hit> hitsToHighlight, String summaryClass, IndexFacts.Session indexFacts) {
    while (hitsToHighlight.hasNext()) {
        Hit sniffHit = hitsToHighlight.next();
        if (!(sniffHit instanceof FastHit))
            continue;
        FastHit hit = (FastHit) sniffHit;
        if (summaryClass != null && !hit.isFilled(summaryClass))
            continue;
        Object searchDefinitionField = hit.getField(MAGIC_FIELD);
        if (searchDefinitionField == null)
            continue;
        String searchDefinitionName = searchDefinitionField.toString();
        for (String fieldName : hit.fields().keySet()) {
            Index index = indexFacts.getIndex(fieldName, searchDefinitionName);
            if (index.getDynamicSummary() || index.getHighlightSummary())
                insertTags(hit.buildHitField(fieldName, true, true), bolding, index.getDynamicSummary());
        }
    }
}
Also used : FastHit(com.yahoo.prelude.fastsearch.FastHit) Hit(com.yahoo.search.result.Hit) FastHit(com.yahoo.prelude.fastsearch.FastHit) Index(com.yahoo.prelude.Index)

Example 4 with FastHit

use of com.yahoo.prelude.fastsearch.FastHit in project vespa by vespa-engine.

the class JuniperSearcher method fill.

@Override
public void fill(Result result, String summaryClass, Execution execution) {
    Result workResult = result;
    final int worstCase = workResult.getHitCount();
    final List<Hit> hits = new ArrayList<>(worstCase);
    for (final Iterator<Hit> i = workResult.hits().deepIterator(); i.hasNext(); ) {
        final Hit sniffHit = i.next();
        if (!(sniffHit instanceof FastHit))
            continue;
        final FastHit hit = (FastHit) sniffHit;
        if (hit.isFilled(summaryClass))
            continue;
        hits.add(hit);
    }
    execution.fill(workResult, summaryClass);
    highlight(workResult.getQuery().getPresentation().getBolding(), hits.iterator(), summaryClass, execution.context().getIndexFacts().newSession(result.getQuery()));
}
Also used : FastHit(com.yahoo.prelude.fastsearch.FastHit) Hit(com.yahoo.search.result.Hit) FastHit(com.yahoo.prelude.fastsearch.FastHit) ArrayList(java.util.ArrayList) Result(com.yahoo.search.Result)

Example 5 with FastHit

use of com.yahoo.prelude.fastsearch.FastHit in project vespa by vespa-engine.

the class Dispatcher method hitsByNode.

/**
 * Return a map of hits by their search node (partition) id
 */
private static ListMap<Integer, FastHit> hitsByNode(Result result) {
    ListMap<Integer, FastHit> hitsByPartition = new ListMap<>();
    for (Iterator<Hit> i = result.hits().unorderedDeepIterator(); i.hasNext(); ) {
        Hit h = i.next();
        if (!(h instanceof FastHit))
            continue;
        FastHit hit = (FastHit) h;
        hitsByPartition.put(hit.getDistributionKey(), hit);
    }
    return hitsByPartition;
}
Also used : FastHit(com.yahoo.prelude.fastsearch.FastHit) Hit(com.yahoo.search.result.Hit) FastHit(com.yahoo.prelude.fastsearch.FastHit) ListMap(com.yahoo.collections.ListMap)

Aggregations

FastHit (com.yahoo.prelude.fastsearch.FastHit)51 Result (com.yahoo.search.Result)21 Query (com.yahoo.search.Query)20 Test (org.junit.Test)20 Hit (com.yahoo.search.result.Hit)19 GroupingListHit (com.yahoo.prelude.fastsearch.GroupingListHit)9 Relevance (com.yahoo.search.result.Relevance)8 Searcher (com.yahoo.search.Searcher)7 DocumentSourceSearcher (com.yahoo.prelude.searcher.DocumentSourceSearcher)6 Execution (com.yahoo.search.searchchain.Execution)5 FS4Hit (com.yahoo.searchlib.aggregation.FS4Hit)5 VdsHit (com.yahoo.searchlib.aggregation.VdsHit)5 JSONString (com.yahoo.prelude.hitfield.JSONString)4 QuotingSearcher (com.yahoo.prelude.searcher.QuotingSearcher)4 Utf8String (com.yahoo.text.Utf8String)4 HashMap (java.util.HashMap)4 ByteWriter (com.yahoo.io.ByteWriter)3 DocsumDefinitionSet (com.yahoo.prelude.fastsearch.DocsumDefinitionSet)3 Coverage (com.yahoo.search.result.Coverage)3 HitGroup (com.yahoo.search.result.HitGroup)3