use of com.yahoo.prelude.query.Item in project vespa by vespa-engine.
the class ParseTestCase method testSuffixExtraSpace.
@Test
public void testSuffixExtraSpace() {
Item root = tester.assertParsed("*suffix", "* suffix", Query.Type.ANY);
assertTrue(root instanceof SuffixItem);
}
use of com.yahoo.prelude.query.Item in project vespa by vespa-engine.
the class ParseTestCase method testAvoidMultiLevelAndForLongCJKQueries.
@Test
public void testAvoidMultiLevelAndForLongCJKQueries() {
Item root = tester.parseQuery("\u30d7\u30ed\u91ce\u7403\u962a\u795e\u306e\u672c\u62e0\u5730\u3001\u7532\u5b50\u5712\u7403\u5834\uff08\u5175\u5eab\u770c\u897f\u5bae\u5e02\uff09\u306f\uff11\u65e5\u3001\uff11\uff19\uff12\uff14\u5e74\u30d7\u30ed\u91ce\u7403\u962a\u795e\u306e\u672c\u62e0\u5730\u3001\u7532\u5b50\u5712\u7403\u5834\uff08\u5175\u5eab\u770c\u897f\u5bae\u5e02\uff09\u306f\uff11\u65e5\u3001\uff11\uff19\uff12\uff14\u5e74\u30d7\u30ed\u91ce\u7403\u962a\u795e\u306e\u672c\u62e0\u5730\u3001\u7532\u5b50\u5712\u7403\u5834\uff08\u5175\u5eab\u770c\u897f\u5bae\u5e02\uff09\u306f\uff11\u65e5\u3001\uff11\uff19\uff12\uff14\u5e74\u30d7\u30ed\u91ce\u7403\u962a\u795e\u306e\u672c\u62e0\u5730\u3001\u7532\u5b50\u5712\u7403\u5834\uff08\u5175\u5eab\u770c\u897f\u5bae\u5e02\uff09\u306f\uff11\u65e5\u3001\uff11\uff19\uff12\uff14\u5e74\u30d7\u30ed\u91ce\u7403\u962a\u795e\u306e\u672c\u62e0\u5730\u3001\u7532\u5b50\u5712\u7403\u5834\uff08\u5175\u5eab\u770c\u897f\u5bae\u5e02\uff09\u306f\uff11\u65e5\u3001\uff11\uff19\uff12\uff14\u5e74\u30d7\u30ed\u91ce\u7403\u962a\u795e\u306e\u672c\u62e0\u5730\u3001\u7532\u5b50\u5712\u7403\u5834\uff08\u5175\u5eab\u770c\u897f\u5bae\u5e02\uff09\u306f\uff11\u65e5\u3001\uff11\uff19\uff12\uff14\u5e74", "", Language.UNKNOWN, Query.Type.ALL, TestLinguistics.INSTANCE);
assertTrue("Query tree too deep when parsing CJK queries.", 4 > stackDepth(0, root));
}
use of com.yahoo.prelude.query.Item in project vespa by vespa-engine.
the class ParseTestCase method testFakeCJKSegmentingOfPhrase.
@Test
public void testFakeCJKSegmentingOfPhrase() {
// "first" "second" and "third" are segments in the test language
Item item = tester.parseQuery("name:\"firstsecondthird\"", null, Language.CHINESE_SIMPLIFIED, Query.Type.ANY, TestLinguistics.INSTANCE);
assertTrue(item instanceof PhraseSegmentItem);
PhraseSegmentItem phrase = (PhraseSegmentItem) item;
assertEquals(3, phrase.getItemCount());
assertEquals("name:first", phrase.getItem(0).toString());
assertEquals("name:second", phrase.getItem(1).toString());
assertEquals("name:third", phrase.getItem(2).toString());
assertEquals("name", ((WordItem) phrase.getItem(0)).getIndexName());
assertEquals("name", ((WordItem) phrase.getItem(1)).getIndexName());
assertEquals("name", ((WordItem) phrase.getItem(2)).getIndexName());
}
use of com.yahoo.prelude.query.Item in project vespa by vespa-engine.
the class ParseTestCase method testNumberAsPrefix.
@Test
public void testNumberAsPrefix() {
Item root = tester.assertParsed("89*", "89*", Query.Type.ANY);
assertTrue(root instanceof PrefixItem);
}
use of com.yahoo.prelude.query.Item in project vespa by vespa-engine.
the class ParseTestCase method testSubstringExtraStar.
@Test
public void testSubstringExtraStar() {
Item root = tester.assertParsed("*substring*", "**substring**", Query.Type.ANY);
assertTrue(root instanceof SubstringItem);
}
Aggregations