Search in sources :

Example 91 with Execution

use of com.yahoo.search.searchchain.Execution in project vespa by vespa-engine.

the class LegacyCombinatorTestCase method testReqAndNotWithQuerySyntaxAll.

public void testReqAndNotWithQuerySyntaxAll() {
    Query q = new Query("?query.juhu=b+c&query.juhu.defidx=nalle&query.juhu.operator=not&query.juhu.type=any&query.bamse=z&query.bamse.defidx=y");
    Execution e = new Execution(searcher, Execution.Context.createContextStub(new IndexFacts()));
    e.search(q);
    assertEquals("+y:z -(OR nalle:b nalle:c)", q.getModel().getQueryTree().toString());
}
Also used : Execution(com.yahoo.search.searchchain.Execution) Query(com.yahoo.search.Query) IndexFacts(com.yahoo.prelude.IndexFacts)

Example 92 with Execution

use of com.yahoo.search.searchchain.Execution in project vespa by vespa-engine.

the class LegacyCombinatorTestCase method testNoBaseQuery.

public void testNoBaseQuery() {
    Query q = new Query("?query.juhu=b");
    Execution e = new Execution(searcher, Execution.Context.createContextStub(new IndexFacts()));
    e.search(q);
    assertEquals("b", q.getModel().getQueryTree().toString());
}
Also used : Execution(com.yahoo.search.searchchain.Execution) Query(com.yahoo.search.Query) IndexFacts(com.yahoo.prelude.IndexFacts)

Example 93 with Execution

use of com.yahoo.search.searchchain.Execution in project vespa by vespa-engine.

the class LegacyCombinatorTestCase method testNotCombinatorWithoutRoot.

public void testNotCombinatorWithoutRoot() {
    Query q = new Query("?query.juhu=b&query.juhu.defidx=nalle&query.juhu.operator=not");
    Execution e = new Execution(searcher, Execution.Context.createContextStub(new IndexFacts()));
    e.search(q);
    assertEquals("NULL", q.getModel().getQueryTree().toString());
    assertTrue("No expected error found.", q.errors().size() > 0);
    System.out.println(q.errors());
    assertEquals("Did not get invalid query parameter error as expected.", Error.INVALID_QUERY_PARAMETER.code, q.errors().get(0).getCode());
}
Also used : Execution(com.yahoo.search.searchchain.Execution) Query(com.yahoo.search.Query) IndexFacts(com.yahoo.prelude.IndexFacts)

Example 94 with Execution

use of com.yahoo.search.searchchain.Execution in project vespa by vespa-engine.

the class NGramSearcherTestCase method assertGramsWithSegmentationMixedAndPhrases.

public void assertGramsWithSegmentationMixedAndPhrases(Chain<Searcher> chain) {
    // "first" "second" and "third" are segments in the "test" language
    Item item = parseQuery("a gram14:\"afirstsecondthird b hi\"", Query.Type.ALL);
    Query q = new Query("?query=ignored");
    q.getModel().setLanguage(Language.UNKNOWN);
    q.getModel().getQueryTree().setRoot(item);
    new Execution(chain, createContextStub(indexFacts)).search(q);
    assertEquals("AND a gram14:\"afirstsecondth firstsecondthi irstsecondthir rstsecondthird b hi\"", q.getModel().getQueryTree().toString());
}
Also used : 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)

Example 95 with Execution

use of com.yahoo.search.searchchain.Execution in project vespa by vespa-engine.

the class NGramSearcherTestCase method testNGramRewritingMixedQuery.

public void testNGramRewritingMixedQuery() {
    Query q = new Query("?query=foo+gram3:engul+test:bar");
    new Execution(searcher, Execution.Context.createContextStub(indexFacts)).search(q);
    assertEquals("AND foo (AND gram3:eng gram3:ngu gram3:gul) test:bar", q.getModel().getQueryTree().toString());
}
Also used : Execution(com.yahoo.search.searchchain.Execution) Query(com.yahoo.search.Query)

Aggregations

Execution (com.yahoo.search.searchchain.Execution)232 Query (com.yahoo.search.Query)184 Result (com.yahoo.search.Result)127 Test (org.junit.Test)123 Searcher (com.yahoo.search.Searcher)88 Chain (com.yahoo.component.chain.Chain)59 IndexFacts (com.yahoo.prelude.IndexFacts)34 Hit (com.yahoo.search.result.Hit)25 FeedContext (com.yahoo.feedapi.FeedContext)20 MessagePropertyProcessor (com.yahoo.feedapi.MessagePropertyProcessor)20 NullFeedMetric (com.yahoo.feedhandler.NullFeedMetric)20 ClusterList (com.yahoo.vespaclient.ClusterList)20 AndItem (com.yahoo.prelude.query.AndItem)18 WordItem (com.yahoo.prelude.query.WordItem)17 ComponentId (com.yahoo.component.ComponentId)13 GetDocumentReply (com.yahoo.documentapi.messagebus.protocol.GetDocumentReply)13 FastHit (com.yahoo.prelude.fastsearch.FastHit)13 FederationSearcher (com.yahoo.search.federation.FederationSearcher)13 ArrayList (java.util.ArrayList)12 CompositeItem (com.yahoo.prelude.query.CompositeItem)11