lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Lea <>
Subject Re: How to perform Date Range Search
Date Thu, 27 Jun 2013 09:38:17 GMT
Concatenating all your searchable fields into one is certainly what
I'd do.  Simple and efficient.

And yes, you can perform range searches via the query parser - the
example you give matches the one in the docs at
so it looks like you've found the docs.

Assemble your query as you want e.g. "contents: important AND
date:[whatever TO whatever]".

You'll get better performance by indexing the data as a NumericField
and using NumericRangeQuery or, better if often searching over the
same date range, NumericRangeFilter optionally cached with

I don't think the standard query parser supports ranges on a
NumericField directly.  See
or one of the other hits for a google search on the subject.

Or simply build the query up in code.


On Wed, Jun 26, 2013 at 9:36 PM,  <> wrote:
> Hi,
> I have indexed a database table which has about 70 columns out of which 60 columns have
been indexed and the rest have been stored. There are 70 million records in this table. This
is a static table and hence I plan to index them at once and then perform the search on these
> I performed a brief comparison between the usually discussed 2 options:
> -          Concatenate all the fields separated by a space and then search my keyword
in this single field.
> -          Store the 60 columns in 60 separate fields while indexing and then use MultiFieldQueryParser
to search the single keyword in all the 60 fields.
> I noticed that the performance was significantly better in option 1. Hence I continued
with it. Please let me know if you still think this is not an efficient approach.
> Question 2:
> Among the 60 columns, one column is a date field and I need to perform a date-range filter
while searching for a keyword. I read that date-range filter can be performed as below in
the documentation.
> mod_date:[20020101 TO 20030101]
> I presume mod_date is the name of one of the fields stored in the indexes. Do I have
to use MultiFieldQueryParser to be able to perform date-range filter or is there a way to
perform date-range and string search using the QueryParser?
> Right now, to search a word "important", I search it against one field (which is a list
of concatenated columns). Do you think I can do that as well as filter records by the date
> Regards,
> Raghu
> _______________________________________________
> This message is for information purposes only, it is not a recommendation, advice, offer
or solicitation to buy or sell a product or service nor an official confirmation of any transaction.
It is directed at persons who are professionals and is not intended for retail customer use.
Intended for recipient only. This message is subject to the terms at:
> For important disclosures, please see: regarding
market commentary from Barclays Sales and/or Trading, who are active market participants;
and in respect of Barclays Research, including disclosures relating to specific issuers, please
> _______________________________________________

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message