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 Sariny <sa...@gmail.com> on 2010/12/10 15:34:06 UTC

maybe I hit a bug of Term ?

 
		Hi, two different Term get the same hashCode,  lucene version 3.0.2

		System.out.println(new Term("manu_id",NumericUtils.intToPrefixCoded(111)).hashCode());
        System.out.println(new Term("manu_id",NumericUtils.intToPrefixCoded(402)).hashCode());

        a bug?


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


RE: maybe I hit a bug of Term ?

Posted by Uwe Schindler <uw...@thetaphi.de>.
Hashcodes are not guaranteed to be different. See Object#hashCode()
javadocs.

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de

> -----Original Message-----
> From: Sariny [mailto:sariny@gmail.com]
> Sent: Friday, December 10, 2010 3:34 PM
> To: java-user
> Subject: maybe I hit a bug of Term ?
> 
> 
> 		Hi, two different Term get the same hashCode,  lucene
> version 3.0.2
> 
> 		System.out.println(new
> Term("manu_id",NumericUtils.intToPrefixCoded(111)).hashCode());
>         System.out.println(new
> Term("manu_id",NumericUtils.intToPrefixCoded(402)).hashCode());
> 
>         a bug?
> 
> 
> ---------------------------------------------------------------------
> 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: RE: maybe I hit a bug of Term ?

Posted by Ian Lea <ia...@gmail.com>.
1.  Please post new questions in a new thread.

2.  Try a less specific search, maybe "lucene TREC".


--
Ian.


On Sat, Dec 11, 2010 at 11:25 AM, Duy DINH <di...@gmail.com> wrote:
> Hi Lucene community,
> This is not a novel question but I tried to search on Google the query:
>
> "how to index TREC collection with Lucene"
>
> I found nothing about that except some of your answers about the papers
> using Lucene for indexing TREC collection,
> and I think that I have to write code for indexing TREC collection. But
> before doing that, I would like to know if you have done that, if so, could
> you share or integrate this module into Lucene, please.
>
> Thank you very much,
> Duy
>
> On Fri, Dec 10, 2010 at 7:04 PM, Tom Hill <so...@worldware.com> wrote:
>
>> Hi Sariny,
>>
>> What Uwe was saying is that the definition for hashCode is found in
>> the docs for Object, and it applies to all implementations of
>> hashCode.
>>
>> It says:
>>
>> "It is not required that if two objects are unequal according to the
>> equals(java.lang.Object) method, then calling the hashCode method on
>> each of the two objects must produce distinct integer results.
>> However, the programmer should be aware that producing distinct
>> integer results for unequal objects may improve the performance of
>> hashtables."
>>
>> The implementation of Maps, etc., understand this, and use it
>> appropriately. So, if you write your own Map implementation, you may
>> have to care about this, but in the general case, you can just use any
>> Collection and it will work.
>>
>> Tom
>>
>>
>>
>> 2010/12/10 Sariny <sa...@gmail.com>:
>> > Object.hashCode() is "implemented by converting the internal address of
>> the object into an integer",
>> >
>> > Term.hashCode() has override the default implemention,so,this question
>> has nothing todo with Object.hashCode().
>> >
>> > I think I should try another way to cache filter results...
>> >
>> >
>> >
>> >>Hashcodes are not guaranteed to be different. See Object#hashCode()
>> >>javadocs.
>> >>
>> >>-----
>> >>Uwe Schindler
>> >>H.-H.-Meier-Allee 63, D-28213 Bremen
>> >>http://www.thetaphi.de
>> >>eMail: uwe@thetaphi.de
>> >>
>> >>> -----Original Message-----
>> >>> From: Sariny [mailto:sariny@gmail.com]
>> >>> Sent: Friday, December 10, 2010 3:34 PM
>> >>> To: java-user
>> >>> Subject: maybe I hit a bug of Term ?
>> >>>
>> >>>
>> >>>              Hi, two different Term get the same hashCode,  lucene
>> >>> version 3.0.2
>> >>>
>> >>>              System.out.println(new
>> >>> Term("manu_id",NumericUtils.intToPrefixCoded(111)).hashCode());
>> >>>         System.out.println(new
>> >>> Term("manu_id",NumericUtils.intToPrefixCoded(402)).hashCode());
>> >>>
>> >>>         a bug?
>> >>>
>> >>>
>> >>> ---------------------------------------------------------------------
>> >>> 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
>> >>
>> >
>> > = = = = = = = = = = = = = = = = = = = =
>> >
>> >
>> > Hashcodes are not guaranteed to be different. See Object#hashCode()
>> > javadocs.
>> >
>> > -----
>> > Uwe Schindler
>> > H.-H.-Meier-Allee 63, D-28213 Bremen
>> > http://www.thetaphi.de
>> > eMail: uwe@thetaphi.de
>> >
>> >> -----Original Message-----
>> >> From: Sariny [mailto:sariny@gmail.com]
>> >> Sent: Friday, December 10, 2010 3:34 PM
>> >> To: java-user
>> >> Subject: maybe I hit a bug of Term ?
>> >>
>> >>
>> >>               Hi, two different Term get the same hashCode,  lucene
>> >> version 3.0.2
>> >>
>> >>               System.out.println(new
>> >> Term("manu_id",NumericUtils.intToPrefixCoded(111)).hashCode());
>> >>         System.out.println(new
>> >> Term("manu_id",NumericUtils.intToPrefixCoded(402)).hashCode());
>> >>
>> >>         a bug?
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> 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
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>>
>
>
> --
> University: Paul Sabatier - Toulouse III
> Laboratory: Institute for Research in Informatics of Toulouse
> Office: (+33)5 61 55 74 40
> Mobile: (+33)6 37 500 222
> Email: dinhbaduy@gmail.com
> Website: http://www.irit.fr/~Duy.Dinh/
>

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


