Lucene.Net.Index.IndexReader.Clone C# (CSharp) Méthode

Clone() public méthode

Clones the IndexReader and optionally changes readOnly. A readOnly reader cannot open a writeable reader.
public Clone ( bool openReadOnly ) : IndexReader
openReadOnly bool
Résultat IndexReader
		public virtual IndexReader Clone(bool openReadOnly)
		{
			lock (this)
			{
				throw new System.NotSupportedException("This reader does not implement clone()");
			}
		}
		

Same methods

IndexReader::Clone ( ) : Object

Usage Example

Exemple #1
0
        public virtual void  TestCloneWithSetNorm()
        {
            Directory dir1 = new MockRAMDirectory();

            TestIndexReaderReopen.CreateIndex(dir1, false);
            IndexReader orig = IndexReader.Open(dir1, false);

            orig.SetNorm(1, "field1", 17.0f);
            byte encoded = Similarity.EncodeNorm(17.0f);

            Assert.AreEqual(encoded, orig.Norms("field1")[1]);

            // the cloned segmentreader should have 2 references, 1 to itself, and 1 to
            // the original segmentreader
            IndexReader clonedReader = (IndexReader)orig.Clone();

            orig.Close();
            clonedReader.Close();

            IndexReader r = IndexReader.Open(dir1, false);

            Assert.AreEqual(encoded, r.Norms("field1")[1]);
            r.Close();
            dir1.Close();
        }
All Usage Examples Of Lucene.Net.Index.IndexReader::Clone