lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <erickerick...@gmail.com>
Subject Re: search with Filter
Date Mon, 15 Sep 2008 15:30:50 GMT
Filters aren't really specified per field. All they are is a bitmask, one
bit per *document*. You can construct the filter any way you want, in your
case by inspecting the date-time field and passing it along with your query.
You can even combine several fields into one filter by twiddling the bits
as appropriate.

At least that's the general case. In your case, don't you just want a
RangeFilter?
>From the API:

*RangeFilter<file:///C:/lucene-2.1.0/docs/api/org/apache/lucene/search/RangeFilter.html#RangeFilter%28java.lang.String,%20java.lang.String,%20java.lang.String,%20boolean,%20boolean%29>
*(String <http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html>
fieldName,
String <http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html> lowerTerm,
String <http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html> upperTerm,
boolean includeLower, boolean includeUpper)

One other thing: Do you really need seconds? How about minutes? The
coarser your resolution, the better your performance. See also DateTools.

Best
Erick

On Mon, Sep 15, 2008 at 11:17 AM, Dino Korah <dckorah@gmail.com> wrote:

> Hi All,
>
> I am trying to utilize Filter to see if I can get a bit more performance
> out
> of my application that searches over 100million document lucene index.
>
> On all my documents I have a two fields over which I will have to scope my
> searches. One is a date-time field (YYYYMMDDHHMMSS) and a user-id filed
> (number). How do I specify filter for a field. I feel that I can use
> BooleanFilter + RangeFilter (for date-time) + TermFilter (user-id).
>
> I couldnt figure out how to specify a Filter per field.
>
> Could someone point me in the right direction.
>
> Many thanks,
> Dino
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message