lucy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Logan Bell <>
Subject [lucy-dev] Fwd: [lucy-user] num_wanted = $infinity?
Date Fri, 23 Mar 2012 18:48:14 GMT
Would anyone be opposed if I fleshed out the documentation around the
following links to explain a couple patterns that his e-mail chain reminded
me of when I first started Lucy?

The documents in question are:

It's not clear how to obtain all documents associated with a query and that
the num_wanted value defaulted to 10. I would like to give an example of
how one might get all results and also update the IndexSearcher
documentation to mention that num_wanted is defaulted to 10 (with an offset
of 0). I think this is outlined with the Lucy::Simple documentation, but
some people don't bother looking at Lucy::Simple and just go directly to
using the various Lucy objects.

I think by Nick's suggestion the way to get all documents would be
something like the following ( feel free to correct me ):

my $doc_count = $searcher->doc_max;
my $hits = $searcher->hits(    # returns a Hits object, not a hit count
    query      => 'foo',
    num_wanted => $doc_count,

Open to other comments/suggestions as well.


---------- Forwarded message ----------
From: Nick Wellnhofer <>
Date: Thu, Mar 8, 2012 at 2:07 AM
Subject: Re: [lucy-user] num_wanted = $infinity?

Using $searcher->doc_max should do the trick.


On 08/03/2012 04:08, Jason McIntosh wrote:

> Howdy,
> Is there a way to tell the searcher that I want to see *all* hits from a
> query at once, unbounded by neither offset nor num_wanted parameters?
> Unless I'm misreading things, if you don't define num_wanted at all, it
> defaults to 10 anyway.
> Yes, this desire is borne of a stopgap measure until I throw proper
> results-paging into my project. But, I'm still curious. (For the nonce I've
> just set num_wanted to a large number.)

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