// append fields from storedFieldReaders public override Document Document(int n, FieldSelector fieldSelector, IState state) { EnsureOpen(); Document result = new Document(); foreach (IndexReader reader in storedFieldReaders) { bool include = (fieldSelector == null); if (!include) { var fields = readerToFields[reader]; foreach (var field in fields) { if (fieldSelector.Accept(field) != FieldSelectorResult.NO_LOAD) { include = true; break; } } } if (include) { var fields = reader.Document(n, fieldSelector, state).GetFields(); foreach (var field in fields) { result.Add(field); } } } return(result); }
// 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 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); }
/// <summary>Returns the stored fields of the n<sup>th</sup> document in this set. /// <p>Documents are cached, so that repeated requests for the same element may /// return the same Document object. If the fieldselector is changed, then the new /// fields will not be loaded. /// </summary> public Document Doc(int n, FieldSelector fieldSelector) { HitDoc hitDoc = HitDoc(n); // Update LRU cache of documents Remove(hitDoc); // remove from list, if there AddToFront(hitDoc); // add to front of list if (numDocs > maxDocs) { // if cache is full HitDoc oldLast = last; Remove(last); // flush last oldLast.doc = null; // let doc get gc'd } if (hitDoc.doc == null) { if (fieldSelector == null) { hitDoc.doc = searcher.Doc(hitDoc.id); // cache miss: read document } else { hitDoc.doc = searcher.Doc(hitDoc.id, fieldSelector); // cache miss: read document } } return(hitDoc.doc); }
// 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 = storedFieldReaders[i]; bool include = (fieldSelector == null); if (!include) { foreach (string x in readerToFields[reader]) { if (fieldSelector.Accept(x) != FieldSelectorResult.NO_LOAD) { include = true; break; } } } if (include) { foreach (Fieldable f in reader.Document(n, fieldSelector).GetFields()) { result.Add(f); } } } return(result); }
// 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 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 Document(int n, FieldSelector fieldSelector) { lock (this) { if (IsDeleted(n)) { throw new System.ArgumentException("attempt to access a deleted document"); } return(fieldsReader.Doc(n, fieldSelector)); } }
// inherit javadoc public override Document Doc(int i, FieldSelector fieldSelector) { return reader.Document(i, fieldSelector); }
public override Document Doc(int n, FieldSelector fieldSelector) { throw new System.NotSupportedException(Lucene.Net.Search.JustCompileSearch.UNSUPPORTED_MSG); }
/// <summary> Get the {@link Lucene.Net.Documents.Document} at the <code>n</code> /// <sup>th</sup> position. The {@link FieldSelector} may be used to determine /// what {@link 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 Lucene.Net.Documents.Field} is loaded an exception may be /// thrown. If you want the value of a lazy /// {@link 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 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="Lucene.Net.Documents.Fieldable"> /// </seealso> /// <seealso cref="Lucene.Net.Documents.FieldSelector"> /// </seealso> /// <seealso cref="Lucene.Net.Documents.SetBasedFieldSelector"> /// </seealso> /// <seealso cref="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 Doc(int i, FieldSelector fieldSelector) { throw new System.NotSupportedException(); }
/// <summary>Returns the stored fields of the n<sup>th</sup> document in this set. /// <p>Documents are cached, so that repeated requests for the same element may /// return the same Document object. If the fieldselector is changed, then the new /// fields will not be loaded. /// </summary> public Document Doc(int n, FieldSelector fieldSelector) { HitDoc hitDoc = HitDoc(n); // Update LRU cache of documents Remove(hitDoc); // remove from list, if there AddToFront(hitDoc); // add to front of list if (numDocs > maxDocs) { // if cache is full HitDoc oldLast = last; Remove(last); // flush last oldLast.doc = null; // let doc get gc'd } if (hitDoc.doc == null) { if (fieldSelector == null) hitDoc.doc = searcher.Doc(hitDoc.id); // cache miss: read document else hitDoc.doc = searcher.Doc(hitDoc.id, fieldSelector); // cache miss: read document } return hitDoc.doc; }
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 virtual Document Doc(int i, FieldSelector fieldSelector) { return local.Doc(i, fieldSelector); }
// inherit javadoc public override Document Doc(int i, FieldSelector fieldSelector, IState state) { return(reader.Document(i, fieldSelector, state)); }
// 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, IState state) { int i = SubSearcher(n); // find searcher index return(searchables[i].Doc(n - starts[i], fieldSelector, state)); // dispatch to searcher }
abstract public Document Doc(int i, FieldSelector fieldSelector);
/* End patch for GCJ bug #15411. */ public abstract Lucene.Net.Documents.Document Doc(int param1, Lucene.Net.Documents.FieldSelector param2);
// 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; }
public virtual Document Doc(int i, FieldSelector fieldSelector) { return(local.Doc(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; }
// 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 = storedFieldReaders[i]; bool include = (fieldSelector == null); if (!include) { foreach (string x in readerToFields[reader]) { if (fieldSelector.Accept(x) != FieldSelectorResult.NO_LOAD) { include = true; break; } } } if (include) { foreach(Fieldable f in reader.Document(n, fieldSelector).GetFields()) { result.Add(f); } } } return result; }
// 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 }
/// <summary> Get the {@link Lucene.Net.Documents.Document} at the <code>n</code><sup>th</sup> position. The {@link Lucene.Net.Documents.FieldSelector} /// may be used to determine what {@link 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 Lucene.Net.Documents.Field} is /// loaded an exception may be thrown. If you want the value of a lazy {@link Lucene.Net.Documents.Field} to be available after closing you must /// explicitly load it or fetch the Document again with a new loader. /// /// /// </summary> /// <param name="n">Get the document at the <code>n</code><sup>th</sup> position /// </param> /// <param name="fieldSelector">The {@link Lucene.Net.Documents.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 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> /// <summary> /// </summary> /// <seealso cref="Lucene.Net.Documents.Fieldable"> /// </seealso> /// <seealso cref="Lucene.Net.Documents.FieldSelector"> /// </seealso> /// <seealso cref="Lucene.Net.Documents.SetBasedFieldSelector"> /// </seealso> /// <seealso cref="Lucene.Net.Documents.LoadFirstFieldSelector"> /// </seealso> //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)); }
public override Document Doc(int n, FieldSelector fieldSelector) { throw new System.NotSupportedException(); }
public override Document Doc(int n, FieldSelector fieldSelector, IState state) { throw new System.NotSupportedException(Lucene.Net.Search.JustCompileSearch.UNSUPPORTED_MSG); }
// append fields from storedFieldReaders public override Document Document(int n, FieldSelector fieldSelector) { EnsureOpen(); Document result = new Document(); foreach(IndexReader reader in storedFieldReaders) { bool include = (fieldSelector == null); if (!include) { var fields = readerToFields[reader]; foreach(var field in fields) { if (fieldSelector.Accept(field) != FieldSelectorResult.NO_LOAD) { include = true; break; } } } if (include) { var fields = reader.Document(n, fieldSelector).GetFields(); foreach(var field in fields) { result.Add(field); } } } return result; }
public override Document Document(int n, FieldSelector fieldSelector) { lock (this) { if (IsDeleted(n)) throw new System.ArgumentException("attempt to access a deleted document"); return fieldsReader.Doc(n, fieldSelector); } }
public override Document Document(int n, FieldSelector fieldSelector) { EnsureOpen(); return GetFieldsReader().Doc(n, fieldSelector); }
public override Document Document(int n, FieldSelector fieldSelector) { EnsureOpen(); return in_Renamed.Document(n, fieldSelector); }
abstract public Document Doc(int i, FieldSelector fieldSelector);