use of com.yahoo.prelude.querytransform.NonPhrasingSearcher in project vespa by vespa-engine.
the class NonPhrasingSearcherTestCase method testNoNonPhrasingIfNoOtherPhrases.
@Test
public void testNoNonPhrasingIfNoOtherPhrases() {
searcher = new NonPhrasingSearcher("src/test/java/com/yahoo/prelude/querytransform/test/test-fsa.fsa");
Query query = new Query("?query=tudor+vidor");
new Execution(searcher, Execution.Context.createContextStub()).search(query);
CompositeItem item = (CompositeItem) query.getModel().getQueryTree().getRoot();
assertEquals(2, item.getItemCount());
assertEquals("tudor", ((WordItem) item.getItem(0)).getWord());
assertEquals("vidor", ((WordItem) item.getItem(1)).getWord());
}
use of com.yahoo.prelude.querytransform.NonPhrasingSearcher in project vespa by vespa-engine.
the class NonPhrasingSearcherTestCase method testMultipleWordNonPhrasing.
@Test
public void testMultipleWordNonPhrasing() {
searcher = new NonPhrasingSearcher("src/test/java/com/yahoo/prelude/querytransform/test/test-fsa.fsa");
Query query = new Query("?query=void+tudor+vidor+kanoo");
new Execution(searcher, Execution.Context.createContextStub()).search(query);
CompositeItem item = (CompositeItem) query.getModel().getQueryTree().getRoot();
assertEquals(2, item.getItemCount());
assertEquals("void", ((WordItem) item.getItem(0)).getWord());
assertEquals("kanoo", ((WordItem) item.getItem(1)).getWord());
}
use of com.yahoo.prelude.querytransform.NonPhrasingSearcher in project vespa by vespa-engine.
the class NonPhrasingSearcherTestCase method testNoNonPhrasingIfSuggestOnly.
@Test
public void testNoNonPhrasingIfSuggestOnly() {
searcher = new NonPhrasingSearcher("src/test/java/com/yahoo/prelude/querytransform/test/test-fsa.fsa");
Query query = new Query("?query=void+tudor+vidor+kanoo&suggestonly=true");
new Execution(searcher, Execution.Context.createContextStub()).search(query);
CompositeItem item = (CompositeItem) query.getModel().getQueryTree().getRoot();
assertEquals(4, item.getItemCount());
assertEquals("void", ((WordItem) item.getItem(0)).getWord());
assertEquals("tudor", ((WordItem) item.getItem(1)).getWord());
assertEquals("vidor", ((WordItem) item.getItem(2)).getWord());
assertEquals("kanoo", ((WordItem) item.getItem(3)).getWord());
}
use of com.yahoo.prelude.querytransform.NonPhrasingSearcher in project vespa by vespa-engine.
the class NonPhrasingSearcherTestCase method testSingleWordNonPhrasing.
@Test
public void testSingleWordNonPhrasing() {
searcher = new NonPhrasingSearcher("src/test/java/com/yahoo/prelude/querytransform/test/test-fsa.fsa");
Query query = new Query("?query=void+aword+kanoo");
new Execution(searcher, Execution.Context.createContextStub()).search(query);
assertEquals("AND void kanoo", query.getModel().getQueryTree().getRoot().toString());
}
Aggregations