Lucene.Net.Index.IndexReader.SetNorm C# (CSharp) Method

SetNorm() public method

Expert: Resets the normalization factor for the named field of the named document. The norm represents the product of the field's boost and its length normalization. Thus, to preserve the length normalization values when resetting this, one should base the new value upon the old. NOTE: If this field does not store norms, then this method call will silently do nothing. since this reader was opened has this index open (write.lock could not be obtained)
public SetNorm ( int doc, String field, byte value ) : void
doc int
field String
value byte
return void
		public virtual void  SetNorm(int doc, String field, byte value)
		{
			lock (this)
			{
				EnsureOpen();
				AcquireWriteLock();
				hasChanges = true;
				DoSetNorm(doc, field, value);
			}
		}
		

Same methods

IndexReader::SetNorm ( int doc, System field, float value ) : void

Usage Example

Esempio n. 1
0
        public virtual void  TestIsCurrent()
        {
            Directory      dir1 = GetDir1();
            Directory      dir2 = GetDir2();
            ParallelReader pr   = new ParallelReader();

            pr.Add(IndexReader.Open(dir1));
            pr.Add(IndexReader.Open(dir2));

            Assert.IsTrue(pr.IsCurrent());
            IndexReader modifier = IndexReader.Open(dir1);

            modifier.SetNorm(0, "f1", 100);
            modifier.Close();

            // one of the two IndexReaders which ParallelReader is using
            // is not current anymore
            Assert.IsFalse(pr.IsCurrent());

            modifier = IndexReader.Open(dir2);
            modifier.SetNorm(0, "f3", 100);
            modifier.Close();

            // now both are not current anymore
            Assert.IsFalse(pr.IsCurrent());
        }
All Usage Examples Of Lucene.Net.Index.IndexReader::SetNorm