Java 类org.apache.lucene.document.DocumentStoredFieldVisitor 实例源码
项目:spimedb
文件:Search.java
/**
* return false if canceled via the predicate
*/
public boolean forEachLocalDoc(BiPredicate<Document, ScoreDoc> each) {
if (localDocs == null)
return true;
final DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor();
IndexReader reader = searcher.getIndexReader();
Document d = visitor.getDocument();
boolean result = true;
for (ScoreDoc x : localDocs.scoreDocs) {
d.clear();
try {
reader.document(x.doc, visitor);
if (!each.test(d, x)) {
result = false;
break;
}
} catch (IOException e) {
Search.logger.error("{}", e.getMessage());
}
}
close();
return result;
}
项目:basekb-search
文件:FreebaseSearcher.java
public String getSubjectPredicateValue(String subjectURI, String predName) throws IOException {
// Return the value of predicate `predName' on `subjectURI'. If there are muliple values,
// return the first one indexed, if there are none, return null.
// This is specialized to only retrieve the `predName' field of the subject document.
// If the full document has already been retrieved, use the Document accessor instead.
int subjectId = getSubjectDocID(subjectURI);
if (subjectId < 0)
return null;
else {
DocumentStoredFieldVisitor fieldVisitor = new DocumentStoredFieldVisitor(predName);
getIndexReader().document(subjectId, fieldVisitor);
Document subject = fieldVisitor.getDocument();
return getSubjectPredicateValue(subject, predName);
}
}
项目:basekb-search
文件:FreebaseSearcher.java
public String[] getSubjectPredicateValues(String subjectURI, String predName) throws IOException {
// Return the values of predicate `predName' on `subjectURI'.
// If there are none, return an empty array.
// This is specialized to only retrieve the `predName' field of the subject document.
// If the full document has already been retrieved, use the Document accessor instead.
int subjectId = getSubjectDocID(subjectURI);
if (subjectId < 0)
return emptyValues;
else {
DocumentStoredFieldVisitor fieldVisitor = new DocumentStoredFieldVisitor(predName);
getIndexReader().document(subjectId, fieldVisitor);
Document subject = fieldVisitor.getDocument();
return getSubjectPredicateValues(subject, predName);
}
}
项目:search
文件:SearchTravRetLoadFieldSelectorTask.java
@Override
protected Document retrieveDoc(IndexReader ir, int id) throws IOException {
if (fieldsToLoad == null) {
return ir.document(id);
} else {
DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor(fieldsToLoad);
ir.document(id, visitor);
return visitor.getDocument();
}
}
项目:search
文件:TestFieldsReader.java
public void test() throws IOException {
assertTrue(dir != null);
assertTrue(fieldInfos != null);
IndexReader reader = DirectoryReader.open(dir);
Document doc = reader.document(0);
assertTrue(doc != null);
assertTrue(doc.getField(DocHelper.TEXT_FIELD_1_KEY) != null);
Field field = (Field) doc.getField(DocHelper.TEXT_FIELD_2_KEY);
assertTrue(field != null);
assertTrue(field.fieldType().storeTermVectors());
assertFalse(field.fieldType().omitNorms());
assertTrue(field.fieldType().indexOptions() == IndexOptions.DOCS_AND_FREQS_AND_POSITIONS);
field = (Field) doc.getField(DocHelper.TEXT_FIELD_3_KEY);
assertTrue(field != null);
assertFalse(field.fieldType().storeTermVectors());
assertTrue(field.fieldType().omitNorms());
assertTrue(field.fieldType().indexOptions() == IndexOptions.DOCS_AND_FREQS_AND_POSITIONS);
field = (Field) doc.getField(DocHelper.NO_TF_KEY);
assertTrue(field != null);
assertFalse(field.fieldType().storeTermVectors());
assertFalse(field.fieldType().omitNorms());
assertTrue(field.fieldType().indexOptions() == IndexOptions.DOCS_ONLY);
DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor(DocHelper.TEXT_FIELD_3_KEY);
reader.document(0, visitor);
final List<IndexableField> fields = visitor.getDocument().getFields();
assertEquals(1, fields.size());
assertEquals(DocHelper.TEXT_FIELD_3_KEY, fields.get(0).name());
reader.close();
}
项目:perecoder
文件:FilterDocumentServiceTemplate.java
/**
* Выполняет поиск коллекции сущностей по подготовленному запросу
*
* @param referenceManager сервис поиска
* @param query запрос поиска
* @param sort сортировка
* @param filter фильтр сущностей
* @param offset смещение относительно начала объектов
* @param count количество запрашиваемых объектов
* @return Возвращает коллекцию сущностей, удовлетворящих критериям поиска
*/
private Collection<E> doQuery(
final ReferenceManager<IndexSearcher> referenceManager,
final Query query,
final Sort sort,
final Filter filter,
final Integer offset,
final Integer count) {
try {
return LuceneQueryUtil.query(binderTransformer, new LuceneQueryCallback() {
@Override
public ReferenceManager<IndexSearcher> getSearcherManager() {
return referenceManager;
}
@Override
public LuceneQueryDescriptor getQueryDescriptor() {
return new LuceneQueryDescriptor(query, sort, filter, offset, count);
}
@Override
public DocumentStoredFieldVisitor createStoredFieldVisitor() {
return new DocumentStoredFieldVisitor();
}
});
} catch (Throwable ex) {
throw new RuntimeException(String.format("Can't execute query '%s' on '%s' index. Cause by: %s", query, retrieveTargetClassName(), ex.getMessage()), ex);
}
}
项目:perecoder
文件:FieldService.java
@Override
public boolean isFieldsUnique(String metaFieldId) {
// Проверяем, что поля существуют
final LuceneCriteriaHolder criteria = criteriaBuilder.createCriteria(
retrieveTargetClass(),
createCriteriaByIDs(Field.META_FIELD_ID, metaFieldId).injectSort(Field.VALUE, SortOrder.ASCENDING)
);
final int totalCount = queryProvider.executeCountByCriteria(criteria);
if (totalCount <= 0) {
return true;
}
// Выполняем итерирование значений полей пока не дойдем до конца или не встретим дублирующегося значения
UniqueFieldHandler uniqueFieldHandler = new UniqueFieldHandler();
try {
LuceneQueryUtil.query(
binderTransformer,
new LuceneQueryCallback() {
@Override
public ReferenceManager<IndexSearcher> getSearcherManager() {
return refreshSearcherManager(false);
}
@Override
public LuceneQueryDescriptor getQueryDescriptor() {
return new LuceneQueryDescriptor(criteria.buildQuery(), criteria.buildSort(), criteria.buildFilter(), 0, totalCount);
}
@Override
public DocumentStoredFieldVisitor createStoredFieldVisitor() {
return new DocumentStoredFieldVisitor();
}
},
uniqueFieldHandler
);
return uniqueFieldHandler.isUnique();
} catch (IOException ex) {
throw new RuntimeException(String.format("Can't find unique fields '%s' index. Cause by: %s", retrieveTargetClassName(), ex.getMessage()), ex);
}
}
项目:NYBC
文件:SearchTravRetLoadFieldSelectorTask.java
@Override
protected Document retrieveDoc(IndexReader ir, int id) throws IOException {
if (fieldsToLoad == null) {
return ir.document(id);
} else {
DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor(fieldsToLoad);
ir.document(id, visitor);
return visitor.getDocument();
}
}
项目:NYBC
文件:TestFieldsReader.java
public void test() throws IOException {
assertTrue(dir != null);
assertTrue(fieldInfos != null);
IndexReader reader = DirectoryReader.open(dir);
Document doc = reader.document(0);
assertTrue(doc != null);
assertTrue(doc.getField(DocHelper.TEXT_FIELD_1_KEY) != null);
Field field = (Field) doc.getField(DocHelper.TEXT_FIELD_2_KEY);
assertTrue(field != null);
assertTrue(field.fieldType().storeTermVectors());
assertFalse(field.fieldType().omitNorms());
assertTrue(field.fieldType().indexOptions() == IndexOptions.DOCS_AND_FREQS_AND_POSITIONS);
field = (Field) doc.getField(DocHelper.TEXT_FIELD_3_KEY);
assertTrue(field != null);
assertFalse(field.fieldType().storeTermVectors());
assertTrue(field.fieldType().omitNorms());
assertTrue(field.fieldType().indexOptions() == IndexOptions.DOCS_AND_FREQS_AND_POSITIONS);
field = (Field) doc.getField(DocHelper.NO_TF_KEY);
assertTrue(field != null);
assertFalse(field.fieldType().storeTermVectors());
assertFalse(field.fieldType().omitNorms());
assertTrue(field.fieldType().indexOptions() == IndexOptions.DOCS_ONLY);
DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor(DocHelper.TEXT_FIELD_3_KEY);
reader.document(0, visitor);
final List<IndexableField> fields = visitor.getDocument().getFields();
assertEquals(1, fields.size());
assertEquals(DocHelper.TEXT_FIELD_3_KEY, fields.get(0).name());
reader.close();
}
项目:incubator-blur
文件:GenericRecordReader.java
private void fetchBlurRecord() throws IOException {
DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor();
_fieldsReader.visitDocument(_docId, visitor);
BlurRecord blurRecord = new BlurRecord();
String rowId = RowDocumentUtil.readRecord(visitor.getDocument(), blurRecord);
blurRecord.setRowId(rowId);
_rowId = new Text(rowId);
_tableBlurRecord = new TableBlurRecord(_table, blurRecord);
}
项目:read-open-source-code
文件:SearchTravRetLoadFieldSelectorTask.java
@Override
protected Document retrieveDoc(IndexReader ir, int id) throws IOException {
if (fieldsToLoad == null) {
return ir.document(id);
} else {
DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor(fieldsToLoad);
ir.document(id, visitor);
return visitor.getDocument();
}
}
项目:read-open-source-code
文件:SearchTravRetLoadFieldSelectorTask.java
@Override
protected Document retrieveDoc(IndexReader ir, int id) throws IOException {
if (fieldsToLoad == null) {
return ir.document(id);
} else {
DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor(fieldsToLoad);
ir.document(id, visitor);
return visitor.getDocument();
}
}
项目:Maskana-Gestor-de-Conocimiento
文件:SearchTravRetLoadFieldSelectorTask.java
@Override
protected Document retrieveDoc(IndexReader ir, int id) throws IOException {
if (fieldsToLoad == null) {
return ir.document(id);
} else {
DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor(fieldsToLoad);
ir.document(id, visitor);
return visitor.getDocument();
}
}
项目:Maskana-Gestor-de-Conocimiento
文件:TestFieldsReader.java
public void test() throws IOException {
assertTrue(dir != null);
assertTrue(fieldInfos != null);
IndexReader reader = DirectoryReader.open(dir);
Document doc = reader.document(0);
assertTrue(doc != null);
assertTrue(doc.getField(DocHelper.TEXT_FIELD_1_KEY) != null);
Field field = (Field) doc.getField(DocHelper.TEXT_FIELD_2_KEY);
assertTrue(field != null);
assertTrue(field.fieldType().storeTermVectors());
assertFalse(field.fieldType().omitNorms());
assertTrue(field.fieldType().indexOptions() == IndexOptions.DOCS_AND_FREQS_AND_POSITIONS);
field = (Field) doc.getField(DocHelper.TEXT_FIELD_3_KEY);
assertTrue(field != null);
assertFalse(field.fieldType().storeTermVectors());
assertTrue(field.fieldType().omitNorms());
assertTrue(field.fieldType().indexOptions() == IndexOptions.DOCS_AND_FREQS_AND_POSITIONS);
field = (Field) doc.getField(DocHelper.NO_TF_KEY);
assertTrue(field != null);
assertFalse(field.fieldType().storeTermVectors());
assertFalse(field.fieldType().omitNorms());
assertTrue(field.fieldType().indexOptions() == IndexOptions.DOCS_ONLY);
DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor(DocHelper.TEXT_FIELD_3_KEY);
reader.document(0, visitor);
final List<IndexableField> fields = visitor.getDocument().getFields();
assertEquals(1, fields.size());
assertEquals(DocHelper.TEXT_FIELD_3_KEY, fields.get(0).name());
reader.close();
}
项目:lams
文件:IndexReader.java
/**
* Like {@link #document(int)} but only loads the specified
* fields. Note that this is simply sugar for {@link
* DocumentStoredFieldVisitor#DocumentStoredFieldVisitor(Set)}.
*/
public final Document document(int docID, Set<String> fieldsToLoad) throws IOException {
final DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor(fieldsToLoad);
document(docID, visitor);
return visitor.getDocument();
}
项目:search
文件:IndexReader.java
/**
* Like {@link #document(int)} but only loads the specified
* fields. Note that this is simply sugar for {@link
* DocumentStoredFieldVisitor#DocumentStoredFieldVisitor(Set)}.
*/
public final Document document(int docID, Set<String> fieldsToLoad) throws IOException {
final DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor(fieldsToLoad);
document(docID, visitor);
return visitor.getDocument();
}
项目:search
文件:TopGroupsResultTransformer.java
private Document retrieveDocument(final SchemaField uniqueField, int doc) throws IOException {
DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor(uniqueField.getName());
rb.req.getSearcher().doc(doc, visitor);
return visitor.getDocument();
}
项目:NYBC
文件:IndexReader.java
/**
* Like {@link #document(int)} but only loads the specified
* fields. Note that this is simply sugar for {@link
* DocumentStoredFieldVisitor#DocumentStoredFieldVisitor(Set)}.
*/
public final Document document(int docID, Set<String> fieldsToLoad) throws IOException {
final DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor(fieldsToLoad);
document(docID, visitor);
return visitor.getDocument();
}
项目:NYBC
文件:TopGroupsResultTransformer.java
private Document retrieveDocument(final SchemaField uniqueField, int doc) throws IOException {
DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor(uniqueField.getName());
rb.req.getSearcher().doc(doc, visitor);
return visitor.getDocument();
}
项目:search-core
文件:TopGroupsResultTransformer.java
private Document retrieveDocument(final SchemaField uniqueField, int doc) throws IOException {
DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor(uniqueField.getName());
rb.req.getSearcher().doc(doc, visitor);
return visitor.getDocument();
}
项目:read-open-source-code
文件:IndexReader.java
/**
* Like {@link #document(int)} but only loads the specified
* fields. Note that this is simply sugar for {@link
* DocumentStoredFieldVisitor#DocumentStoredFieldVisitor(Set)}.
*/
public final Document document(int docID, Set<String> fieldsToLoad) throws IOException {
final DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor(fieldsToLoad);
document(docID, visitor);
return visitor.getDocument();
}
项目:read-open-source-code
文件:TopGroupsResultTransformer.java
private Document retrieveDocument(final SchemaField uniqueField, int doc) throws IOException {
DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor(uniqueField.getName());
rb.req.getSearcher().doc(doc, visitor);
return visitor.getDocument();
}
项目:read-open-source-code
文件:IndexReader.java
/**
* Like {@link #document(int)} but only loads the specified
* fields. Note that this is simply sugar for {@link
* DocumentStoredFieldVisitor#DocumentStoredFieldVisitor(Set)}.
*/
public final Document document(int docID, Set<String> fieldsToLoad) throws IOException {
final DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor(fieldsToLoad);
document(docID, visitor);
return visitor.getDocument();
}
项目:read-open-source-code
文件:IndexReader.java
/**
* Like {@link #document(int)} but only loads the specified
* fields. Note that this is simply sugar for {@link
* DocumentStoredFieldVisitor#DocumentStoredFieldVisitor(Set)}.
*/
public final Document document(int docID, Set<String> fieldsToLoad) throws IOException {
final DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor(fieldsToLoad);
document(docID, visitor);
return visitor.getDocument();
}
项目:read-open-source-code
文件:TopGroupsResultTransformer.java
private Document retrieveDocument(final SchemaField uniqueField, int doc) throws IOException {
DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor(uniqueField.getName());
rb.req.getSearcher().doc(doc, visitor);
return visitor.getDocument();
}
项目:Maskana-Gestor-de-Conocimiento
文件:IndexReader.java
/**
* Like {@link #document(int)} but only loads the specified
* fields. Note that this is simply sugar for {@link
* DocumentStoredFieldVisitor#DocumentStoredFieldVisitor(Set)}.
*/
public final Document document(int docID, Set<String> fieldsToLoad) throws IOException {
final DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor(fieldsToLoad);
document(docID, visitor);
return visitor.getDocument();
}
项目:lams
文件:IndexReader.java
/**
* Returns the stored fields of the <code>n</code><sup>th</sup>
* <code>Document</code> in this index. This is just
* sugar for using {@link DocumentStoredFieldVisitor}.
* <p>
* <b>NOTE:</b> for performance reasons, this method does not check if the
* requested document is deleted, and therefore asking for a deleted document
* may yield unspecified results. Usually this is not required, however you
* can test if the doc is deleted by checking the {@link
* Bits} returned from {@link MultiFields#getLiveDocs}.
*
* <b>NOTE:</b> only the content of a field is returned,
* if that field was stored during indexing. Metadata
* like boost, omitNorm, IndexOptions, tokenized, etc.,
* are not preserved.
*
* @throws IOException if there is a low-level IO error
*/
// TODO: we need a separate StoredField, so that the
// Document returned here contains that class not
// IndexableField
public final Document document(int docID) throws IOException {
final DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor();
document(docID, visitor);
return visitor.getDocument();
}
项目:search
文件:IndexReader.java
/**
* Returns the stored fields of the <code>n</code><sup>th</sup>
* <code>Document</code> in this index. This is just
* sugar for using {@link DocumentStoredFieldVisitor}.
* <p>
* <b>NOTE:</b> for performance reasons, this method does not check if the
* requested document is deleted, and therefore asking for a deleted document
* may yield unspecified results. Usually this is not required, however you
* can test if the doc is deleted by checking the {@link
* Bits} returned from {@link MultiFields#getLiveDocs}.
*
* <b>NOTE:</b> only the content of a field is returned,
* if that field was stored during indexing. Metadata
* like boost, omitNorm, IndexOptions, tokenized, etc.,
* are not preserved.
*
* @throws IOException if there is a low-level IO error
*/
// TODO: we need a separate StoredField, so that the
// Document returned here contains that class not
// IndexableField
public final Document document(int docID) throws IOException {
final DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor();
document(docID, visitor);
return visitor.getDocument();
}
项目:NYBC
文件:IndexReader.java
/**
* Returns the stored fields of the <code>n</code><sup>th</sup>
* <code>Document</code> in this index. This is just
* sugar for using {@link DocumentStoredFieldVisitor}.
* <p>
* <b>NOTE:</b> for performance reasons, this method does not check if the
* requested document is deleted, and therefore asking for a deleted document
* may yield unspecified results. Usually this is not required, however you
* can test if the doc is deleted by checking the {@link
* Bits} returned from {@link MultiFields#getLiveDocs}.
*
* <b>NOTE:</b> only the content of a field is returned,
* if that field was stored during indexing. Metadata
* like boost, omitNorm, IndexOptions, tokenized, etc.,
* are not preserved.
*
* @throws IOException if there is a low-level IO error
*/
// TODO: we need a separate StoredField, so that the
// Document returned here contains that class not
// IndexableField
public final Document document(int docID) throws IOException {
final DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor();
document(docID, visitor);
return visitor.getDocument();
}
项目:read-open-source-code
文件:IndexReader.java
/**
* Returns the stored fields of the <code>n</code><sup>th</sup>
* <code>Document</code> in this index. This is just
* sugar for using {@link DocumentStoredFieldVisitor}.
* <p>
* <b>NOTE:</b> for performance reasons, this method does not check if the
* requested document is deleted, and therefore asking for a deleted document
* may yield unspecified results. Usually this is not required, however you
* can test if the doc is deleted by checking the {@link
* Bits} returned from {@link MultiFields#getLiveDocs}.
*
* <b>NOTE:</b> only the content of a field is returned,
* if that field was stored during indexing. Metadata
* like boost, omitNorm, IndexOptions, tokenized, etc.,
* are not preserved.
*
* @throws IOException if there is a low-level IO error
*/
// TODO: we need a separate StoredField, so that the
// Document returned here contains that class not
// IndexableField
public final Document document(int docID) throws IOException {
final DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor();
document(docID, visitor);
return visitor.getDocument();
}
项目:read-open-source-code
文件:IndexReader.java
/**
* Returns the stored fields of the <code>n</code><sup>th</sup>
* <code>Document</code> in this index. This is just
* sugar for using {@link DocumentStoredFieldVisitor}.
* <p>
* <b>NOTE:</b> for performance reasons, this method does not check if the
* requested document is deleted, and therefore asking for a deleted document
* may yield unspecified results. Usually this is not required, however you
* can test if the doc is deleted by checking the {@link
* Bits} returned from {@link MultiFields#getLiveDocs}.
*
* <b>NOTE:</b> only the content of a field is returned,
* if that field was stored during indexing. Metadata
* like boost, omitNorm, IndexOptions, tokenized, etc.,
* are not preserved.
*
* @throws IOException if there is a low-level IO error
*/
// TODO: we need a separate StoredField, so that the
// Document returned here contains that class not
// IndexableField
public final Document document(int docID) throws IOException {
final DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor();
document(docID, visitor);
return visitor.getDocument();
}
项目:read-open-source-code
文件:IndexReader.java
/**
* Returns the stored fields of the <code>n</code><sup>th</sup>
* <code>Document</code> in this index. This is just
* sugar for using {@link DocumentStoredFieldVisitor}.
* <p>
* <b>NOTE:</b> for performance reasons, this method does not check if the
* requested document is deleted, and therefore asking for a deleted document
* may yield unspecified results. Usually this is not required, however you
* can test if the doc is deleted by checking the {@link
* Bits} returned from {@link MultiFields#getLiveDocs}.
*
* <b>NOTE:</b> only the content of a field is returned,
* if that field was stored during indexing. Metadata
* like boost, omitNorm, IndexOptions, tokenized, etc.,
* are not preserved.
*
* @throws IOException if there is a low-level IO error
*/
// TODO: we need a separate StoredField, so that the
// Document returned here contains that class not
// IndexableField
public final Document document(int docID) throws IOException {
final DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor();
document(docID, visitor);
return visitor.getDocument();
}
项目:Maskana-Gestor-de-Conocimiento
文件:IndexReader.java
/**
* Returns the stored fields of the <code>n</code><sup>th</sup>
* <code>Document</code> in this index. This is just
* sugar for using {@link DocumentStoredFieldVisitor}.
* <p>
* <b>NOTE:</b> for performance reasons, this method does not check if the
* requested document is deleted, and therefore asking for a deleted document
* may yield unspecified results. Usually this is not required, however you
* can test if the doc is deleted by checking the {@link
* Bits} returned from {@link MultiFields#getLiveDocs}.
*
* <b>NOTE:</b> only the content of a field is returned,
* if that field was stored during indexing. Metadata
* like boost, omitNorm, IndexOptions, tokenized, etc.,
* are not preserved.
*
* @throws IOException if there is a low-level IO error
*/
// TODO: we need a separate StoredField, so that the
// Document returned here contains that class not
// IndexableField
public final Document document(int docID) throws IOException {
final DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor();
document(docID, visitor);
return visitor.getDocument();
}