You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Gregory Tarr <Gr...@detica.com> on 2011/04/01 12:30:39 UTC

SpanNearQuery with repeated term?

I am having some issues with SpanNearQuery:

SpanQuery[] clauses = new SpanTermQuery[2];
Clauses[0] = new SpanTermQuery("text","aaaa");
Clauses[1] = new SpanTermQuery("text","bbbb");
SpanNearQuery q = new SpanNearQuery(clauses,0,true); // returns 1
document with "aaaa bbbb" in it

SpanQuery[] clauses = new SpanTermQuery[2];
Clauses[0] = new SpanTermQuery("text","aaaa");
Clauses[1] = new SpanTermQuery("text","aaaa");
SpanNearQuery q = new SpanNearQuery(clauses,0,true); // returns 2
documents ( "aaaa bbbb" and "aaaa aaaa") 

This second bit of code returns the document with "aaaa bbbb" in it,
Why doesn't SpanNearQuery discard that one and only return me the one
I've asked for?

Thanks

Greg

Please consider the environment before printing this email.

This message should be regarded as confidential. If you have received this email in error please notify the sender and destroy it immediately.
Statements of intent shall only become binding when confirmed in hard copy by an authorised signatory.  The contents of this email may relate to dealings with other companies within the Detica Limited group of companies.

Detica Limited is registered in England under No: 1337451.

Registered offices: Surrey Research Park, Guildford, Surrey, GU2 7YP, England.


RE: SpanNearQuery with repeated term?

Posted by Gregory Tarr <Gr...@detica.com>.
Sorry, I have got this working now. It was a silly mistake. 

-----Original Message-----
From: Gregory Tarr [mailto:Gregory.tarr@detica.com] 
Sent: 01 April 2011 12:13
To: java-user@lucene.apache.org
Subject: RE: SpanNearQuery with repeated term?

Sorry I am using 2.9.4, which is the same as 3.0.3?

The code below demonstrates the problem. 

Thanks

Greg

-----Original Message-----
From: Ian Lea [mailto:ian.lea@gmail.com]
Sent: 01 April 2011 12:10
To: java-user@lucene.apache.org
Subject: Re: SpanNearQuery with repeated term?

I can't reproduce this using lucene-core-3.0.3.jar.  You don't say what
version you are using.  Why don't you post the smallest possible
complete standalone program or test case that demonstrates the problem.
And tell us what version of lucene you are working with.
Always.


--
Ian.


On Fri, Apr 1, 2011 at 11:30 AM, Gregory Tarr <Gr...@detica.com>
wrote:
> I am having some issues with SpanNearQuery:
>
> SpanQuery[] clauses = new SpanTermQuery[2]; Clauses[0] = new 
> SpanTermQuery("text","aaaa"); Clauses[1] = new 
> SpanTermQuery("text","bbbb"); SpanNearQuery q = new 
> SpanNearQuery(clauses,0,true); // returns 1 document with "aaaa bbbb"
> in it
>
> SpanQuery[] clauses = new SpanTermQuery[2]; Clauses[0] = new 
> SpanTermQuery("text","aaaa"); Clauses[1] = new 
> SpanTermQuery("text","aaaa"); SpanNearQuery q = new 
> SpanNearQuery(clauses,0,true); // returns 2 documents ( "aaaa bbbb"
> and "aaaa aaaa")
>
> This second bit of code returns the document with "aaaa bbbb" in it, 
> Why doesn't SpanNearQuery discard that one and only return me the one 
> I've asked for?
>
> Thanks
>
> Greg
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org

Please consider the environment before printing this email.

This message should be regarded as confidential. If you have received
this email in error please notify the sender and destroy it immediately.
Statements of intent shall only become binding when confirmed in hard
copy by an authorised signatory.  The contents of this email may relate
to dealings with other companies within the Detica Limited group of
companies.

Detica Limited is registered in England under No: 1337451.

Registered offices: Surrey Research Park, Guildford, Surrey, GU2 7YP,
England.



---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org

Please consider the environment before printing this email.

This message should be regarded as confidential. If you have received this email in error please notify the sender and destroy it immediately.
Statements of intent shall only become binding when confirmed in hard copy by an authorised signatory.  The contents of this email may relate to dealings with other companies within the Detica Limited group of companies.

Detica Limited is registered in England under No: 1337451.

Registered offices: Surrey Research Park, Guildford, Surrey, GU2 7YP, England.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: SpanNearQuery with repeated term?

Posted by Ian Lea <ia...@gmail.com>.
> Sorry I am using 2.9.4, which is the same as 3.0.3?

Not by my definition of "the same".

> The code below demonstrates the problem.

Not really.  I'd be more convinced if it compiled.  And how can we be
sure the docs are exactly as you say?  That you are actually executing
the span queries you have created?  As I'm sure you know, there are
many ways in which a program can fail to work as expected and the
problem isn't always where we think it is.


--
Ian.

