Is there a way to use MultiFieldQuery in combination with NumericRanges in Lucene?

I am currently creating and viewing this with a MultiFieldQueryParser. I have about 20 different fields for all different data types, and I would like the search to take them all into account. Here's how I create a parser and get the request object:

MultiFieldQueryParser mfqp = new MultiFieldQueryParser(
                keyHashSet.toArray(new String[] {}), analyzer);

mfqp.setAllowLeadingWildcard(true);

Query q = mfqp.parse(search);

System.out.println(q.getClass());

      

Where keyHashSet has all my data keys.

Whenever I pass a range request like:

Heading:[0 to 360]

      

The class returned from the printout is

class org.apache.lucene.search.TermRangeQuery

      

Although I'm setting up the Title field like this:

doc.add(new FloatField("Heading", value, Field.Store.YES));

      

Is there a way to accomplish NumericRangeQuery

with MultiFieldQueryParser

?

+3


source to share





All Articles