Search in sources :

Example 1 with NonPhrasingSearcher

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());
}
Also used : CompositeItem(com.yahoo.prelude.query.CompositeItem) Execution(com.yahoo.search.searchchain.Execution) Query(com.yahoo.search.Query) NonPhrasingSearcher(com.yahoo.prelude.querytransform.NonPhrasingSearcher) Test(org.junit.Test)

Example 2 with NonPhrasingSearcher

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());
}
Also used : CompositeItem(com.yahoo.prelude.query.CompositeItem) Execution(com.yahoo.search.searchchain.Execution) Query(com.yahoo.search.Query) NonPhrasingSearcher(com.yahoo.prelude.querytransform.NonPhrasingSearcher) Test(org.junit.Test)

Example 3 with NonPhrasingSearcher

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());
}
Also used : CompositeItem(com.yahoo.prelude.query.CompositeItem) Execution(com.yahoo.search.searchchain.Execution) Query(com.yahoo.search.Query) NonPhrasingSearcher(com.yahoo.prelude.querytransform.NonPhrasingSearcher) Test(org.junit.Test)

Example 4 with NonPhrasingSearcher

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());
}
Also used : Execution(com.yahoo.search.searchchain.Execution) Query(com.yahoo.search.Query) NonPhrasingSearcher(com.yahoo.prelude.querytransform.NonPhrasingSearcher) Test(org.junit.Test)

Aggregations

NonPhrasingSearcher (com.yahoo.prelude.querytransform.NonPhrasingSearcher)4 Query (com.yahoo.search.Query)4 Execution (com.yahoo.search.searchchain.Execution)4 Test (org.junit.Test)4 CompositeItem (com.yahoo.prelude.query.CompositeItem)3