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));
}
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());
}
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());
}
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());
}
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());
}
Aggregations