lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stephenlindauer <>
Subject No Such Element Exception when getting document
Date Fri, 31 Oct 2008 17:38:56 GMT

I was just thrown into a project working with lucene (which I have never used
before) and using php/java bridge (which I have also only used a little
java) and the guy who wrote what I have so far is no longer here to help so
I'm on my own and really stuck! The search works but when I click on a
document I try to open it and this is the error message I receive...
[[o:Exception]:"java.lang.Exception: Invoke failed: [[o:HitIterator]]->next.
Cause: java.util.NoSuchElementException Responsible VM:
1.6.0_07@" at:


#-8 sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source)


#0 java_ThrowExceptionProxyFactory->getProxy(17,
'org.apache.luce...', true)

#1 java_Arg->getResult(true)

#2 java_Client->getWrappedResult(true)

#3 java_Client->getResult()

#4 java_Client->invokeMethod(16, 'next', Array)

#5 java_JavaProxy->__call('next', Array)

#6 java_AbstractJava->__call('next', Array)

#7 [internal function]: Java->__call('next', Array)

#8 /var/www/getDocument.php(19): java_InternalJava->next()

#9 {main}]

And here is the code that crashes...


try {
        if(isset($_GET['id'])) {
            $searchTerms = explode(" ", $_GET['search']);
            $docId = $_GET['id'];
            $analyzer = new
            $searcher = new
            $phrase = new org_apache_lucene_queryParser_QueryParser("docId",
            $query = $phrase->parse($docId);
            $indexReader = $searcher->getIndexReader();
            $query = $query->rewrite($indexReader);
            $hits = $searcher->search($query);
            $iter = $hits->iterator();
            $hit = $iter->next();            //This is the line that throws
the error!!
            $path = $hit->get("path");
            $fh = fopen($path, "r");

I'm not sure how much of his code he wrote himself or how much is lucene
code so I don't know where to begin. Any help would be greatly
View this message in context:
Sent from the Lucene - Java Developer mailing list archive at

View raw message