Hello,
I am using LucyX::Search::ProximityQuery to search through the indexed
documents.
My code looks like below
use strict;
use warnings;
my $path_to_index = '{path_to_index}' #specified correctly
use List::Util qw ( max min );
use POSIX qw ( ceil );
use Encode qw ( decode );
use Lucy::Search::IndexSearcher;
use Lucy::Search::QueryParser;
use Lucy::Search::TermQuery;
use LucyX::Search::ProximityQuery;
binmode STDOUT, ":encoding(UTF-8)";
my $proximity_query = LucyX::Search::ProximityQuery->new(
field => 'content',
terms => [ qw ( jakarta apache ) ],
within => 4,
);
my $offset = "0";
my $page_size = 10000;
my $searcher = Lucy::Search::IndexSearcher->new(
index => $path_to_index,
);
my $qparser = Lucy::Search::QueryParser->new(
schema => $searcher->get_schema,
);
my $hits = $searcher->hits(
query => $proximity_query,
offset => $offset,
num_wanted => $page_size,
);
my $hit_count = $hits->total_hits;
print("Hit Count :$hit_count\n");
#End of code
Although my documents contain contents which have text 'jakarta' and
'apache' I am not getting any results. The interesting thing is that is I
specify the following in my proximity query the search returns appropriate
results.
my $proximity_query = LucyX::Search::ProximityQuery->new(
field => 'content',
terms => [ qw ( in the ) ],
within => 4,
);
Is my implementation correct?
Thank you.