Hi, Naimdjon,
I have some suggestions as well along the lines of Mark Harwood.
As an example, suppose for each hotel room there is a description, and
you want the user to do free text search on the description field.
You could do the following:
1) store hotel room reservation info as rows in a relational database
create table reservation (
id int,
room_no int,
reservation_start_date timestamp,
reservation_end_date timestamp,
primary key (id)
)
2) store description for each hotel room in Lucene index with two
fields, i.e., room_no, description
3) provide the user with free text search in room description as well
as availability info like the following:
--do full text search on description using the Lucene index
--get the room numbers from the search result documents
--using these room numbers, look up in the reservation table to see if
the user specified start date and end date is not already reserved.
--The top serveral rooms that are high on the free text search result
and also not reserved will be returned to the user
How does this sound?
Jian
On 6/29/05, Erik Hatcher <erik@ehatchersolutions.com> wrote:
> I second Mark's suggestion over the alternative I posted. My
> alternative was merely to invert the field structure originally
> described, but using a Filter for the volatile information is wiser.
>
> Erik
>
> On Jun 29, 2005, at 9:58 AM, mark harwood wrote:
>
> > Presumably there is also a free-text element to the
> > search or you wouldn't be using Lucene.
> >
> > Multiple fields is not the way to go.
> > A single Lucene field could contain multiple terms (
> > the available dates) but I still don't think that's
> > the best solution.
> > The availability info is likely to be pretty volatile
> > and you always want up-to-date info so I would prefer
> > to hit a database for this. If you keep a DB primary
> > key to Lucene doc id look-up cached in memory you can
> > quickly construct a Lucene filter from the database
> > results and therefore only show Lucene results for
> > available rooms.
> >
> > Cheers
> > Mark
> >
> >
> >
> > ___________________________________________________________
> > How much free photo storage do you get? Store your holiday
> > snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-user-help@lucene.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
|