java - Hibernate search range in a List<Integer> -
i starting hibernate search , struggling query on list<integer>
i created bridge translate list<integer> string. this, able search keyword exact matches on item on list, don't seem able query using range.
my entity has attribute "b" defined list.
i know if can me query entities have of b elements inside defined range?
for example: instance following collection {1,10, 15}, should come in following queries on "b" attribute:
below(20), above(14), below(2)
but not in search like:
above(16), below(0).
i hope made myself clear. in advance!
change bridge storing same field multiple times, each value of integer list. assuming field called myint, store myint = 1, myint = 10 , myint = 15, example code:
public class mybridge implements fieldbridge { public void set(string name, object value, document document, luceneoptions luceneoptions) { if (value instanceof list){ for(object myint:(list)value){ field myintfield = new field(name, myint.tostring(), luceneoptions.getstore(), luceneoptions.getindex(), luceneoptions.gettermvector()); myintfield.setboost(luceneoptions.getboost()); document.add(myintfield); } } } }
alternately, might able plugin custom lucene filter it, filters bit convoluted.
Comments
Post a Comment