Lucene(thread) quits quietly when print hits with String.format()
doc.add(new Field("sentence", line, Field.Store.YES, Field.Index.NOT_ANALYZED, Field.TermVector.NO));
doc.add(new Field("sentence-lc", line.toLowerCase(), Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.NO));
Now I want to query the index with the same analyzer like this:
Query query = parser.parse("+sentence-lc:\"" + QueryParser.escape(subjectLabel) + "\" && +sentence-lc:\"" + QueryParser.escape(objectLabel) + "\"");
开发者_开发问答ScoreDocs[] hits = indexSearcher.search(query, null, MAX_NUMBER_OF_DOCUMENTS).scoreDocs;
This works fine, but if I want to print out the number of found documents like this:
System.out.println(String.format("subject: '%s' and object: '%' returned %s index hits!", subjectLabel, objectLabel, hits.length));
the thread in which the index search runs gets killed/finished without any message/exception. Is this my mistake, java's or lucene's?
Kind regards,
Daniel
精彩评论