Integrated the QueryParser of Lucene in to my application's search. I have a stringField for which i have to perform some comparison operators also.
eg: age>3 age<4
But i cannot make the field Int.Because sometimes it may have the string values like "NIL","Undefined" etc.
So is there anyway to apply multiple types to the same field.Or is it possible to apply comparison operators with the stringField itself? Please help.
Use Range query:
It will work for String type also.
Reference: http://lucene.apache.org/core/2_9_4/queryparsersyntax.html#Range%20Searches