solr - lucene ResponseBuilder getFilters wrong encoding for int field type -


i getting weird values solr "int" field type. when listing responsebuilder filters getting below value countryid. note outletid field of type string. problem happening every field in solr schema "int" type

term field , value

<fieldtype name="int" class="solr.trieintfield" precisionstep="0" positionincrementgap="0"/>    list<query> filters = rb.getfilters();  set<term> curterms = null;  (query q : filters) {                 curterms = new hashset<term>();   q.extractterms(curterms);                (term term : curterms) {                      system.out.println(term.field() + " = " + term.bytes().utf8tostring());   }  } 

any idea might causing problem??

http://grepcode.com/file/repo1.maven.org/maven2/org.apache.lucene/lucene-core/4.0.0/org/apache/lucene/index/term.java#term.text%28%29

what got using term.bytes() raw binary representation of term. if can convert text string related field, never case. display term should first convert it's raw value integer before trying convert string

you may want take @ http://docs.oracle.com/javase/6/docs/api/java/nio/bytebuffer.html converting byte[] integer

to retrieve byte array term.bytes().bytes should trick.

also term.bytes().utf8tostring() equivalent term.text()


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -