You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Adriano Crestani (JIRA)" <ji...@apache.org> on 2010/08/27 01:34:53 UTC

[jira] Created: (LUCENE-2625) IndexReader.termDocs() retrieves no documents

IndexReader.termDocs() retrieves no documents
---------------------------------------------

                 Key: LUCENE-2625
                 URL: https://issues.apache.org/jira/browse/LUCENE-2625
             Project: Lucene - Java
          Issue Type: Bug
          Components: Index
    Affects Versions: 3.1
            Reporter: Adriano Crestani
             Fix For: 3.1


TermDocs object returned by indexReader.termDocs() retrieves no documents, howerver, the documents are retrieved correctly when using indexReader.termDocs(Term), indexReader.termDocs(null) and indexSearcher.search(Query).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (LUCENE-2625) IndexReader.termDocs() retrieves no documents

Posted by "Adriano Crestani (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2625?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adriano Crestani updated LUCENE-2625:
-------------------------------------

    Attachment: TestTermDocs.java

This test case reproduces the problem. It fails using branch_3x rev 989949, but passes fine using lucene 3.0.2

> IndexReader.termDocs() retrieves no documents
> ---------------------------------------------
>
>                 Key: LUCENE-2625
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2625
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 3.1
>            Reporter: Adriano Crestani
>             Fix For: 3.1
>
>         Attachments: TestTermDocs.java
>
>
> TermDocs object returned by indexReader.termDocs() retrieves no documents, howerver, the documents are retrieved correctly when using indexReader.termDocs(Term), indexReader.termDocs(null) and indexSearcher.search(Query).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2625) IndexReader.termDocs() retrieves no documents

Posted by "Adriano Crestani (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2625?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12903211#action_12903211 ] 

Adriano Crestani commented on LUCENE-2625:
------------------------------------------

Hi Shai,

Sorry, but what do you mean by no field:value indexed? NOT_ANALYZED means the term will be indexed as is.

And yes, all assertions pass fine but the last one, which only fails using lucene 3x rev 989949 

> IndexReader.termDocs() retrieves no documents
> ---------------------------------------------
>
>                 Key: LUCENE-2625
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2625
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 3.1
>            Reporter: Adriano Crestani
>             Fix For: 3.1
>
>         Attachments: TestTermDocs.java
>
>
> TermDocs object returned by indexReader.termDocs() retrieves no documents, howerver, the documents are retrieved correctly when using indexReader.termDocs(Term), indexReader.termDocs(null) and indexSearcher.search(Query).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2625) IndexReader.termDocs() retrieves no documents

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2625?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12922494#action_12922494 ] 

Michael McCandless commented on LUCENE-2625:
--------------------------------------------

javadoc patch looks good Robert!

> IndexReader.termDocs() retrieves no documents
> ---------------------------------------------
>
>                 Key: LUCENE-2625
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2625
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 3.1
>            Reporter: Adriano Crestani
>             Fix For: 3.1
>
>         Attachments: LUCENE-2625.patch, TestTermDocs.java
>
>
> TermDocs object returned by indexReader.termDocs() retrieves no documents, howerver, the documents are retrieved correctly when using indexReader.termDocs(Term), indexReader.termDocs(null) and indexSearcher.search(Query).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2625) IndexReader.termDocs() retrieves no documents

Posted by "Shai Erera (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2625?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12903208#action_12903208 ] 

Shai Erera commented on LUCENE-2625:
------------------------------------

You add the field as NOT_ANALYZED, therefore there is no indexed term "field:value". Is the first assert succeeds? I'd assume it should return false.

> IndexReader.termDocs() retrieves no documents
> ---------------------------------------------
>
>                 Key: LUCENE-2625
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2625
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 3.1
>            Reporter: Adriano Crestani
>             Fix For: 3.1
>
>         Attachments: TestTermDocs.java
>
>
> TermDocs object returned by indexReader.termDocs() retrieves no documents, howerver, the documents are retrieved correctly when using indexReader.termDocs(Term), indexReader.termDocs(null) and indexSearcher.search(Query).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Resolved: (LUCENE-2625) IndexReader.termDocs() retrieves no documents

Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2625?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robert Muir resolved LUCENE-2625.
---------------------------------

    Resolution: Fixed

Thanks for bringing this up Adriano!

> IndexReader.termDocs() retrieves no documents
> ---------------------------------------------
>
>                 Key: LUCENE-2625
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2625
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 3.1
>            Reporter: Adriano Crestani
>            Assignee: Robert Muir
>             Fix For: 3.1
>
>         Attachments: LUCENE-2625.patch, TestTermDocs.java
>
>
> TermDocs object returned by indexReader.termDocs() retrieves no documents, howerver, the documents are retrieved correctly when using indexReader.termDocs(Term), indexReader.termDocs(null) and indexSearcher.search(Query).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2625) IndexReader.termDocs() retrieves no documents

Posted by "Adriano Crestani (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2625?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12903221#action_12903221 ] 

Adriano Crestani commented on LUCENE-2625:
------------------------------------------

Just confirmed here, invoking seek does fix the problem :)

> IndexReader.termDocs() retrieves no documents
> ---------------------------------------------
>
>                 Key: LUCENE-2625
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2625
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 3.1
>            Reporter: Adriano Crestani
>             Fix For: 3.1
>
>         Attachments: TestTermDocs.java
>
>
> TermDocs object returned by indexReader.termDocs() retrieves no documents, howerver, the documents are retrieved correctly when using indexReader.termDocs(Term), indexReader.termDocs(null) and indexSearcher.search(Query).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2625) IndexReader.termDocs() retrieves no documents

Posted by "Adriano Crestani (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2625?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12903220#action_12903220 ] 

Adriano Crestani commented on LUCENE-2625:
------------------------------------------

