[ 
https://issues.apache.org/jira/browse/LUCENE-5741?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14019879#comment-14019879
 ] 

Zhuravskiy Vitaliy edited comment on LUCENE-5741 at 6/6/14 2:35 PM:
--------------------------------------------------------------------

Hi, Michael, on 4.3.1 bug still present. Same situation on the 4.8.1 
(http://postimg.org/image/zfb2ww6x5/).
I wrote:
"segmentInfos.indexOf(info)
always return -1 because org.apache.lucene.index.SegmentInfos does not have 
equals method"

Please read 
http://docs.oracle.com/javase/7/docs/api/java/util/List.html#indexOf(java.lang.Object)
 , indexOf uses equals method of an object.
On the screenshoot (http://postimg.org/image/jvtezvqnn/) we have two instance 
of org.apache.lucene.index.SegmentInfoPerCommit (SegmentCommitInfo on 4.8.1), 
which has same values, but different for ArrayList, because has not overrided 
equals method (for example like in the SegmentInfo).  Class must have overriden 
equals method, if you you want  ArrayList.indexOf works (ArrayList.indexOf into 
org.apache.lucene.index.SegmentInfos#indexOf)

Screenshoot of debuger on 4.8.1 with 4.3.1 index 
http://postimg.org/image/zfb2ww6x5/

I saw solr-lucene-core sources there uses hashmap instead list, and works. But 
in current source code class SegmentCommitInfo need to be equals method. 



was (Author: zhuravskiy.vs):
Hi, Michael, on 4.3.1 bug still present. Same situation on the 4.8.1 
(http://postimg.org/image/zfb2ww6x5/).
I wrote:
"segmentInfos.indexOf(info)
always return -1 because org.apache.lucene.index.SegmentInfos does not have 
equals method"

Please read 
http://docs.oracle.com/javase/7/docs/api/java/util/List.html#indexOf(java.lang.Object)
 , indexOf uses equals method of an object.
On the screenshoot (http://postimg.org/image/jvtezvqnn/) we have two instance 
of org.apache.lucene.index.SegmentInfoPerCommit (SegmentCommitInfo on 4.8.1), 
which has same values, but different for ArrayList, because has not overrided 
equals method (for example like in the SegmentInfo).  Class must have overriden 
equals method, if you you want  ArrayList.indexOf works (ArrayList.indexOf into 
org.apache.lucene.index.SegmentInfos#indexOf)

Screenshoot of debuger on 4.8.1 with 4.3.1 index 
http://postimg.org/image/zfb2ww6x5/


> IndexWriter.tryDeleteDocument does not work
> -------------------------------------------
>
>                 Key: LUCENE-5741
>                 URL: https://issues.apache.org/jira/browse/LUCENE-5741
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: core/index
>    Affects Versions: 4.3, 4.5, 4.6, 4.7, 4.8, 4.8.1
>            Reporter: Zhuravskiy Vitaliy
>            Assignee: Michael McCandless
>            Priority: Critical
>
> I am using "fresh"a and opened reader. 
> One segement and 3 documents in index.
> tryDeleteDocument always return false, i deep into your code, and see follow, 
> that 
> segmentInfos.indexOf(info)
> always return -1 because org.apache.lucene.index.SegmentInfoPerCommit doesnot 
> have equals method, see screenshoot for more inforamtion 
> http://postimg.org/image/jvtezvqnn/



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to