lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Chan" <dayz...@gmail.com>
Subject Re: SpanNearQuery .equals()/.hash()
Date Sat, 06 May 2006 17:38:38 GMT
Hi,

I'm using the latest version. Try the following:

				SpanQuery[] clauses1 = {new SpanTermQuery(new Term("contents",
"test1")), new SpanTermQuery(new Term("contents", "test2"))};
				SpanNearQuery nearQ1 = new SpanNearQuery(clauses1, 3, false);

				SpanQuery[] clauses2 = {new SpanTermQuery(new Term("contents",
"test2")), new SpanTermQuery(new Term("contents", "test1"))};
				SpanNearQuery nearQ2 = new SpanNearQuery(clauses2, 3, false);

				System.out.println(nearQ1.equals(nearQ2));

It works if clauses2 = {new SpanTermQuery(new Term("contents",
"test1")), new SpanTermQuery(new Term("contents", "test2"))}. But,
since order doesn't matter here, the two queries should be equal,
right?

Cheers,

Michael


On 5/6/06, Erik Hatcher <erik@ehatchersolutions.com> wrote:
> What version of Lucene are you using?   It should work fine with
> 1.9.  If not, could you supply a test case demonstrating this issue?
>
> Thanks,
>         Erik
>
>
>
> On May 5, 2006, at 10:13 AM, Michael Chan wrote:
>
> > Hi,
> >
> > It seems to me SpanNearQuery.equals()/.hash() are not overriden
> > because I've tried testing two logically equivalent queries but
> > .equals() returns false. Could anyone provide an implementation?
> >
> > Cheers,
> >
> > Michael
> >
> > ---------------------------------------------------------------------
> > 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
>
>

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


Mime
View raw message