Re: RE: maybe I hit a bug of Term ?

Posted by Duy DINH <di...@gmail.com>.
Hi Lucene community,
This is not a novel question but I tried to search on Google the query:

"how to index TREC collection with Lucene"

I found nothing about that except some of your answers about the papers
using Lucene for indexing TREC collection,
and I think that I have to write code for indexing TREC collection. But
before doing that, I would like to know if you have done that, if so, could
you share or integrate this module into Lucene, please.

Thank you very much,
Duy

On Fri, Dec 10, 2010 at 7:04 PM, Tom Hill <so...@worldware.com> wrote:

> Hi Sariny,
>
> What Uwe was saying is that the definition for hashCode is found in
> the docs for Object, and it applies to all implementations of
> hashCode.
>
> It says:
>
> "It is not required that if two objects are unequal according to the
> equals(java.lang.Object) method, then calling the hashCode method on
> each of the two objects must produce distinct integer results.
> However, the programmer should be aware that producing distinct
> integer results for unequal objects may improve the performance of
> hashtables."
>
> The implementation of Maps, etc., understand this, and use it
> appropriately. So, if you write your own Map implementation, you may
> have to care about this, but in the general case, you can just use any
> Collection and it will work.
>
> Tom
>
>
>
> 2010/12/10 Sariny <sa...@gmail.com>:
> > Object.hashCode() is "implemented by converting the internal address of
> the object into an integer",
> >
> > Term.hashCode() has override the default implemention,so,this question
> has nothing todo with Object.hashCode().
> >
> > I think I should try another way to cache filter results...
> >
> >
> >
> >>Hashcodes are not guaranteed to be different. See Object#hashCode()
> >>javadocs.
> >>
> >>-----
> >>Uwe Schindler
> >>H.-H.-Meier-Allee 63, D-28213 Bremen
> >>http://www.thetaphi.de
> >>eMail: uwe@thetaphi.de
> >>
> >>> -----Original Message-----
> >>> From: Sariny [mailto:sariny@gmail.com]
> >>> Sent: Friday, December 10, 2010 3:34 PM
> >>> To: java-user
> >>> Subject: maybe I hit a bug of Term ?
> >>>
> >>>
> >>>              Hi, two different Term get the same hashCode,  lucene
> >>> version 3.0.2
> >>>
> >>>              System.out.println(new
> >>> Term("manu_id",NumericUtils.intToPrefixCoded(111)).hashCode());
> >>>         System.out.println(new
> >>> Term("manu_id",NumericUtils.intToPrefixCoded(402)).hashCode());
> >>>
> >>>         a bug?
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>> 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
> >>
> >
> > = = = = = = = = = = = = = = = = = = = =
> >
> >
> > Hashcodes are not guaranteed to be different. See Object#hashCode()
> > javadocs.
> >
> > -----
> > Uwe Schindler
> > H.-H.-Meier-Allee 63, D-28213 Bremen
> > http://www.thetaphi.de
> > eMail: uwe@thetaphi.de
> >
> >> -----Original Message-----
> >> From: Sariny [mailto:sariny@gmail.com]
> >> Sent: Friday, December 10, 2010 3:34 PM
> >> To: java-user
> >> Subject: maybe I hit a bug of Term ?
> >>
> >>
> >>               Hi, two different Term get the same hashCode,  lucene
> >> version 3.0.2
> >>
> >>               System.out.println(new
> >> Term("manu_id",NumericUtils.intToPrefixCoded(111)).hashCode());
> >>         System.out.println(new
> >> Term("manu_id",NumericUtils.intToPrefixCoded(402)).hashCode());
> >>
> >>         a bug?
> >>
> >>
> >> ---------------------------------------------------------------------
> >> 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
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>


-- 
University: Paul Sabatier - Toulouse III
Laboratory: Institute for Research in Informatics of Toulouse
Office: (+33)5 61 55 74 40
Mobile: (+33)6 37 500 222
Email: dinhbaduy@gmail.com
Website: http://www.irit.fr/~Duy.Dinh/

