Search in sources :

Example 96 with Execution

use of com.yahoo.search.searchchain.Execution in project vespa by vespa-engine.

the class NGramSearcherTestCase method testNGramRewritingAdditionalTermInfo.

public void testNGramRewritingAdditionalTermInfo() {
    Query q = new Query("?query=gram3:engul!50+foo+gram2:123!150");
    new Execution(searcher, Execution.Context.createContextStub(indexFacts)).search(q);
    AndItem root = (AndItem) q.getModel().getQueryTree().getRoot();
    AndItem gram3And = (AndItem) root.getItem(0);
    AndItem gram2And = (AndItem) root.getItem(2);
    assertExtraTermInfo(50, "engul", gram3And.getItem(0));
    assertExtraTermInfo(50, "engul", gram3And.getItem(1));
    assertExtraTermInfo(50, "engul", gram3And.getItem(2));
    assertExtraTermInfo(150, "123", gram2And.getItem(0));
    assertExtraTermInfo(150, "123", gram2And.getItem(1));
}
Also used : Execution(com.yahoo.search.searchchain.Execution) Query(com.yahoo.search.Query) AndItem(com.yahoo.prelude.query.AndItem)

Example 97 with Execution

use of com.yahoo.search.searchchain.Execution in project vespa by vespa-engine.

the class NGramSearcherTestCase method testNGramRewritingPhraseSingleTerm.

/**
 * Note that single-term phrases are simplified to just the term at parse time,
 * so the ngram rewriter cannot know to keep the grams as a phrase in this case.
 */
public void testNGramRewritingPhraseSingleTerm() {
    Query q = new Query("?query=gram3:%22engul%22");
    new Execution(searcher, Execution.Context.createContextStub(indexFacts)).search(q);
    assertEquals("AND gram3:eng gram3:ngu gram3:gul", q.getModel().getQueryTree().toString());
}
Also used : Execution(com.yahoo.search.searchchain.Execution) Query(com.yahoo.search.Query)

Example 98 with Execution

use of com.yahoo.search.searchchain.Execution in project vespa by vespa-engine.

the class NGramSearcherTestCase method assertGramsWithSegmentationSingleSegment.

public void assertGramsWithSegmentationSingleSegment(Chain<Searcher> chain) {
    // "first" "second" and "third" are segments in the "test" language
    Item item = parseQuery("gram14:first", Query.Type.ANY);
    Query q = new Query("?query=ignored");
    q.getModel().setLanguage(Language.UNKNOWN);
    q.getModel().getQueryTree().setRoot(item);
    new Execution(chain, createContextStub(indexFacts)).search(q);
    assertEquals("gram14:first", q.getModel().getQueryTree().toString());
}
Also used : Item(com.yahoo.prelude.query.Item) AndItem(com.yahoo.prelude.query.AndItem) WordItem(com.yahoo.prelude.query.WordItem) Execution(com.yahoo.search.searchchain.Execution) Query(com.yahoo.search.Query)

Example 99 with Execution

use of com.yahoo.search.searchchain.Execution in project vespa by vespa-engine.

the class NGramSearcherTestCase method testNGramRewriting2NGramsOnly.

public void testNGramRewriting2NGramsOnly() {
    Query q = new Query("?query=gram3:engul+gram2:123");
    new Execution(searcher, Execution.Context.createContextStub(indexFacts)).search(q);
    assertEquals("AND (AND gram3:eng gram3:ngu gram3:gul) (AND gram2:12 gram2:23)", q.getModel().getQueryTree().toString());
}
Also used : Execution(com.yahoo.search.searchchain.Execution) Query(com.yahoo.search.Query)

Example 100 with Execution

use of com.yahoo.search.searchchain.Execution in project vespa by vespa-engine.

the class NGramSearcherTestCase method assertGramsWithSegmentationMixed.

public void assertGramsWithSegmentationMixed(Chain<Searcher> chain) {
    // "first" "second" and "third" are segments in the "test" language
    Item item = parseQuery("a gram14:afirstsecondthird b gram14:hi", Query.Type.ALL);
    Query q = new Query("?query=ignored");
    q.getModel().setLanguage(Language.UNKNOWN);
    q.getModel().getQueryTree().setRoot(item);
    new Execution(chain, createContextStub(indexFacts)).search(q);
    assertEquals("AND a (AND gram14:afirstsecondth gram14:firstsecondthi gram14:irstsecondthir gram14:rstsecondthird) b gram14:hi", q.getModel().getQueryTree().toString());
}
Also used : Item(com.yahoo.prelude.query.Item) AndItem(com.yahoo.prelude.query.AndItem) WordItem(com.yahoo.prelude.query.WordItem) Execution(com.yahoo.search.searchchain.Execution) Query(com.yahoo.search.Query)

Aggregations

Execution (com.yahoo.search.searchchain.Execution)232 Query (com.yahoo.search.Query)184 Result (com.yahoo.search.Result)127 Test (org.junit.Test)123 Searcher (com.yahoo.search.Searcher)88 Chain (com.yahoo.component.chain.Chain)59 IndexFacts (com.yahoo.prelude.IndexFacts)34 Hit (com.yahoo.search.result.Hit)25 FeedContext (com.yahoo.feedapi.FeedContext)20 MessagePropertyProcessor (com.yahoo.feedapi.MessagePropertyProcessor)20 NullFeedMetric (com.yahoo.feedhandler.NullFeedMetric)20 ClusterList (com.yahoo.vespaclient.ClusterList)20 AndItem (com.yahoo.prelude.query.AndItem)18 WordItem (com.yahoo.prelude.query.WordItem)17 ComponentId (com.yahoo.component.ComponentId)13 GetDocumentReply (com.yahoo.documentapi.messagebus.protocol.GetDocumentReply)13 FastHit (com.yahoo.prelude.fastsearch.FastHit)13 FederationSearcher (com.yahoo.search.federation.FederationSearcher)13 ArrayList (java.util.ArrayList)12 CompositeItem (com.yahoo.prelude.query.CompositeItem)11