Search in sources :

Example 1 with OrItem

use of com.yahoo.prelude.query.OrItem in project vespa by vespa-engine.

the class ParseTestCase method testIndexSuffixExtraSpace.

@Test
public void testIndexSuffixExtraSpace() {
    Item root = tester.assertParsed("OR foo suffix", "foo:* suffix", Query.Type.ANY);
    assertTrue(((OrItem) root).getItem(0) instanceof WordItem);
    assertTrue(((OrItem) root).getItem(1) instanceof WordItem);
}
Also used : CompositeItem(com.yahoo.prelude.query.CompositeItem) PhraseSegmentItem(com.yahoo.prelude.query.PhraseSegmentItem) PrefixItem(com.yahoo.prelude.query.PrefixItem) Item(com.yahoo.prelude.query.Item) SuffixItem(com.yahoo.prelude.query.SuffixItem) IntItem(com.yahoo.prelude.query.IntItem) OrItem(com.yahoo.prelude.query.OrItem) PhraseItem(com.yahoo.prelude.query.PhraseItem) SubstringItem(com.yahoo.prelude.query.SubstringItem) AndItem(com.yahoo.prelude.query.AndItem) RankItem(com.yahoo.prelude.query.RankItem) WordItem(com.yahoo.prelude.query.WordItem) NotItem(com.yahoo.prelude.query.NotItem) WordItem(com.yahoo.prelude.query.WordItem) OrItem(com.yahoo.prelude.query.OrItem) Test(org.junit.Test)

Example 2 with OrItem

use of com.yahoo.prelude.query.OrItem in project vespa by vespa-engine.

the class ParseTestCase method testSuffixAndWordTerms.

@Test
public void testSuffixAndWordTerms() {
    Item root = tester.assertParsed("OR foo *suffix bar", "foo *suffix bar", Query.Type.ANY);
    assertTrue(((OrItem) root).getItem(1) instanceof SuffixItem);
}
Also used : SuffixItem(com.yahoo.prelude.query.SuffixItem) CompositeItem(com.yahoo.prelude.query.CompositeItem) PhraseSegmentItem(com.yahoo.prelude.query.PhraseSegmentItem) PrefixItem(com.yahoo.prelude.query.PrefixItem) Item(com.yahoo.prelude.query.Item) SuffixItem(com.yahoo.prelude.query.SuffixItem) IntItem(com.yahoo.prelude.query.IntItem) OrItem(com.yahoo.prelude.query.OrItem) PhraseItem(com.yahoo.prelude.query.PhraseItem) SubstringItem(com.yahoo.prelude.query.SubstringItem) AndItem(com.yahoo.prelude.query.AndItem) RankItem(com.yahoo.prelude.query.RankItem) WordItem(com.yahoo.prelude.query.WordItem) NotItem(com.yahoo.prelude.query.NotItem) OrItem(com.yahoo.prelude.query.OrItem) Test(org.junit.Test)

Example 3 with OrItem

use of com.yahoo.prelude.query.OrItem in project vespa by vespa-engine.

the class PhrasingSearcherTestCase method testNoFileNoChange.

@Test
public void testNoFileNoChange() {
    Searcher searcher = new PhrasingSearcher("");
    Query query = new Query();
    AndItem andItem = new AndItem();
    andItem.addItem(new WordItem("no", "anindex"));
    andItem.addItem(new WordItem("such", "anindex"));
    andItem.addItem(new WordItem("phrase", "indexo"));
    OrItem orItem = new OrItem();
    orItem.addItem(new WordItem("habla"));
    orItem.addItem(new WordItem("babla"));
    orItem.addItem(new WordItem("habla"));
    andItem.addItem(orItem);
    query.getModel().getQueryTree().setRoot(andItem);
    new Execution(searcher, Execution.Context.createContextStub()).search(query);
    assertEquals("AND anindex:no anindex:such indexo:phrase (OR habla babla habla)", query.getModel().getQueryTree().getRoot().toString());
}
Also used : Execution(com.yahoo.search.searchchain.Execution) Query(com.yahoo.search.Query) AndItem(com.yahoo.prelude.query.AndItem) Searcher(com.yahoo.search.Searcher) PhrasingSearcher(com.yahoo.prelude.querytransform.PhrasingSearcher) WordItem(com.yahoo.prelude.query.WordItem) PhrasingSearcher(com.yahoo.prelude.querytransform.PhrasingSearcher) OrItem(com.yahoo.prelude.query.OrItem) Test(org.junit.Test)

