use of com.yahoo.prelude.query.NullItem 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());
}
use of com.yahoo.prelude.query.NullItem in project vespa by vespa-engine.
the class ParsingTester method parseQuery.
public Item parseQuery(String query, String filter, Language language, Query.Type type, Linguistics linguistics) {
Parser parser = ParserFactory.newInstance(type, new ParserEnvironment().setIndexFacts(indexFacts).setLinguistics(linguistics).setSpecialTokens(tokenRegistry.getSpecialTokens("default")));
Item root = parser.parse(new Parsable().setQuery(query).setFilter(filter).setLanguage(language)).getRoot();
if (root instanceof NullItem) {
return null;
}
return root;
}
Aggregations