Search in sources :

Example 6 with Parser

use of com.yahoo.search.query.parser.Parser 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;
}
Also used : NullItem(com.yahoo.prelude.query.NullItem) Item(com.yahoo.prelude.query.Item) Parsable(com.yahoo.search.query.parser.Parsable) ParserEnvironment(com.yahoo.search.query.parser.ParserEnvironment) NullItem(com.yahoo.prelude.query.NullItem) Parser(com.yahoo.search.query.parser.Parser)

Aggregations

Parser (com.yahoo.search.query.parser.Parser)6 Parsable (com.yahoo.search.query.parser.Parsable)5 Item (com.yahoo.prelude.query.Item)4 NullItem (com.yahoo.prelude.query.NullItem)4 ParserEnvironment (com.yahoo.search.query.parser.ParserEnvironment)4 AndItem (com.yahoo.prelude.query.AndItem)2 CompositeItem (com.yahoo.prelude.query.CompositeItem)2 PhraseItem (com.yahoo.prelude.query.PhraseItem)2 WordItem (com.yahoo.prelude.query.WordItem)2 Query (com.yahoo.search.Query)2 Chain (com.yahoo.component.chain.Chain)1 IndexFacts (com.yahoo.prelude.IndexFacts)1 AndSegmentItem (com.yahoo.prelude.query.AndSegmentItem)1 DotProductItem (com.yahoo.prelude.query.DotProductItem)1 EquivItem (com.yahoo.prelude.query.EquivItem)1 ExactStringItem (com.yahoo.prelude.query.ExactStringItem)1 IntItem (com.yahoo.prelude.query.IntItem)1 NearItem (com.yahoo.prelude.query.NearItem)1 NotItem (com.yahoo.prelude.query.NotItem)1 ONearItem (com.yahoo.prelude.query.ONearItem)1