You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Alexandre Dupriez (Created) (JIRA)" <ji...@apache.org> on 2011/11/02 19:53:32 UTC
[jira] [Created] (LUCENE-3554) AbstractField / Field / NumericField
override equals and hashcode methods
AbstractField / Field / NumericField override equals and hashcode methods
-------------------------------------------------------------------------
Key: LUCENE-3554
URL: https://issues.apache.org/jira/browse/LUCENE-3554
Project: Lucene - Java
Issue Type: Wish
Components: core/index
Reporter: Alexandre Dupriez
Priority: Minor
Field, NumericField and AbstractField implementations of Fieldable do not override equals and hashcode methods and cannot be compared as such.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[jira] [Commented] (LUCENE-3554) AbstractField / Field /
NumericField override equals and hashcode methods
Posted by "Alexandre Dupriez (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-3554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13142411#comment-13142411 ]
Alexandre Dupriez commented on LUCENE-3554:
-------------------------------------------
Is there any special reason which prevent these classes to override the equals/hashcode methods? If not, would a patch be welcomed?
> AbstractField / Field / NumericField override equals and hashcode methods
> -------------------------------------------------------------------------
>
> Key: LUCENE-3554
> URL: https://issues.apache.org/jira/browse/LUCENE-3554
> Project: Lucene - Java
> Issue Type: Wish
> Components: core/index
> Reporter: Alexandre Dupriez
> Priority: Minor
> Original Estimate: 1h 55m
> Remaining Estimate: 1h 55m
>
> Field, NumericField and AbstractField implementations of Fieldable do not override equals and hashcode methods and cannot be compared as such.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[jira] [Commented] (LUCENE-3554) AbstractField / Field /
NumericField do not override equals and hashcode methods
Posted by "Robert Muir (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-3554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13142413#comment-13142413 ]
Robert Muir commented on LUCENE-3554:
-------------------------------------
How would equals work if you use public Field(String name, TokenStream tokenStream) ?
> AbstractField / Field / NumericField do not override equals and hashcode methods
> --------------------------------------------------------------------------------
>
> Key: LUCENE-3554
> URL: https://issues.apache.org/jira/browse/LUCENE-3554
> Project: Lucene - Java
> Issue Type: Wish
> Components: core/index
> Reporter: Alexandre Dupriez
> Priority: Minor
> Original Estimate: 1h 55m
> Remaining Estimate: 1h 55m
>
> Field, NumericField and AbstractField implementations of Fieldable do not override equals and hashcode methods and cannot be compared as such.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[jira] [Updated] (LUCENE-3554) AbstractField / Field / NumericField
do not override equals and hashcode methods
Posted by "Alexandre Dupriez (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-3554?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alexandre Dupriez updated LUCENE-3554:
--------------------------------------
Summary: AbstractField / Field / NumericField do not override equals and hashcode methods (was: AbstractField / Field / NumericField override equals and hashcode methods)
> AbstractField / Field / NumericField do not override equals and hashcode methods
> --------------------------------------------------------------------------------
>
> Key: LUCENE-3554
> URL: https://issues.apache.org/jira/browse/LUCENE-3554
> Project: Lucene - Java
> Issue Type: Wish
> Components: core/index
> Reporter: Alexandre Dupriez
> Priority: Minor
> Original Estimate: 1h 55m
> Remaining Estimate: 1h 55m
>
> Field, NumericField and AbstractField implementations of Fieldable do not override equals and hashcode methods and cannot be compared as such.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[jira] [Commented] (LUCENE-3554) AbstractField / Field /
NumericField do not override equals and hashcode methods
Posted by "Robert Muir (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-3554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13142582#comment-13142582 ]
Robert Muir commented on LUCENE-3554:
-------------------------------------
The problem is you would have to consume the entire stream (analyze the potentially large document) to compute this...
I think its better to just return Object.equals/hashcode than to have such a costly implementation
> AbstractField / Field / NumericField do not override equals and hashcode methods
> --------------------------------------------------------------------------------
>
> Key: LUCENE-3554
> URL: https://issues.apache.org/jira/browse/LUCENE-3554
> Project: Lucene - Java
> Issue Type: Wish
> Components: core/index
> Reporter: Alexandre Dupriez
> Priority: Minor
> Original Estimate: 1h 55m
> Remaining Estimate: 1h 55m
>
> Field, NumericField and AbstractField implementations of Fieldable do not override equals and hashcode methods and cannot be compared as such.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[jira] [Commented] (LUCENE-3554) AbstractField / Field /
NumericField do not override equals and hashcode methods
Posted by "Alexandre Dupriez (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-3554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13142570#comment-13142570 ]
Alexandre Dupriez commented on LUCENE-3554:
-------------------------------------------
Could the equals method of Field rely on the equals implementation of AttributeSource, which TokenStream inherits from?
> AbstractField / Field / NumericField do not override equals and hashcode methods
> --------------------------------------------------------------------------------
>
> Key: LUCENE-3554
> URL: https://issues.apache.org/jira/browse/LUCENE-3554
> Project: Lucene - Java
> Issue Type: Wish
> Components: core/index
> Reporter: Alexandre Dupriez
> Priority: Minor
> Original Estimate: 1h 55m
> Remaining Estimate: 1h 55m
>
> Field, NumericField and AbstractField implementations of Fieldable do not override equals and hashcode methods and cannot be compared as such.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[jira] [Commented] (LUCENE-3554) AbstractField / Field /
NumericField do not override equals and hashcode methods
Posted by "Robert Muir (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-3554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13143389#comment-13143389 ]
Robert Muir commented on LUCENE-3554:
-------------------------------------
{quote}
...but TokenStream (via AttributeSource) already has equals+hashCode methods that aren't just inherited from Object – are they doing this stream consumption?
{quote}
Only at that 'state' in time. You would have to walk the tokenstreams in parallel, verifying equals() along the way, and ensure # of tokens is the same to verify that two tokenstreams are 'equal'.
{quote}
if they are, that seems like a bug (TokenStream should probably override AttributeSource to use "==" and System.identiyHashCode, right?)
{quote}
No, because it works fine for that stream at that moment in time.
{quote}
That seems like an orthogonal issue to whether AbstractField/Field/NumericField could have useful equals/hashCode methods
{quote}
Not at all, because fields can be set by tokenstreams, equals/hashcode would be broken if we did this.
broken != useful.
> AbstractField / Field / NumericField do not override equals and hashcode methods
> --------------------------------------------------------------------------------
>
> Key: LUCENE-3554
> URL: https://issues.apache.org/jira/browse/LUCENE-3554
> Project: Lucene - Java
> Issue Type: Wish
> Components: core/index
> Reporter: Alexandre Dupriez
> Priority: Minor
> Original Estimate: 1h 55m
> Remaining Estimate: 1h 55m
>
> Field, NumericField and AbstractField implementations of Fieldable do not override equals and hashcode methods and cannot be compared as such.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[jira] [Issue Comment Edited] (LUCENE-3554) AbstractField / Field /
NumericField do not override equals and hashcode methods
Posted by "Alexandre Dupriez (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-3554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13142411#comment-13142411 ]
Alexandre Dupriez edited comment on LUCENE-3554 at 11/2/11 9:33 PM:
--------------------------------------------------------------------
Is there any special reason which prevent these classes to override the equals/hashcode methods? If not, would a patch be welcome?
was (Author: adupriez):
Is there any special reason which prevent these classes to override the equals/hashcode methods? If not, would a patch be welcomed?
> AbstractField / Field / NumericField do not override equals and hashcode methods
> --------------------------------------------------------------------------------
>
> Key: LUCENE-3554
> URL: https://issues.apache.org/jira/browse/LUCENE-3554
> Project: Lucene - Java
> Issue Type: Wish
> Components: core/index
> Reporter: Alexandre Dupriez
> Priority: Minor
> Original Estimate: 1h 55m
> Remaining Estimate: 1h 55m
>
> Field, NumericField and AbstractField implementations of Fieldable do not override equals and hashcode methods and cannot be compared as such.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org
[jira] [Commented] (LUCENE-3554) AbstractField / Field /
NumericField do not override equals and hashcode methods
Posted by "Hoss Man (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LUCENE-3554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13143382#comment-13143382 ]
Hoss Man commented on LUCENE-3554:
----------------------------------
bq. The problem is you would have to consume the entire stream (analyze the potentially large document) to compute this
...but TokenStream (via AttributeSource) already has equals+hashCode methods that aren't just inherited from Object -- are they doing this stream consumption?
if they are, that seems like a bug (TokenStream should probably override AttributeSource to use "==" and System.identiyHashCode, right?)
That seems like an orthogonal issue to whether AbstractField/Field/NumericField could have useful equals/hashCode methods -- it seems like those classes should be able to compose the equals/hashCodes of their parts, and if in some cases one of those parts is a TokenStream (which uses Object.equals) so be it -- but in other cases (ie: NumericField, or other user implemented subclasses of AbstractField) it might be very useful.
> AbstractField / Field / NumericField do not override equals and hashcode methods
> --------------------------------------------------------------------------------
>
> Key: LUCENE-3554
> URL: https://issues.apache.org/jira/browse/LUCENE-3554
> Project: Lucene - Java
> Issue Type: Wish
> Components: core/index
> Reporter: Alexandre Dupriez
> Priority: Minor
> Original Estimate: 1h 55m
> Remaining Estimate: 1h 55m
>
> Field, NumericField and AbstractField implementations of Fieldable do not override equals and hashcode methods and cannot be compared as such.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org