Saurabh Vasekar wrote on 6/14/12 7:02 PM: > Hello, > > Apache Lucene supports the Proimity Search queries. e.g. search query > "jakarta apache" ~10 would search for "apache" and "jakarta" within 10 > words of each other in a document. Is the proximity search supported in > Lucy also? If it is not supported do I implement the query parser to > incorporate the proximity search? Also what other wildcard characters are > supported in apache Lucy? I assigned "*" to query string. Ideally it should > retrieve all the contents in the document. But it did not retrieve > anything. How should I assign the "*" to the query string so that it > retrieves the entire content. >
http://search.cpan.org/dist/LucyX-Search-WildcardQuery/ http://search.cpan.org/dist/Lucy/lib/LucyX/Search/ProximityQuery.pod The built-in Lucy QueryParser has no syntax for either of those. One example that does support wildcard and proximity syntax is: http://search.cpan.org/dist/Search-Query-Dialect-Lucy/ So you could do (UNTESTED): my $queryparser = Search::Query->parser( dialect => 'Lucy' ); my $everything_query = $queryparser->parse('?*'); my $proximity_query = $queryparser->parse('"jakarta apache" ~10'); my $lucy_everything_query = $everything_query->as_lucy_query(); my $everything_hits = $lucy_searcher->hits( query => $lucy_everything_query ); my $lucy_proximity_query = $proximity_query->as_lucy_query(); my $proximity_hits = $lucy_searcher->hits( query => $lucy_proximity_query ); -- Peter Karman . http://peknet.com/ . [email protected]