> -----Original Message-----
> From: Ian Lea [mailto:ian.lea@gmail.com]
> Sent: 01 April 2011 12:10
> To: java-user@lucene.apache.org
> Subject: Re: SpanNearQuery with repeated term?
>
> I can't reproduce this using lucene-core-3.0.3.jar.  You don't say what
> version you are using.  Why don't you post the smallest possible
> complete standalone program or test case that demonstrates the problem.
> And tell us what version of lucene you are working with.
> Always.
>
>
> --
> Ian.
>
>
> On Fri, Apr 1, 2011 at 11:30 AM, Gregory Tarr <Gr...@detica.com>
> wrote:
>> I am having some issues with SpanNearQuery:
>>
>> SpanQuery[] clauses = new SpanTermQuery[2]; Clauses[0] = new
>> SpanTermQuery("text","aaaa"); Clauses[1] = new
>> SpanTermQuery("text","bbbb"); SpanNearQuery q = new
>> SpanNearQuery(clauses,0,true); // returns 1 document with "aaaa bbbb"
>> in it
>>
>> SpanQuery[] clauses = new SpanTermQuery[2]; Clauses[0] = new
>> SpanTermQuery("text","aaaa"); Clauses[1] = new
>> SpanTermQuery("text","aaaa"); SpanNearQuery q = new
>> SpanNearQuery(clauses,0,true); // returns 2 documents ( "aaaa bbbb"
>> and "aaaa aaaa")
>>
>> This second bit of code returns the document with "aaaa bbbb" in it,
>> Why doesn't SpanNearQuery discard that one and only return me the one
>> I've asked for?
>>
>> Thanks
>>
>> Greg
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
> Please consider the environment before printing this email.
>
> This message should be regarded as confidential. If you have received this email in error please notify the sender and destroy it immediately.
> Statements of intent shall only become binding when confirmed in hard copy by an authorised signatory.  The contents of this email may relate to dealings with other companies within the Detica Limited group of companies.
>
> Detica Limited is registered in England under No: 1337451.
>
> Registered offices: Surrey Research Park, Guildford, Surrey, GU2 7YP, England.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


RE: SpanNearQuery with repeated term?

Posted by Gregory Tarr <Gr...@detica.com>.
Sorry I am using 2.9.4, which is the same as 3.0.3?

The code below demonstrates the problem. 

Thanks

Greg

-----Original Message-----
From: Ian Lea [mailto:ian.lea@gmail.com] 
Sent: 01 April 2011 12:10
To: java-user@lucene.apache.org
Subject: Re: SpanNearQuery with repeated term?

I can't reproduce this using lucene-core-3.0.3.jar.  You don't say what
version you are using.  Why don't you post the smallest possible
complete standalone program or test case that demonstrates the problem.
And tell us what version of lucene you are working with.
Always.


--
Ian.


On Fri, Apr 1, 2011 at 11:30 AM, Gregory Tarr <Gr...@detica.com>
wrote:
> I am having some issues with SpanNearQuery:
>
> SpanQuery[] clauses = new SpanTermQuery[2]; Clauses[0] = new 
> SpanTermQuery("text","aaaa"); Clauses[1] = new 
> SpanTermQuery("text","bbbb"); SpanNearQuery q = new 
> SpanNearQuery(clauses,0,true); // returns 1 document with "aaaa bbbb" 
> in it
>
> SpanQuery[] clauses = new SpanTermQuery[2]; Clauses[0] = new 
> SpanTermQuery("text","aaaa"); Clauses[1] = new 
> SpanTermQuery("text","aaaa"); SpanNearQuery q = new 
> SpanNearQuery(clauses,0,true); // returns 2 documents ( "aaaa bbbb" 
> and "aaaa aaaa")
>
> This second bit of code returns the document with "aaaa bbbb" in it, 
> Why doesn't SpanNearQuery discard that one and only return me the one 
> I've asked for?
>
> Thanks
>
> Greg
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org

Please consider the environment before printing this email.

This message should be regarded as confidential. If you have received this email in error please notify the sender and destroy it immediately.
Statements of intent shall only become binding when confirmed in hard copy by an authorised signatory.  The contents of this email may relate to dealings with other companies within the Detica Limited group of companies.

Detica Limited is registered in England under No: 1337451.

Registered offices: Surrey Research Park, Guildford, Surrey, GU2 7YP, England.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: SpanNearQuery with repeated term?

Posted by Ian Lea <ia...@gmail.com>.
I can't reproduce this using lucene-core-3.0.3.jar.  You don't say
what version you are using.  Why don't you post the smallest possible
complete standalone program or test case that demonstrates the
problem.  And tell us what version of lucene you are working with.
Always.


--
Ian.


On Fri, Apr 1, 2011 at 11:30 AM, Gregory Tarr <Gr...@detica.com> wrote:
> I am having some issues with SpanNearQuery:
>
> SpanQuery[] clauses = new SpanTermQuery[2];
> Clauses[0] = new SpanTermQuery("text","aaaa");
> Clauses[1] = new SpanTermQuery("text","bbbb");
> SpanNearQuery q = new SpanNearQuery(clauses,0,true); // returns 1
> document with "aaaa bbbb" in it
>
> SpanQuery[] clauses = new SpanTermQuery[2];
> Clauses[0] = new SpanTermQuery("text","aaaa");
> Clauses[1] = new SpanTermQuery("text","aaaa");
> SpanNearQuery q = new SpanNearQuery(clauses,0,true); // returns 2
> documents ( "aaaa bbbb" and "aaaa aaaa")
>
> This second bit of code returns the document with "aaaa bbbb" in it,
> Why doesn't SpanNearQuery discard that one and only return me the one
> I've asked for?
>
> Thanks
>
> Greg
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org