Search in sources :

Example 1 with CJKSearcher

use of com.yahoo.prelude.querytransform.CJKSearcher in project vespa by vespa-engine.

the class CJKSearcherTestCase method assertTransformed.

private void assertTransformed(String queryString, String expected, Query.Type mode, Language actualLanguage, Language queryLanguage, Linguistics linguistics) {
    Parser parser = ParserFactory.newInstance(mode, new ParserEnvironment().setIndexFacts(indexFacts).setLinguistics(linguistics));
    Item root = parser.parse(new Parsable().setQuery(queryString).setLanguage(actualLanguage)).getRoot();
    assertFalse(root instanceof NullItem);
    Query query = new Query("?language=" + queryLanguage.languageCode());
    query.getModel().getQueryTree().setRoot(root);
    new Execution(new Chain<Searcher>(new CJKSearcher()), new Execution.Context(null, indexFacts, null, null, linguistics)).search(query);
    assertEquals(expected, query.getModel().getQueryTree().getRoot().toString());
}
Also used : NullItem(com.yahoo.prelude.query.NullItem) Item(com.yahoo.prelude.query.Item) Chain(com.yahoo.component.chain.Chain) Execution(com.yahoo.search.searchchain.Execution) Query(com.yahoo.search.Query) Parsable(com.yahoo.search.query.parser.Parsable) ParserEnvironment(com.yahoo.search.query.parser.ParserEnvironment) CJKSearcher(com.yahoo.prelude.querytransform.CJKSearcher) NullItem(com.yahoo.prelude.query.NullItem) Parser(com.yahoo.search.query.parser.Parser)

Aggregations

Chain (com.yahoo.component.chain.Chain)1 Item (com.yahoo.prelude.query.Item)1 NullItem (com.yahoo.prelude.query.NullItem)1 CJKSearcher (com.yahoo.prelude.querytransform.CJKSearcher)1 Query (com.yahoo.search.Query)1 Parsable (com.yahoo.search.query.parser.Parsable)1 Parser (com.yahoo.search.query.parser.Parser)1 ParserEnvironment (com.yahoo.search.query.parser.ParserEnvironment)1 Execution (com.yahoo.search.searchchain.Execution)1