lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Leangen <>
Subject Re: How can I limit the number of hits in my query?
Date Tue, 15 May 2007 02:07:37 GMT

Thank you very much for this. Some more questions inline...

>         - How can I limit the number of hits? I don't know in
>            advance what the data will be, so it's not feasible for
>            me to use RangeQuery.
> You can use a TopDocs or a HitCollector object which allows you
> to process each object as it's hit. But I doubt you need to do this. 

> No.  I expect you're using a wildcard, and wildcard handling is
> complicated. 

Ok, you're right. It's not the limiting of the results that's the
problem, it's the way the search is expanded.

Since this is an autocomplete, when the user types, for example "a" or a
Japanese character "あ", I am using PrefixFilter for this, so I guess
the search turns into "a*" and "あ*" respectively.

In the archive, the related posts I read either refer to a DateRange
(where it is possible to search first by year, then month... etc.), or
they suggest to increase the max count.

Neither of these solutions work in my case... It's not a date, and I
have no idea of the results in advance and it would not be practical or
elegant to speculate on the results (for example first try aa*~ab* and
see what that gives, etc.).

I can get access to the "weight" values of the terms (a data field
determined by their frequency of use), so I'll try something related to
that. For people with more experience, would that be a good path to

Otherwise, would a reasonable solution be to override or re-implement

Thank you so much!

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

View raw message