Thanks for the quick reply Shai and Robert.

It makes sense now, but it should be documented somewhere, mainly because the behavior has change from 3.0 to 3.1. Everybody, since version 2, that used to iterate over all documents that way, still expects it to work without calling seek, at least I did.

In my opinion, being unpositioned means the user needs to be aware about docs being retrieved in any order, all that matters after all is to iterate over all documents in the index.

Another question is, if indexReader.termDocs(null) is used, where is it positioned if nothing was defined in the parameter? Shouldn't it work as termDocs()? It just feels inconsistent to me.

> IndexReader.termDocs() retrieves no documents
> ---------------------------------------------
>
>                 Key: LUCENE-2625
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2625
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 3.1
>            Reporter: Adriano Crestani
>             Fix For: 3.1
>
>         Attachments: TestTermDocs.java
>
>
> TermDocs object returned by indexReader.termDocs() retrieves no documents, howerver, the documents are retrieved correctly when using indexReader.termDocs(Term), indexReader.termDocs(null) and indexSearcher.search(Query).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2625) IndexReader.termDocs() retrieves no documents

Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2625?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12903227#action_12903227 ] 

Robert Muir commented on LUCENE-2625:
-------------------------------------

bq. In my opinion, being unpositioned means the user needs to be aware about docs being retrieved in any order, all that matters after all is to iterate over all documents in the index.

termDocs() is unpositioned, implying you will seek() it yourself with Term/TermEnum

bq. Another question is, if indexReader.termDocs(null) is used, where is it positioned if nothing was defined in the parameter? Shouldn't it work as termDocs()? It just feels inconsistent to me.

termDocs(term) is like termDocs() + seek(term), except for the special null case as listed in the docs (If term is null, then all non-deleted docs are returned with freq=1)

i'm inclined to agree termDocs(null) is inconsistent because it doesnt work like termDocs() + seek(null), but instead returns the wacky AllTermsDocs


> IndexReader.termDocs() retrieves no documents
> ---------------------------------------------
>
>                 Key: LUCENE-2625
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2625
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 3.1
>            Reporter: Adriano Crestani
>             Fix For: 3.1
>
>         Attachments: TestTermDocs.java
>
>
> TermDocs object returned by indexReader.termDocs() retrieves no documents, howerver, the documents are retrieved correctly when using indexReader.termDocs(Term), indexReader.termDocs(null) and indexSearcher.search(Query).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (LUCENE-2625) IndexReader.termDocs() retrieves no documents

Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2625?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robert Muir updated LUCENE-2625:
--------------------------------

    Attachment: LUCENE-2625.patch

javadocs patch reminding you to first seek the unpositioned termdocs

> IndexReader.termDocs() retrieves no documents
> ---------------------------------------------
>
>                 Key: LUCENE-2625
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2625
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 3.1
>            Reporter: Adriano Crestani
>             Fix For: 3.1
>
>         Attachments: LUCENE-2625.patch, TestTermDocs.java
>
>
> TermDocs object returned by indexReader.termDocs() retrieves no documents, howerver, the documents are retrieved correctly when using indexReader.termDocs(Term), indexReader.termDocs(null) and indexSearcher.search(Query).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Assigned: (LUCENE-2625) IndexReader.termDocs() retrieves no documents

Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2625?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robert Muir reassigned LUCENE-2625:
-----------------------------------

    Assignee: Robert Muir

> IndexReader.termDocs() retrieves no documents
> ---------------------------------------------
>
>                 Key: LUCENE-2625
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2625
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 3.1
>            Reporter: Adriano Crestani
>            Assignee: Robert Muir
>             Fix For: 3.1
>
>         Attachments: LUCENE-2625.patch, TestTermDocs.java
>
>
> TermDocs object returned by indexReader.termDocs() retrieves no documents, howerver, the documents are retrieved correctly when using indexReader.termDocs(Term), indexReader.termDocs(null) and indexSearcher.search(Query).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2625) IndexReader.termDocs() retrieves no documents

Posted by "Shai Erera (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2625?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12903219#action_12903219 ] 

Shai Erera commented on LUCENE-2625:
------------------------------------

Sorry, I've misread NOT_ANALYZED w/ NO. Too early for me :).

I agree w/ Robert though. Calling termDocs() w/o first positioning it (by seeking) is meaningless. If it returned false/true in 2.9, I don't think it matters?

> IndexReader.termDocs() retrieves no documents
> ---------------------------------------------
>
>                 Key: LUCENE-2625
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2625
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 3.1
>            Reporter: Adriano Crestani
>             Fix For: 3.1
>
>         Attachments: TestTermDocs.java
>
>
> TermDocs object returned by indexReader.termDocs() retrieves no documents, howerver, the documents are retrieved correctly when using indexReader.termDocs(Term), indexReader.termDocs(null) and indexSearcher.search(Query).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2625) IndexReader.termDocs() retrieves no documents

Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2625?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12903210#action_12903210 ] 

Robert Muir commented on LUCENE-2625:
-------------------------------------

Hi, I'm not sure about this one being a bug:

# the test calls termDocs(), which is unpositioned
# the test then calls next(), but it never positions it with seek()

so in my opinion calling next() on an uninitialized iterator can return wrong results, throw an exception, or return nothing at all.


> IndexReader.termDocs() retrieves no documents
> ---------------------------------------------
>
>                 Key: LUCENE-2625
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2625
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 3.1
>            Reporter: Adriano Crestani
>             Fix For: 3.1
>
>         Attachments: TestTermDocs.java
>
>
> TermDocs object returned by indexReader.termDocs() retrieves no documents, howerver, the documents are retrieved correctly when using indexReader.termDocs(Term), indexReader.termDocs(null) and indexSearcher.search(Query).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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