Dnia 01-10-2004, pią o godzinie 07:57 -0500, Scott Ganyo napisał(a):
> You can use:
> 
> BooleanQuery.setMaxClauseCount(int maxClauseCount);

I had a similar problem with date ranges. Someone on the list suggested
me a solution to my problems but it was more clever than the above
solution, which helps but makes the searches work slower and is memory
hungry (many terms are loaded into memmory, and than searched).

The solution suggested was to split dates into sub fields during
indexing and use those fields while searching. This makes it more
effective but harder to create a query (personally I prefer working on
queries build using Lucene API, than ones parsed by QueryParser).

For instance the time stamp 2004-10-01 15:34:26.001 may be split into
following fields:
<some-date>_year: 2004
<some-date>_month: 10
<some-date>_day: 01
<some-date>_time: 153426001

The above fields should be indexed so they can be searched. They give
some nice possibilities, for instance fast and easy querying for all
documents that have a date in a particular year, month or day of month.
For conveniece one could also store weekdays.

A query for a date range from 15th august to 10th october 2004 (in no
particular query language - this just gives an idea):
<some-date>_year = 2004 AND (
   (<some-date>_month = 08 AND <some-date>_day >= 15) OR
   (<some-date>_month=09) OR
   (<some-date>_month = 10 AND <some-date>_day <= 10)
)

As You can see it is easy to build such a query from the lucene API. The
equalities are Term queries. The inequalities are Range queries. The AND
and OR operators can be provided by usage of Boolean queries.

Have fun implementing the solution - it has only one disadvantage. It
makes results sorting not so easy. The solution for it is usage of
multiple sort fields, or another stored field containing a full date
(one almost surely will need to store a date for each hit, unless You
want to write some baroque code to calculate date from split fields
values).

Have fun,
-- 
Damian Gajda
Caltha Sp. j.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to