You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lucy.apache.org by Saurabh Vasekar <sv...@listenlogic.com> on 2012/06/14 02:17:14 UTC
[lucy-user] How to search through the indexed documents by specifying wildcards
in the query string
Hello,
I want to search through the indexed documents with the following query.
e.g.
"+field1:abc AND -field2:def AND +field3:xyz"
My code looks as below -
my $q = "+field1:abc AND -field3:def AND +field3:xyz";
my $searcher = Lucy::Search::IndexSearcher->new(
index => $path_to_index,
);
my $qparser = Lucy::Search::QueryParser->new(
schema => $searcher->get_schema,
);
my $query = $qparser->parse($q);
my $hits = $searcher->hits(
query => $query,
offset => $offset,
num_wanted => $page_size,
);
I read the info on the link
https://metacpan.org/module/Lucy::Search::QueryParser#___pod
It says that I need to use a method set_heed_colons(). But I am not able to
figure out how many arguments should be provided to the method?
What exactly does set_heed_colon method do?
I supplied argument '3' because my query string contained 3 fields.
Surprisingly my code worked but I don't know how.
Can anybody please throw light on this?
Also where can I find the wildcard characters supported by Lucy query
parser? A lot of wildcard characters have been supported by Lucene.
What do I need to specify in the query string if I need all the documents
present. (e.g. * wildcard character or something like that)
Thank you.
Re: [lucy-user] How to search through the indexed documents by specifying
wildcards in the query string
Posted by Peter Karman <pe...@peknet.com>.
On 6/13/12 7:17 PM, Saurabh Vasekar wrote:
> It says that I need to use a method set_heed_colons(). But I am not able to
> figure out how many arguments should be provided to the method?
> What exactly does set_heed_colon method do?
The method sets a boolean (on/off) so passing any true value turns it
on, passing any false value should turn it off.
With the value set to true, these 2 query strings are treated the same way:
field1=foo
field1:foo
with the value set to false, they are not.
> Also where can I find the wildcard characters supported by Lucy query
> parser? A lot of wildcard characters have been supported by Lucene.
> What do I need to specify in the query string if I need all the documents
> present. (e.g. * wildcard character or something like that)
>
Lucy core does not support wildcards. This extension does:
http://search.cpan.org/dist/LucyX-Search-WildcardQuery/
--
Peter Karman . http://peknet.com/ . peter@peknet.com