lucy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anil Pachuri <anilpach...@yahoo.com>
Subject Re: [lucy-user] document IDs
Date Wed, 25 Sep 2013 19:50:31 GMT
Hi Peter,


When I run the program below for different queries, it gives me different values for $hit_count
and number of elements in the array @doc_ids .  @doc_ids always shows 10 elements even for
different queries, while  $hit_count value changes with query. May be I am missing something.
Thanks, Anil


my $searcher = Lucy::Search::IndexSearcher->new( 
index => $path_to_index,
);

my $qparser = Lucy::Search::QueryParser->new( 
schema => $searcher->get_schema,
default_boolop => 'OR',
);

my $query = $qparser->parse('query');

my $hits = $searcher->hits(
query => $query,
);

my $hit_count = $hits->total_hits;
print "$hit_count\n";

my @doc_ids;
while ( my $hit_doc = $hits->next ) {
push @doc_ids, $hit_doc->get_doc_id();
}

print "@doc_ids\n";





________________________________
 From: Peter Karman <peter@peknet.com>
To: user@lucy.apache.org 
Sent: Tuesday, September 24, 2013 1:02 PM
Subject: Re: [lucy-user] document IDs
 

On 9/24/13 12:44 PM, Anil Pachuri wrote:

> # something like:
> my $docIDs = $hits->doc_ids;
>

my @doc_ids;

while ( my $hit_doc = $hits->next ) {
    push @doc_ids, $hit_doc->get_doc_id();
}

https://metacpan.org/module/Lucy::Document::Doc

-- Peter Karman  .  http://peknet.com/  .  peter@peknet.com
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message