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/11/29 11:17:12 UTC

[lucy-user] ClusterSearcher returns zero results if negate operator used

Hi,

I haven't ruled out something stupid on my part yet, but I've found
that a query with a negate operator:

[term1 -term2]

or even

[term1 -gobbledegoek-asdkjhdadakd823asdkb]

when pumping through ClusterSearcher, always returns zero results.  If
using a standard PolySearcher on a local index, then it works as
expected.

Using trunk Revision: 1207196

-- 
Regards,
gk

Re: [lucy-user] ClusterSearcher returns zero results if negate operator used

Posted by Marvin Humphrey <ma...@rectangular.com>.
On Tue, Nov 29, 2011 at 05:17:26PM +0200, goran kent wrote:
> On Tue, Nov 29, 2011 at 3:52 PM, Marvin Humphrey <ma...@rectangular.com> wrote:
> > If the parsed queries differ, that is probably because the Schema being fed to
> > ClusterSearcher's constructor is incomplete or wrong
> 
> aha!  Thanks for that diagnostic approach - it has revealed that
> indeed I am an ape, gnawing at the monolith.

LOL -- while that's an entertaining image, I have to disagree. :)

This error was an API trap that we laid for you.  Had you avoided it, it would
be to your credit, but our design encouraged silent failure.  I don't like
blaming users for our shortcomings as designers.

I was in fact discussing this very problem with my colleague Dan Markham last
night.  We can solve it by serializing schemas and passing them around during
the handshake phase, silently adding valid field definitions and erroring out
noisily if conflicts are detected.

In fact, Dan's efforts to design a configuration-free search system led us to
the insight that there's no need for ClusterSearcher's constructor to require
a Schema at all.

Marvin Humphrey


Re: [lucy-user] ClusterSearcher returns zero results if negate operator used

Posted by goran kent <go...@gmail.com>.
On Tue, Nov 29, 2011 at 3:52 PM, Marvin Humphrey <ma...@rectangular.com> wrote:
> If the parsed queries differ, that is probably because the Schema being fed to
> ClusterSearcher's constructor is incomplete or wrong

aha!  Thanks for that diagnostic approach - it has revealed that
indeed I am an ape, gnawing at the monolith.



-- 
Regards,
gk

Re: [lucy-user] ClusterSearcher returns zero results if negate operator used

Posted by Marvin Humphrey <ma...@rectangular.com>.
On Tue, Nov 29, 2011 at 12:17:12PM +0200, goran kent wrote:
> I haven't ruled out something stupid on my part yet, but I've found
> that a query with a negate operator:
> 
> [term1 -term2]
> 
> or even
> 
> [term1 -gobbledegoek-asdkjhdadakd823asdkb]
> 
> when pumping through ClusterSearcher, always returns zero results.  If
> using a standard PolySearcher on a local index, then it works as
> expected.

Can you please try the following for both ClusterSearcher and PolySearcher?

First, derive a query object from your query string.  If you are using a
QueryParser, it's this...

    my $query = $query_parser->parse("term1 -term2");

... otherwise, it's this:

    my $query = $searcher->glean_query("term1 -term2");

Then let's examine the parsed queries to ensure that they are the same:

    use Data::Dumper;
    warn Dumper($query->dump);

If the parsed queries differ, that is probably because the Schema being fed to
ClusterSearcher's constructor is incomplete or wrong -- for instance, there
may be fields on the remote nodes that ClusterSearcher doesn't know about.
Currently, ClusterSearcher does not enforce schema completeness or
compatibility for its child nodes; that should be added in the future.

If the parsed queries are the same, there is presumably something amiss with
the search logic and we'll need to debug.

Marvin Humphrey