Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
2.0.0
-
None
-
None
-
JSE 5.0
Description
// Prepare document.
Document document = new Document();
document.add(new Field("name",
"pattern oriented software architecture", Store.NO,
Index.TOKENIZED, TermVector.WITH_POSITIONS_OFFSETS));
// Set max field length to 2.
indexWriter.setMaxFieldLength(2);
// Add document into index.
indexWriter.addDocument(document, new StandardAnalyzer());
// Create a query.
QueryParser queryParser = new QueryParser("name", new StandardAnalyzer());
Query query = queryParser.parse("software");
// Search the 3rd term.
Hits hits = indexSearcher.search(query);
Assert.assertEquals(0, hits.length());
// failed. Actual hits.length() == 1, but expect 0.