// inherit javadoc public override Document Document(int n, FieldSelector fieldSelector) { EnsureOpen(); int i = ReaderIndex(n); // find segment num return(subReaders[i].Document(n - starts[i], fieldSelector)); // dispatch to segment reader }
private int CopyFieldsNoDeletions(FieldSelector fieldSelectorMerge, FieldsWriter fieldsWriter, IndexReader reader, FieldsReader matchingFieldsReader) { int maxDoc = reader.MaxDoc(); int docCount = 0; if (matchingFieldsReader != null) { // We can bulk-copy because the fieldInfos are "congruent" while (docCount < maxDoc) { int len = System.Math.Min(MAX_RAW_MERGE_DOCS, maxDoc - docCount); IndexInput stream = matchingFieldsReader.RawDocs(rawDocLengths, docCount, len); fieldsWriter.AddRawDocuments(stream, rawDocLengths, len); docCount += len; checkAbort.Work(300 * len); } } else { for (; docCount < maxDoc; docCount++) { // NOTE: it's very important to first assign to doc then pass it to // termVectorsWriter.addAllDocVectors; see LUCENE-1282 Document doc = reader.Document(docCount, fieldSelectorMerge); fieldsWriter.AddDocument(doc); checkAbort.Work(300); } } return(docCount); }
// append fields from storedFieldReaders public override Document Document(int n, FieldSelector fieldSelector) { EnsureOpen(); Document result = new Document(); for (int i = 0; i < storedFieldReaders.Count; i++) { IndexReader reader = (IndexReader)storedFieldReaders[i]; bool include = (fieldSelector == null); if (!include) { System.Collections.IEnumerator it = ((System.Collections.ICollection)readerToFields[reader]).GetEnumerator(); while (it.MoveNext()) { if (fieldSelector.Accept((System.String)it.Current) != FieldSelectorResult.NO_LOAD) { include = true; break; } } } if (include) { System.Collections.IEnumerator fieldIterator = reader.Document(n, fieldSelector).GetFields().GetEnumerator(); while (fieldIterator.MoveNext()) { result.Add((Fieldable)fieldIterator.Current); } } } return(result); }
private int CopyFieldsWithDeletions(FieldSelector fieldSelectorMerge, FieldsWriter fieldsWriter, IndexReader reader, FieldsReader matchingFieldsReader) { int docCount = 0; int maxDoc = reader.MaxDoc(); if (matchingFieldsReader != null) { // We can bulk-copy because the fieldInfos are "congruent" for (int j = 0; j < maxDoc;) { if (reader.IsDeleted(j)) { // skip deleted docs ++j; continue; } // We can optimize this case (doing a bulk byte copy) since the field // numbers are identical int start = j, numDocs = 0; do { j++; numDocs++; if (j >= maxDoc) { break; } if (reader.IsDeleted(j)) { j++; break; } }while (numDocs < MAX_RAW_MERGE_DOCS); IndexInput stream = matchingFieldsReader.RawDocs(rawDocLengths, start, numDocs); fieldsWriter.AddRawDocuments(stream, rawDocLengths, numDocs); docCount += numDocs; checkAbort.Work(300 * numDocs); } } else { for (int j = 0; j < maxDoc; j++) { if (reader.IsDeleted(j)) { // skip deleted docs continue; } // NOTE: it's very important to first assign to doc then pass it to // termVectorsWriter.addAllDocVectors; see LUCENE-1282 Document doc = reader.Document(j, fieldSelectorMerge); fieldsWriter.AddDocument(doc); docCount++; checkAbort.Work(300); } } return(docCount); }
public override Document Doc(int i, FieldSelector fieldSelector) { throw new System.NotSupportedException(); }
// inherit javadoc public override Document Document(int n, FieldSelector fieldSelector) { EnsureOpen(); int i = ReaderIndex(n); // find segment num return subReaders[i].Document(n - starts[i], fieldSelector); // dispatch to segment reader }
// inherit javadoc public override Document Doc(int i, FieldSelector fieldSelector) { return(reader.Document(i, fieldSelector)); }
// append fields from storedFieldReaders public override Document Document(int n, FieldSelector fieldSelector) { EnsureOpen(); Document result = new Document(); for (int i = 0; i < storedFieldReaders.Count; i++) { IndexReader reader = (IndexReader) storedFieldReaders[i]; bool include = (fieldSelector == null); if (!include) { System.Collections.IEnumerator it = ((System.Collections.ICollection) readerToFields[reader]).GetEnumerator(); while (it.MoveNext()) { if (fieldSelector.Accept((System.String) it.Current) != FieldSelectorResult.NO_LOAD) { include = true; break; } } } if (include) { System.Collections.IEnumerator fieldIterator = reader.Document(n, fieldSelector).GetFields().GetEnumerator(); while (fieldIterator.MoveNext()) { result.Add((Fieldable) fieldIterator.Current); } } } return result; }
public override Document Document(int n, FieldSelector fieldSelector) { EnsureOpen(); return GetFieldsReader().Doc(n, fieldSelector); }
/// <summary> Get the {@link Mono.Lucene.Net.Documents.Document} at the <code>n</code> /// <sup>th</sup> position. The {@link FieldSelector} may be used to determine /// what {@link Mono.Lucene.Net.Documents.Field}s to load and how they should /// be loaded. <b>NOTE:</b> If this Reader (more specifically, the underlying /// <code>FieldsReader</code>) is closed before the lazy /// {@link Mono.Lucene.Net.Documents.Field} is loaded an exception may be /// thrown. If you want the value of a lazy /// {@link Mono.Lucene.Net.Documents.Field} to be available after closing you /// must explicitly load it or fetch the Document again with a new loader. /// <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 call {@link #IsDeleted(int)} with the requested document ID to verify /// the document is not deleted. /// /// </summary> /// <param name="n">Get the document at the <code>n</code><sup>th</sup> position /// </param> /// <param name="fieldSelector">The {@link FieldSelector} to use to determine what /// Fields should be loaded on the Document. May be null, in which case /// all Fields will be loaded. /// </param> /// <returns> The stored fields of the /// {@link Mono.Lucene.Net.Documents.Document} at the nth position /// </returns> /// <throws> CorruptIndexException if the index is corrupt </throws> /// <throws> IOException if there is a low-level IO error </throws> /// <seealso cref="Mono.Lucene.Net.Documents.Fieldable"> /// </seealso> /// <seealso cref="Mono.Lucene.Net.Documents.FieldSelector"> /// </seealso> /// <seealso cref="Mono.Lucene.Net.Documents.SetBasedFieldSelector"> /// </seealso> /// <seealso cref="Mono.Lucene.Net.Documents.LoadFirstFieldSelector"> /// </seealso> // TODO (1.5): When we convert to JDK 1.5 make this Set<String> public abstract Document Document(int n, FieldSelector fieldSelector);
public override Document Document(int n, FieldSelector fieldSelector) { EnsureOpen(); return(in_Renamed.Document(n, fieldSelector)); }
private int CopyFieldsNoDeletions(FieldSelector fieldSelectorMerge, FieldsWriter fieldsWriter, IndexReader reader, FieldsReader matchingFieldsReader) { int maxDoc = reader.MaxDoc(); int docCount = 0; if (matchingFieldsReader != null) { // We can bulk-copy because the fieldInfos are "congruent" while (docCount < maxDoc) { int len = System.Math.Min(MAX_RAW_MERGE_DOCS, maxDoc - docCount); IndexInput stream = matchingFieldsReader.RawDocs(rawDocLengths, docCount, len); fieldsWriter.AddRawDocuments(stream, rawDocLengths, len); docCount += len; checkAbort.Work(300 * len); } } else { for (; docCount < maxDoc; docCount++) { // NOTE: it's very important to first assign to doc then pass it to // termVectorsWriter.addAllDocVectors; see LUCENE-1282 Document doc = reader.Document(docCount, fieldSelectorMerge); fieldsWriter.AddDocument(doc); checkAbort.Work(300); } } return docCount; }
private int CopyFieldsWithDeletions(FieldSelector fieldSelectorMerge, FieldsWriter fieldsWriter, IndexReader reader, FieldsReader matchingFieldsReader) { int docCount = 0; int maxDoc = reader.MaxDoc(); if (matchingFieldsReader != null) { // We can bulk-copy because the fieldInfos are "congruent" for (int j = 0; j < maxDoc; ) { if (reader.IsDeleted(j)) { // skip deleted docs ++j; continue; } // We can optimize this case (doing a bulk byte copy) since the field // numbers are identical int start = j, numDocs = 0; do { j++; numDocs++; if (j >= maxDoc) break; if (reader.IsDeleted(j)) { j++; break; } } while (numDocs < MAX_RAW_MERGE_DOCS); IndexInput stream = matchingFieldsReader.RawDocs(rawDocLengths, start, numDocs); fieldsWriter.AddRawDocuments(stream, rawDocLengths, numDocs); docCount += numDocs; checkAbort.Work(300 * numDocs); } } else { for (int j = 0; j < maxDoc; j++) { if (reader.IsDeleted(j)) { // skip deleted docs continue; } // NOTE: it's very important to first assign to doc then pass it to // termVectorsWriter.addAllDocVectors; see LUCENE-1282 Document doc = reader.Document(j, fieldSelectorMerge); fieldsWriter.AddDocument(doc); docCount++; checkAbort.Work(300); } } return docCount; }
// inherit javadoc public override Document Doc(int n, FieldSelector fieldSelector) { int i = SubSearcher(n); // find searcher index return(searchables[i].Doc(n - starts[i], fieldSelector)); // dispatch to searcher }
/* End patch for GCJ bug #15411. */ public abstract Mono.Lucene.Net.Documents.Document Doc(int param1, Mono.Lucene.Net.Documents.FieldSelector param2);
// inherit javadoc public override Document Doc(int i, FieldSelector fieldSelector) { return reader.Document(i, fieldSelector); }
// inherit javadoc public override Document Doc(int n, FieldSelector fieldSelector) { int i = SubSearcher(n); // find searcher index return searchables[i].Doc(n - starts[i], fieldSelector); // dispatch to searcher }
public override Document Document(int n, FieldSelector fieldSelector) { EnsureOpen(); return in_Renamed.Document(n, fieldSelector); }