Search in sources :

Example 1 with CollapsePhraseSearcher

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

the class CollapsePhraseSearcherTestCase method transformQuery.

private String transformQuery(String rawQuery) {
    CollapsePhraseSearcher searcher = new CollapsePhraseSearcher();
    Query query = new Query(rawQuery);
    new Execution(searcher, Execution.Context.createContextStub()).search(query);
    Item newRoot = query.getModel().getQueryTree().getRoot();
    if (newRoot != null)
        return newRoot.toString();
    else
        return null;
}
Also used : PhraseItem(com.yahoo.prelude.query.PhraseItem) CompositeItem(com.yahoo.prelude.query.CompositeItem) Item(com.yahoo.prelude.query.Item) AndItem(com.yahoo.prelude.query.AndItem) WordItem(com.yahoo.prelude.query.WordItem) Execution(com.yahoo.search.searchchain.Execution) Query(com.yahoo.search.Query) CollapsePhraseSearcher(com.yahoo.prelude.querytransform.CollapsePhraseSearcher)

Example 2 with CollapsePhraseSearcher

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

the class CollapsePhraseSearcherTestCase method transformQuery.

private String transformQuery(Item queryTree) {
    CollapsePhraseSearcher searcher = new CollapsePhraseSearcher();
    Query query = new Query();
    query.getModel().getQueryTree().setRoot(queryTree);
    new Execution(searcher, Execution.Context.createContextStub()).search(query);
    Item newRoot = query.getModel().getQueryTree().getRoot();
    if (newRoot != null)
        return newRoot.toString();
    else
        return null;
}
Also used : PhraseItem(com.yahoo.prelude.query.PhraseItem) CompositeItem(com.yahoo.prelude.query.CompositeItem) Item(com.yahoo.prelude.query.Item) AndItem(com.yahoo.prelude.query.AndItem) WordItem(com.yahoo.prelude.query.WordItem) Execution(com.yahoo.search.searchchain.Execution) Query(com.yahoo.search.Query) CollapsePhraseSearcher(com.yahoo.prelude.querytransform.CollapsePhraseSearcher)

Aggregations

AndItem (com.yahoo.prelude.query.AndItem)2 CompositeItem (com.yahoo.prelude.query.CompositeItem)2 Item (com.yahoo.prelude.query.Item)2 PhraseItem (com.yahoo.prelude.query.PhraseItem)2 WordItem (com.yahoo.prelude.query.WordItem)2 CollapsePhraseSearcher (com.yahoo.prelude.querytransform.CollapsePhraseSearcher)2 Query (com.yahoo.search.Query)2 Execution (com.yahoo.search.searchchain.Execution)2