FAQ
Hi,

I'm trying to retrieve a document from a Hits object and I'm getting
the following exception and stack trace. I have a Hits object named
"hits" and I'm just trying to retrieve the first document using

Document doc = hits.doc(0);

I can retrieve all other kinds of information for the document using
hits.score(0), hits.id(0), etc but it won't let me retrieve a
document. Any help is greatly appreciated. Thanks.

Mike

java.io.IOException: Bad file descriptor
at java.io.RandomAccessFile.seek(Native Method)
at org.apache.lucene.store.FSIndexInput.readInternal
(FSDirectory.java:444)
at org.apache.lucene.store.BufferedIndexInput.refill
(BufferedIndexInput.java:64)
at org.apache.lucene.store.BufferedIndexInput.readByte
(BufferedIndexInput.java:33)
at org.apache.lucene.store.IndexInput.readInt(IndexInput.java:46)
at org.apache.lucene.store.IndexInput.readLong(IndexInput.java:69)
at org.apache.lucene.index.FieldsReader.doc(FieldsReader.java:62)
at org.apache.lucene.index.SegmentReader.document(SegmentReader.java:
284)
at org.apache.lucene.search.IndexSearcher.doc(IndexSearcher.java:83)
at org.apache.lucene.search.Hits.doc(Hits.java:103)
at
diploma.project.content.AddContentToContext.addContentToContextDocs
(AddContentToContext.java:124)
at diploma.project.content.AddContentToContext.combineIndices
(AddContentToContext.java:67)
at diploma.project.content.AddContentToContext.main
(AddContentToContext.java:42)

Search Discussions

  • Yonik Seeley at Jun 12, 2006 at 8:35 pm
    Hi Michael,

    The Searcher you used to get the Hits needs to remain open while
    accessing the hits. Your stack trace could have been caused by the
    Searcher being closed first.

    -Yonik
    http://incubator.apache.org/solr Solr, the open-source Lucene search server

    On 6/10/06, Michael Dodson wrote:
    Hi,

    I'm trying to retrieve a document from a Hits object and I'm getting
    the following exception and stack trace. I have a Hits object named
    "hits" and I'm just trying to retrieve the first document using

    Document doc = hits.doc(0);

    I can retrieve all other kinds of information for the document using
    hits.score(0), hits.id(0), etc but it won't let me retrieve a
    document. Any help is greatly appreciated. Thanks.

    Mike

    java.io.IOException: Bad file descriptor
    at java.io.RandomAccessFile.seek(Native Method)
    at org.apache.lucene.store.FSIndexInput.readInternal
    (FSDirectory.java:444)
    at org.apache.lucene.store.BufferedIndexInput.refill
    (BufferedIndexInput.java:64)
    at org.apache.lucene.store.BufferedIndexInput.readByte
    (BufferedIndexInput.java:33)
    at org.apache.lucene.store.IndexInput.readInt(IndexInput.java:46)
    at org.apache.lucene.store.IndexInput.readLong(IndexInput.java:69)
    at org.apache.lucene.index.FieldsReader.doc(FieldsReader.java:62)
    at org.apache.lucene.index.SegmentReader.document(SegmentReader.java:
    284)
    at org.apache.lucene.search.IndexSearcher.doc(IndexSearcher.java:83)
    at org.apache.lucene.search.Hits.doc(Hits.java:103)
    at
    diploma.project.content.AddContentToContext.addContentToContextDocs
    (AddContentToContext.java:124)
    at diploma.project.content.AddContentToContext.combineIndices
    (AddContentToContext.java:67)
    at diploma.project.content.AddContentToContext.main
    (AddContentToContext.java:42)
    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedJun 12, '06 at 9:38a
activeJun 12, '06 at 8:35p
posts2
users2
websitelucene.apache.org

2 users in discussion

Yonik Seeley: 1 post Michael Dodson: 1 post

People

Translate

site design / logo © 2022 Grokbase