Re: RE: maybe I hit a bug of Term ?

Posted by Tom Hill <so...@worldware.com>.
Hi Sariny,

What Uwe was saying is that the definition for hashCode is found in
the docs for Object, and it applies to all implementations of
hashCode.

It says:

"It is not required that if two objects are unequal according to the
equals(java.lang.Object) method, then calling the hashCode method on
each of the two objects must produce distinct integer results.
However, the programmer should be aware that producing distinct
integer results for unequal objects may improve the performance of
hashtables."

The implementation of Maps, etc., understand this, and use it
appropriately. So, if you write your own Map implementation, you may
have to care about this, but in the general case, you can just use any
Collection and it will work.

Tom



2010/12/10 Sariny <sa...@gmail.com>:
> Object.hashCode() is "implemented by converting the internal address of the object into an integer",
>
> Term.hashCode() has override the default implemention,so,this question has nothing todo with Object.hashCode().
>
> I think I should try another way to cache filter results...
>
>
>
>>Hashcodes are not guaranteed to be different. See Object#hashCode()
>>javadocs.
>>
>>-----
>>Uwe Schindler
>>H.-H.-Meier-Allee 63, D-28213 Bremen
>>http://www.thetaphi.de
>>eMail: uwe@thetaphi.de
>>
>>> -----Original Message-----
>>> From: Sariny [mailto:sariny@gmail.com]
>>> Sent: Friday, December 10, 2010 3:34 PM
>>> To: java-user
>>> Subject: maybe I hit a bug of Term ?
>>>
>>>
>>>              Hi, two different Term get the same hashCode,  lucene
>>> version 3.0.2
>>>
>>>              System.out.println(new
>>> Term("manu_id",NumericUtils.intToPrefixCoded(111)).hashCode());
>>>         System.out.println(new
>>> Term("manu_id",NumericUtils.intToPrefixCoded(402)).hashCode());
>>>
>>>         a bug?
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>
> = = = = = = = = = = = = = = = = = = = =
>
>
> Hashcodes are not guaranteed to be different. See Object#hashCode()
> javadocs.
>
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: uwe@thetaphi.de
>
>> -----Original Message-----
>> From: Sariny [mailto:sariny@gmail.com]
>> Sent: Friday, December 10, 2010 3:34 PM
>> To: java-user
>> Subject: maybe I hit a bug of Term ?
>>
>>
>>               Hi, two different Term get the same hashCode,  lucene
>> version 3.0.2
>>
>>               System.out.println(new
>> Term("manu_id",NumericUtils.intToPrefixCoded(111)).hashCode());
>>         System.out.println(new
>> Term("manu_id",NumericUtils.intToPrefixCoded(402)).hashCode());
>>
>>         a bug?
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>

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


Re: RE: maybe I hit a bug of Term ?

Posted by Sariny <sa...@gmail.com>.
Object.hashCode() is "implemented by converting the internal address of the object into an integer",

Term.hashCode() has override the default implemention,so,this question has nothing todo with Object.hashCode().
	
I think I should try another way to cache filter results...



>Hashcodes are not guaranteed to be different. See Object#hashCode()
>javadocs.
>
>-----
>Uwe Schindler
>H.-H.-Meier-Allee 63, D-28213 Bremen
>http://www.thetaphi.de
>eMail: uwe@thetaphi.de
>
>> -----Original Message-----
>> From: Sariny [mailto:sariny@gmail.com]
>> Sent: Friday, December 10, 2010 3:34 PM
>> To: java-user
>> Subject: maybe I hit a bug of Term ?
>> 
>> 
>> 		Hi, two different Term get the same hashCode,  lucene
>> version 3.0.2
>> 
>> 		System.out.println(new
>> Term("manu_id",NumericUtils.intToPrefixCoded(111)).hashCode());
>>         System.out.println(new
>> Term("manu_id",NumericUtils.intToPrefixCoded(402)).hashCode());
>> 
>>         a bug?
>> 
>> 
>> ---------------------------------------------------------------------
>> 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
>

= = = = = = = = = = = = = = = = = = = =


Hashcodes are not guaranteed to be different. See Object#hashCode()
javadocs.

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de

> -----Original Message-----
> From: Sariny [mailto:sariny@gmail.com]
> Sent: Friday, December 10, 2010 3:34 PM
> To: java-user
> Subject: maybe I hit a bug of Term ?
> 
> 
> 		Hi, two different Term get the same hashCode,  lucene
> version 3.0.2
> 
> 		System.out.println(new
> Term("manu_id",NumericUtils.intToPrefixCoded(111)).hashCode());
>         System.out.println(new
> Term("manu_id",NumericUtils.intToPrefixCoded(402)).hashCode());
> 
>         a bug?
> 
> 
> ---------------------------------------------------------------------
> 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