Search in sources :

Example 1 with SubstringItem

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

the class QueryRewrite method rewriteSddocname.

private static Item rewriteSddocname(Item item) {
    if (item instanceof CompositeItem) {
        CompositeItem parent = (CompositeItem) item;
        for (int i = 0, len = parent.getItemCount(); i < len; ++i) {
            Item oldChild = parent.getItem(i);
            Item newChild = rewriteSddocname(oldChild);
            if (oldChild != newChild) {
                parent.setItem(i, newChild);
            }
        }
    } else if (item instanceof SimpleIndexedItem) {
        SimpleIndexedItem oldItem = (SimpleIndexedItem) item;
        if (Hit.SDDOCNAME_FIELD.equals(oldItem.getIndexName())) {
            SubstringItem newItem = new SubstringItem(oldItem.getIndexedString());
            newItem.setIndexName("[documentmetastore]");
            return newItem;
        }
    }
    return item;
}
Also used : CompositeItem(com.yahoo.prelude.query.CompositeItem) NullItem(com.yahoo.prelude.query.NullItem) SimpleIndexedItem(com.yahoo.prelude.query.SimpleIndexedItem) OrItem(com.yahoo.prelude.query.OrItem) SubstringItem(com.yahoo.prelude.query.SubstringItem) Item(com.yahoo.prelude.query.Item) AndItem(com.yahoo.prelude.query.AndItem) RankItem(com.yahoo.prelude.query.RankItem) NotItem(com.yahoo.prelude.query.NotItem) NearItem(com.yahoo.prelude.query.NearItem) EquivItem(com.yahoo.prelude.query.EquivItem) CompositeItem(com.yahoo.prelude.query.CompositeItem) SimpleIndexedItem(com.yahoo.prelude.query.SimpleIndexedItem) SubstringItem(com.yahoo.prelude.query.SubstringItem)

Example 2 with SubstringItem

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

the class ParseTestCase method testSubstringExtraSpace.

@Test
public void testSubstringExtraSpace() {
    Item root = tester.assertParsed("*substring*", "* substring*", 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)

Example 3 with SubstringItem

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

the class ParseTestCase method testSubstringWithWeight.

@Test
public void testSubstringWithWeight() {
    Item root = tester.assertParsed("*substring*!200", "*substring*!200", 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)

Example 4 with SubstringItem

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

the class ParseTestCase method testSingleSubstringTerm.

@Test
public void testSingleSubstringTerm() {
    Item root = tester.assertParsed("*substring*", "*substring*", 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)

Example 5 with SubstringItem

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

AndItem (com.yahoo.prelude.query.AndItem)9 CompositeItem (com.yahoo.prelude.query.CompositeItem)9 Item (com.yahoo.prelude.query.Item)9 NotItem (com.yahoo.prelude.query.NotItem)9 OrItem (com.yahoo.prelude.query.OrItem)9 RankItem (com.yahoo.prelude.query.RankItem)9 SubstringItem (com.yahoo.prelude.query.SubstringItem)9 IntItem (com.yahoo.prelude.query.IntItem)8 PhraseItem (com.yahoo.prelude.query.PhraseItem)8 PhraseSegmentItem (com.yahoo.prelude.query.PhraseSegmentItem)8 PrefixItem (com.yahoo.prelude.query.PrefixItem)8 SuffixItem (com.yahoo.prelude.query.SuffixItem)8 WordItem (com.yahoo.prelude.query.WordItem)8 Test (org.junit.Test)7 EquivItem (com.yahoo.prelude.query.EquivItem)2 NearItem (com.yahoo.prelude.query.NearItem)2 NullItem (com.yahoo.prelude.query.NullItem)2 AndSegmentItem (com.yahoo.prelude.query.AndSegmentItem)1 DotProductItem (com.yahoo.prelude.query.DotProductItem)1 ExactStringItem (com.yahoo.prelude.query.ExactStringItem)1