incubator-lucy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Logan Bell <loganb...@gmail.com>
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:
http://incubator.apache.org/lucy/docs/perl/Lucy/Search/IndexSearcher.html
http://incubator.apache.org/lucy/docs/perl/Lucy/Docs/Tutorial/BeyondSimple.html

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.

Thanks,
Logan

---------- Forwarded message ----------
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Thu, Mar 8, 2012 at 2:07 AM
Subject: Re: [lucy-user] num_wanted = $infinity?
To: lucy-user@incubator.apache.org



Using $searcher->doc_max should do the trick.

Nick


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.)
>
>

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