lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: Design question [too many fields?]
Date Wed, 29 Jun 2005 14:01:38 GMT

On Jun 29, 2005, at 9:18 AM, Naimdjon Takhirov wrote:

> Hi,
> We are porting our search functionality over to lucene
> in our hotel solution which is java based. Today
> search is done directly against the database.
> There is a date search, i.e tourist would like to
> search for free rooms fromDate and toDate.
> The documents are added to the index pr hotel
> room(product). Our customer wants availability info
> for min. one year.
> First I thought of having available date fields pr day
> and value as true like this:
> "29062006:true"
> "02072006:true"
> ...
> ...
> ...
> "30122006:true"
> and when searching we would search for every day
> availability of the rooms the user wrote in from/to
> input fields.
> That would create a minimum of 390 fields pr document.
> It doesn't look so elegant solution to me.
> Has anybody had similar issues? What would be best
> approach to fix it? Thanks in advance.

Another option:
Rather than make fields for each date, create a "date" field.  For  
each date the room is available, add a term in the form "YYYYMMDD" to  
that field.  You can add multiple Field.Keyword("date", "<YYYYMMDD>")  
fields to a document.

For searching, use RangeQuery on the "date" field.

     Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message