You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lucy.apache.org by goran kent <go...@gmail.com> on 2011/10/22 18:53:40 UTC

[lucy-user] field:term searching

Hi,

I'm getting confusing results from searching for field:term - eg, if I
have a spec'd field "title" which is indexed, and I want to search
using title:bob, I would expect it to restrict searching in that
field.

I'm not getting *any* hits on this kind of search - I had a look in
the docs but nothing jumps out at me:  is there something special that
must be done to achieve this?

Thanks

Re: [lucy-user] field:term searching

Posted by goran kent <go...@gmail.com>.
On Sun, Oct 23, 2011 at 3:13 AM, Peter Karman <pe...@peknet.com> wrote:
>> How on earth do I get to QueryParser's methods from here?
>
> parse $query with a QueryParser first, then pass the returned Query object to
> $poly_searcher.

Thanks!  That works perfectly and consistently.

Re: [lucy-user] field:term searching

Posted by Peter Karman <pe...@peknet.com>.
goran kent wrote on 10/22/11 3:58 PM:

> my $hits = $poly_searcher->hits(
>    query      => $query,     # $query is the query string itself
>    sort_spec  => $sort_spec,
>    offset     => 0,
>    num_wanted => 10,
> );
> 
> How on earth do I get to QueryParser's methods from here?

parse $query with a QueryParser first, then pass the returned Query object to
$poly_searcher.


-- 
Peter Karman  .  http://peknet.com/  .  peter@peknet.com

Re: [lucy-user] field:term searching

Posted by goran kent <go...@gmail.com>.
On Sat, Oct 22, 2011 at 9:35 PM, Peter Karman <pe...@peknet.com> wrote:
> without seeing your code, it's hard to say. but have you set_heed_colons() ?
>
> http://search.cpan.org/~creamyg/Lucy-0.2.1/lib/Lucy/Search/QueryParser.pod#set_heed_colons%28heed_colons%29

[resending to list after my reply-to-peter-only]

Thanks for the quick response, Peter.  Your suggestion sounds like the
solution, but I have no idea how to access that little nugget.  I'm
using PolySearcher:

...
my $poly_searcher = Lucy::Search::PolySearcher->new(
   schema    => $schema,
   searchers => \@searcher,
);

my $sort_spec =
 Lucy::Search::SortSpec->new( rules =>
     [ Lucy::Search::SortRule->new( field => ...

my $hits = $poly_searcher->hits(
   query      => $query,     # $query is the query string itself
   sort_spec  => $sort_spec,
   offset     => 0,
   num_wanted => 10,
);

How on earth do I get to QueryParser's methods from here?

Any pointers would be appreciated.

Re: [lucy-user] field:term searching

Posted by Peter Karman <pe...@peknet.com>.
goran kent wrote on 10/22/11 11:53 AM:
> Hi,
> 
> I'm getting confusing results from searching for field:term - eg, if I
> have a spec'd field "title" which is indexed, and I want to search
> using title:bob, I would expect it to restrict searching in that
> field.
> 
> I'm not getting *any* hits on this kind of search - I had a look in
> the docs but nothing jumps out at me:  is there something special that
> must be done to achieve this?
> 

without seeing your code, it's hard to say. but have you set_heed_colons() ?

http://search.cpan.org/~creamyg/Lucy-0.2.1/lib/Lucy/Search/QueryParser.pod#set_heed_colons%28heed_colons%29




-- 
Peter Karman  .  http://peknet.com/  .  peter@peknet.com