Example 4 with OrItem

use of com.yahoo.prelude.query.OrItem in project vespa by vespa-engine.

the class ParseTestCase method testIndexSubstringExtraSpace.

@Test
public void testIndexSubstringExtraSpace() {
    Item root = tester.assertParsed("OR foo substring*", "foo:* substring*", Query.Type.ANY);
    assertTrue(((OrItem) root).getItem(0) instanceof WordItem);
    assertTrue(((OrItem) root).getItem(1) instanceof PrefixItem);
}
Also used : CompositeItem(com.yahoo.prelude.query.CompositeItem) PhraseSegmentItem(com.yahoo.prelude.query.PhraseSegmentItem) PrefixItem(com.yahoo.prelude.query.PrefixItem) Item(com.yahoo.prelude.query.Item) SuffixItem(com.yahoo.prelude.query.SuffixItem) IntItem(com.yahoo.prelude.query.IntItem) OrItem(com.yahoo.prelude.query.OrItem) PhraseItem(com.yahoo.prelude.query.PhraseItem) SubstringItem(com.yahoo.prelude.query.SubstringItem) AndItem(com.yahoo.prelude.query.AndItem) RankItem(com.yahoo.prelude.query.RankItem) WordItem(com.yahoo.prelude.query.WordItem) NotItem(com.yahoo.prelude.query.NotItem) WordItem(com.yahoo.prelude.query.WordItem) PrefixItem(com.yahoo.prelude.query.PrefixItem) OrItem(com.yahoo.prelude.query.OrItem) Test(org.junit.Test)

Example 5 with OrItem

use of com.yahoo.prelude.query.OrItem in project vespa by vespa-engine.

the class ParseTestCase method testIndexSubstringExtraSpace2.

@Test
public void testIndexSubstringExtraSpace2() {
    Item root = tester.assertParsed("OR foo substring", "foo:* substring *", Query.Type.ANY);
    assertTrue(((OrItem) root).getItem(0) instanceof WordItem);
    assertTrue(((OrItem) root).getItem(1) instanceof WordItem);
}
Also used : CompositeItem(com.yahoo.prelude.query.CompositeItem) PhraseSegmentItem(com.yahoo.prelude.query.PhraseSegmentItem) PrefixItem(com.yahoo.prelude.query.PrefixItem) Item(com.yahoo.prelude.query.Item) SuffixItem(com.yahoo.prelude.query.SuffixItem) IntItem(com.yahoo.prelude.query.IntItem) OrItem(com.yahoo.prelude.query.OrItem) PhraseItem(com.yahoo.prelude.query.PhraseItem) SubstringItem(com.yahoo.prelude.query.SubstringItem) AndItem(com.yahoo.prelude.query.AndItem) RankItem(com.yahoo.prelude.query.RankItem) WordItem(com.yahoo.prelude.query.WordItem) NotItem(com.yahoo.prelude.query.NotItem) WordItem(com.yahoo.prelude.query.WordItem) OrItem(com.yahoo.prelude.query.OrItem) Test(org.junit.Test)

Aggregations

AndItem (com.yahoo.prelude.query.AndItem)12 OrItem (com.yahoo.prelude.query.OrItem)12 Test (org.junit.Test)12 WordItem (com.yahoo.prelude.query.WordItem)11 PhraseItem (com.yahoo.prelude.query.PhraseItem)8 RankItem (com.yahoo.prelude.query.RankItem)8 Item (com.yahoo.prelude.query.Item)7 NotItem (com.yahoo.prelude.query.NotItem)7 PhraseSegmentItem (com.yahoo.prelude.query.PhraseSegmentItem)7 CompositeItem (com.yahoo.prelude.query.CompositeItem)6 IntItem (com.yahoo.prelude.query.IntItem)6 PrefixItem (com.yahoo.prelude.query.PrefixItem)6 SubstringItem (com.yahoo.prelude.query.SubstringItem)6 SuffixItem (com.yahoo.prelude.query.SuffixItem)6 Query (com.yahoo.search.Query)4 PhrasingSearcher (com.yahoo.prelude.querytransform.PhrasingSearcher)2 Searcher (com.yahoo.search.Searcher)2 Execution (com.yahoo.search.searchchain.Execution)2 EquivItem (com.yahoo.prelude.query.EquivItem)1 NearItem (com.yahoo.prelude.query.NearItem)1