Search in sources :

Example 41 with Item

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

the class ParseTestCase method testNumberParsing.

@Test
public void testNumberParsing() {
    Item root = tester.parseQuery("normal:400", null, Language.UNKNOWN, Query.Type.ANY, TestLinguistics.INSTANCE);
    assertEquals(root.getCode(), 5);
}
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) Test(org.junit.Test)

Example 42 with Item

use of com.yahoo.prelude.query.Item 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)

Example 43 with Item

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

the class ParseTestCase method testDecimal.

@Test
public void testDecimal() {
    Item root = tester.assertParsed("2.2", "2.2", Query.Type.ALL);
    assertTrue(root instanceof IntItem);
    tester.assertParsed("normal:2.2", "normal:2.2", Query.Type.ALL);
}
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) IntItem(com.yahoo.prelude.query.IntItem) Test(org.junit.Test)

Example 44 with Item

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

the class ParseTestCase method testSuffixExtraStar.

@Test
public void testSuffixExtraStar() {
    Item root = tester.assertParsed("*suffix", "**suffix", Query.Type.ANY);
    assertTrue(root 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) Test(org.junit.Test)

Example 45 with Item

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

the class ParseTestCase method testNumberAsSubstring.

@Test
public void testNumberAsSubstring() {
    Item root = tester.assertParsed("*89*", "*89*", Query.Type.ANY);
    assertTrue(root instanceof SubstringItem);
}
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) SubstringItem(com.yahoo.prelude.query.SubstringItem) Test(org.junit.Test)

Aggregations

Item (com.yahoo.prelude.query.Item)116 AndItem (com.yahoo.prelude.query.AndItem)85 CompositeItem (com.yahoo.prelude.query.CompositeItem)82 WordItem (com.yahoo.prelude.query.WordItem)73 PhraseItem (com.yahoo.prelude.query.PhraseItem)66 NotItem (com.yahoo.prelude.query.NotItem)62 RankItem (com.yahoo.prelude.query.RankItem)60 SubstringItem (com.yahoo.prelude.query.SubstringItem)60 Test (org.junit.Test)58 OrItem (com.yahoo.prelude.query.OrItem)57 PrefixItem (com.yahoo.prelude.query.PrefixItem)53 SuffixItem (com.yahoo.prelude.query.SuffixItem)53 IntItem (com.yahoo.prelude.query.IntItem)52 PhraseSegmentItem (com.yahoo.prelude.query.PhraseSegmentItem)51 NullItem (com.yahoo.prelude.query.NullItem)24 Query (com.yahoo.search.Query)22 EquivItem (com.yahoo.prelude.query.EquivItem)14 NearItem (com.yahoo.prelude.query.NearItem)14 ExactStringItem (com.yahoo.prelude.query.ExactStringItem)12 IndexedItem (com.yahoo.prelude.query.IndexedItem)12