Search in sources :

Example 21 with WordItem

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

the class QueryLanguageTestCase method testWord.

@Test
public void testWord() {
    WordItem w = new WordItem("test");
    assertEquals("test", w.toString());
}
Also used : WordItem(com.yahoo.prelude.query.WordItem) Test(org.junit.Test)

Example 22 with WordItem

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

the class CollapsePhraseSearcherTestCase method testPositive2.

@Test
public void testPositive2() {
    AndItem root = new AndItem();
    root.addItem(new WordItem("a"));
    CompositeItem embedded = new AndItem();
    embedded.addItem(new WordItem("bcd"));
    CompositeItem phrase = new PhraseItem();
    phrase.addItem(new WordItem("def"));
    embedded.addItem(phrase);
    root.addItem(embedded);
    root.addItem(new WordItem("e"));
    assertEquals("AND a (AND bcd def) e", transformQuery(root));
}
Also used : CompositeItem(com.yahoo.prelude.query.CompositeItem) AndItem(com.yahoo.prelude.query.AndItem) WordItem(com.yahoo.prelude.query.WordItem) PhraseItem(com.yahoo.prelude.query.PhraseItem) Test(org.junit.Test)

Example 23 with WordItem

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

the class CollapsePhraseSearcherTestCase method testNegative3.

@Test
public void testNegative3() {
    AndItem root = new AndItem();
    root.addItem(new WordItem("a"));
    CompositeItem embedded = new AndItem();
    embedded.addItem(new WordItem("bcd"));
    CompositeItem phrase = new PhraseItem();
    phrase.addItem(new WordItem("def"));
    phrase.addItem(new WordItem("ghi"));
    embedded.addItem(phrase);
    root.addItem(embedded);
    root.addItem(new WordItem("e"));
    assertEquals("AND a (AND bcd \"def ghi\") e", transformQuery(root));
}
Also used : CompositeItem(com.yahoo.prelude.query.CompositeItem) AndItem(com.yahoo.prelude.query.AndItem) WordItem(com.yahoo.prelude.query.WordItem) PhraseItem(com.yahoo.prelude.query.PhraseItem) Test(org.junit.Test)

Example 24 with WordItem

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

the class CollapsePhraseSearcherTestCase method testPositive1.

@Test
public void testPositive1() {
    AndItem root = new AndItem();
    root.addItem(new WordItem("a"));
    PhraseItem embedded = new PhraseItem();
    embedded.addItem(new WordItem("bcd"));
    root.addItem(embedded);
    root.addItem(new WordItem("e"));
    assertEquals("AND a bcd e", transformQuery(root));
}
Also used : AndItem(com.yahoo.prelude.query.AndItem) WordItem(com.yahoo.prelude.query.WordItem) PhraseItem(com.yahoo.prelude.query.PhraseItem) Test(org.junit.Test)

Example 25 with WordItem

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

the class CollapsePhraseSearcherTestCase method testSimplePositive.

@Test
public void testSimplePositive() {
    PhraseItem root = new PhraseItem();
    root.addItem(new WordItem("abc"));
    assertEquals("abc", transformQuery(root));
}
Also used : WordItem(com.yahoo.prelude.query.WordItem) PhraseItem(com.yahoo.prelude.query.PhraseItem) Test(org.junit.Test)

Aggregations

WordItem (com.yahoo.prelude.query.WordItem)93 Test (org.junit.Test)76 AndItem (com.yahoo.prelude.query.AndItem)45 PhraseItem (com.yahoo.prelude.query.PhraseItem)31 Query (com.yahoo.search.Query)25 PhraseSegmentItem (com.yahoo.prelude.query.PhraseSegmentItem)20 CompositeItem (com.yahoo.prelude.query.CompositeItem)18 Item (com.yahoo.prelude.query.Item)17 MarkerWordItem (com.yahoo.prelude.query.MarkerWordItem)16 NotItem (com.yahoo.prelude.query.NotItem)16 OrItem (com.yahoo.prelude.query.OrItem)13 ByteBuffer (java.nio.ByteBuffer)11 PrefixItem (com.yahoo.prelude.query.PrefixItem)10 SubstringItem (com.yahoo.prelude.query.SubstringItem)10 SuffixItem (com.yahoo.prelude.query.SuffixItem)10 Execution (com.yahoo.search.searchchain.Execution)10 RankItem (com.yahoo.prelude.query.RankItem)9 PhraseMatcher (com.yahoo.prelude.querytransform.PhraseMatcher)9 IntItem (com.yahoo.prelude.query.IntItem)8 WeakAndItem (com.yahoo.prelude.query.WeakAndItem)7