lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: fitler vs query
Date Tue, 21 Feb 2006 19:49:01 GMT

: Hoss, come on, where are you - Filters! ;)

Otis my man, cut me some slack! .. I'm in the Pacific/USA Timezone, I
don't get to work untill 10AM at the earliest, and I'm a little wacked out
from having a really delayed flight last night.

: John, filters are handy for situations where you want to run your query
: multiple times against the same sub-set of your indexed documents.  For
: instance, if you have Documents that span several years, and want to be
: able to search individual years, you create a filter for each year,
: cache it, and run the new query against the appropriate year's filter.

You goad me for not replying fast enough and then you won't even help me
out and throw in my stock line for me? ....

The ability to cache Filters is one of their biggest assets, but even if
performacne isn't a factor at all, the other key reason to use a Filter is
when you just want to limit the results by a set critera, without
affecting the scores.

To extend Otis's example, if you want to limit your results to 1995-1997
something like RangeQuery is acctually going to affect the scores of every
doc in the year 1995 based on how many docs have that date -- when dealing
with dcate/numeric ranges, that typically isn't what you want.  Likewise
when dealing with "filtering by cateory" or "filter by compnay" ... just
because company A has published more books then company b that doesn't
mean when you filter by "company A or B" you wan the books published by
company B to get better scores becuase of how less common that term is --
that's exactly what happens when you do something like...

            "my query +(company:A company:B) +pubyear:[1995 TO 1997]"

: Before I learned about filters in lucene I was building my initial query
: as a stringbuffer and then I use that with a queryparser.    Is there

as a side comment, the only reason to use QueryParser is if you are
parsing a sytirng that coems from outside of your application (ie: user
input, or a config file) ... if you are building up a StringBuffer and
then parsing it again, you are not only wasting cycles, you are creating a
headache foryourself down the road ... progromatically generating
Query Objects yourself is a noble and worthwhile endevor.


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

View raw message