Is it possible to make lucene.net ignore case of the field for queries? -
i have documents indexed field "guidid" field , "guidid". how can make lucene net ignore case ...so following query searches regardless of case ?
termquery termquery = new termquery(new term("guidid", guidid.tostring()));
i don't want write query documents fields "guidid" ..i.e. lowercase
ideally, don't have fields names funky cases. if defining field names dynamically or such, should lowercase them before adding them index. done, should easy enough keep query fields' names lowercase well, , you're in shape.
if, whatever reason, stuck case-sensitive data, you'll stuck expanding queries search known permutations of field name results. like:
query finalquery = new disjunctionmaxquery(0) finalquery.add(new termquery(new term("guidid", guidid.tostring()))); finalquery.add(new termquery(new term("guidid", guidid.tostring())));
disjunctionmaxquery
choice here, since returns maximum scoring hit among query collection, rather possibly compounding scores across multiple hits.
you can use multifieldqueryparser
similar effect. don't believe uses disjunctionmax, doesn't sound big deal in case.
Comments
Post a Comment