You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by cc...@apache.org on 2012/03/12 23:29:37 UTC
svn commit: r1299911 [4/14] - in /incubator/lucene.net/trunk: src/core/
src/core/Analysis/ src/core/Analysis/Standard/
src/core/Analysis/Tokenattributes/ src/core/Document/ src/core/Index/
src/core/Messages/ src/core/QueryParser/ src/core/Search/ src/c...
Modified: incubator/lucene.net/trunk/src/core/Index/LogByteSizeMergePolicy.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/LogByteSizeMergePolicy.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/LogByteSizeMergePolicy.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/LogByteSizeMergePolicy.cs Mon Mar 12 22:29:26 2012
@@ -52,63 +52,48 @@ namespace Lucene.Net.Index
{
// Do nothing.
}
-
- /// <summary><p/>Determines the largest segment (measured by total
- /// byte size of the segment's files, in MB) that may be
- /// merged with other segments. Small values (e.g., less
- /// than 50 MB) are best for interactive indexing, as this
- /// limits the length of pauses while indexing to a few
- /// seconds. Larger values are best for batched indexing
- /// and speedier searches.<p/>
- ///
- /// <p/>Note that <see cref="IndexWriter.SetMaxMergeDocs" /> is also
- /// used to check whether a segment is too large for
- /// merging (it's either or).<p/>
- /// </summary>
- public virtual void SetMaxMergeMB(double mb)
- {
- //mgarski: java gracefully overflows to Int64.MaxValue, .NET to MinValue...
- maxMergeSize = (long) (mb * 1024 * 1024);
- if (maxMergeSize < 0)
- {
- maxMergeSize = DEFAULT_MAX_MERGE_MB;
- }
- }
-
- /// <summary>Returns the largest segment (meaured by total byte
- /// size of the segment's files, in MB) that may be merged
- /// with other segments.
- /// </summary>
- /// <seealso cref="SetMaxMergeMB">
- /// </seealso>
- public virtual double GetMaxMergeMB()
- {
- return ((double) maxMergeSize) / 1024 / 1024;
- }
-
- /// <summary>Sets the minimum size for the lowest level segments.
- /// Any segments below this size are considered to be on
- /// the same level (even if they vary drastically in size)
- /// and will be merged whenever there are mergeFactor of
- /// them. This effectively truncates the "long tail" of
- /// small segments that would otherwise be created into a
- /// single level. If you set this too large, it could
- /// greatly increase the merging cost during indexing (if
- /// you flush many small segments).
- /// </summary>
- public virtual void SetMinMergeMB(double mb)
- {
- minMergeSize = (long) (mb * 1024 * 1024);
- }
-
- /// <summary>Get the minimum size for a segment to remain
- /// un-merged.
- /// </summary>
- /// <seealso cref="SetMinMergeMB">
- /// </seealso>
- public virtual double GetMinMergeMB()
- {
- return ((double) minMergeSize) / 1024 / 1024;
- }
+
+
+ /// <summary><p/>Gets or sets the largest segment (measured by total
+ /// byte size of the segment's files, in MB) that may be
+ /// merged with other segments. Small values (e.g., less
+ /// than 50 MB) are best for interactive indexing, as this
+ /// limits the length of pauses while indexing to a few
+ /// seconds. Larger values are best for batched indexing
+ /// and speedier searches.<p/>
+ ///
+ /// <p/>Note that <see cref="IndexWriter.MaxMergeDocs" /> is also
+ /// used to check whether a segment is too large for
+ /// merging (it's either or).<p/>
+ /// </summary>
+ public virtual double MaxMergeMB
+ {
+ get { return maxMergeSize/1024d/1024d; }
+ set
+ {
+ //mgarski: java gracefully overflows to Int64.MaxValue, .NET to MinValue...
+ maxMergeSize = (long) (value*1024*1024);
+ if (maxMergeSize < 0)
+ {
+ maxMergeSize = DEFAULT_MAX_MERGE_MB;
+ }
+ }
+ }
+
+ /// <summary>Gets or sets the minimum size for the lowest level segments.
+ /// Any segments below this size are considered to be on
+ /// the same level (even if they vary drastically in size)
+ /// and will be merged whenever there are mergeFactor of
+ /// them. This effectively truncates the "long tail" of
+ /// small segments that would otherwise be created into a
+ /// single level. If you set this too large, it could
+ /// greatly increase the merging cost during indexing (if
+ /// you flush many small segments).
+ /// </summary>
+ public virtual double MinMergeMB
+ {
+ get { return ((double) minMergeSize)/1024/1024; }
+ set { minMergeSize = (long) (value*1024*1024); }
+ }
}
}
\ No newline at end of file
Modified: incubator/lucene.net/trunk/src/core/Index/LogDocMergePolicy.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/LogDocMergePolicy.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/LogDocMergePolicy.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/LogDocMergePolicy.cs Mon Mar 12 22:29:26 2012
@@ -28,7 +28,7 @@ namespace Lucene.Net.Index
public class LogDocMergePolicy : LogMergePolicy
{
- /// <seealso cref="SetMinMergeDocs">
+ /// <seealso cref="MinMergeDocs">
/// </seealso>
public const int DEFAULT_MIN_MERGE_DOCS = 1000;
@@ -44,35 +44,26 @@ namespace Lucene.Net.Index
{
return SizeDocs(info);
}
-
- /// <summary>Sets the minimum size for the lowest level segments.
- /// Any segments below this size are considered to be on
- /// the same level (even if they vary drastically in size)
- /// and will be merged whenever there are mergeFactor of
- /// them. This effectively truncates the "long tail" of
- /// small segments that would otherwise be created into a
- /// single level. If you set this too large, it could
- /// greatly increase the merging cost during indexing (if
- /// you flush many small segments).
- /// </summary>
- public virtual void SetMinMergeDocs(int minMergeDocs)
- {
- minMergeSize = minMergeDocs;
- }
- protected override void Dispose(bool disposing)
+ protected override void Dispose(bool disposing)
{
// Do nothing.
}
- /// <summary>Get the minimum size for a segment to remain
- /// un-merged.
- /// </summary>
- /// <seealso cref="SetMinMergeDocs">
- /// </seealso>
- public virtual int GetMinMergeDocs()
- {
- return (int) minMergeSize;
- }
+ /// <summary>Gets or sets the minimum size for the lowest level segments.
+ /// Any segments below this size are considered to be on
+ /// the same level (even if they vary drastically in size)
+ /// and will be merged whenever there are mergeFactor of
+ /// them. This effectively truncates the "long tail" of
+ /// small segments that would otherwise be created into a
+ /// single level. If you set this too large, it could
+ /// greatly increase the merging cost during indexing (if
+ /// you flush many small segments).
+ /// </summary>
+ public virtual int MinMergeDocs
+ {
+ get { return (int) minMergeSize; }
+ set { minMergeSize = value; }
+ }
}
}
\ No newline at end of file
Modified: incubator/lucene.net/trunk/src/core/Index/LogMergePolicy.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/LogMergePolicy.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/LogMergePolicy.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/LogMergePolicy.cs Mon Mar 12 22:29:26 2012
@@ -88,68 +88,58 @@ namespace Lucene.Net.Index
return writer != null && writer.Verbose();
}
+ public double NoCFSRatio
+ {
+ get { return noCFSRatio; }
+ set
+ {
+ if (value < 0.0 || value > 1.0)
+ {
+ throw new ArgumentException("noCFSRatio must be 0.0 to 1.0 inclusive; got " + value);
+ }
+ this.noCFSRatio = value;
+ }
+ }
- /// <summary>
- /// <see cref="SetNoCFSRatio"/>
- /// </summary>
- public double GetNoCFSRatio()
- {
- return noCFSRatio;
- }
-
- /** If a merged segment will be more than this percentage
+ /** If a merged segment will be more than this percentage
* of the total size of the index, leave the segment as
* non-compound file even if compound file is enabled.
* Set to 1.0 to always use CFS regardless of merge
* size. */
- public void SetNoCFSRatio(double noCFSRatio)
- {
- if (noCFSRatio < 0.0 || noCFSRatio > 1.0)
- {
- throw new ArgumentException("noCFSRatio must be 0.0 to 1.0 inclusive; got " + noCFSRatio);
- }
- this.noCFSRatio = noCFSRatio;
- }
-
- private void Message(System.String message)
+ private void Message(System.String message)
{
if (Verbose())
writer.Message("LMP: " + message);
}
-
- /// <summary><p/>Returns the number of segments that are merged at
- /// once and also controls the total number of segments
- /// allowed to accumulate in the index.<p/>
- /// </summary>
- public virtual int GetMergeFactor()
- {
- return mergeFactor;
- }
-
- /// <summary>Determines how often segment indices are merged by
- /// addDocument(). With smaller values, less RAM is used
- /// while indexing, and searches on unoptimized indices are
- /// faster, but indexing speed is slower. With larger
- /// values, more RAM is used during indexing, and while
- /// searches on unoptimized indices are slower, indexing is
- /// faster. Thus larger values (> 10) are best for batch
- /// index creation, and smaller values (< 10) for indices
- /// that are interactively maintained.
- /// </summary>
- public virtual void SetMergeFactor(int mergeFactor)
- {
- if (mergeFactor < 2)
- throw new System.ArgumentException("mergeFactor cannot be less than 2");
- this.mergeFactor = mergeFactor;
- }
-
- // Javadoc inherited
+
+
+ /// <summary>Gets or sets how often segment indices are merged by
+ /// addDocument(). With smaller values, less RAM is used
+ /// while indexing, and searches on unoptimized indices are
+ /// faster, but indexing speed is slower. With larger
+ /// values, more RAM is used during indexing, and while
+ /// searches on unoptimized indices are slower, indexing is
+ /// faster. Thus larger values (> 10) are best for batch
+ /// index creation, and smaller values (< 10) for indices
+ /// that are interactively maintained.
+ /// </summary>
+ public virtual int MergeFactor
+ {
+ get { return mergeFactor; }
+ set
+ {
+ if (value < 2)
+ throw new System.ArgumentException("mergeFactor cannot be less than 2");
+ this.mergeFactor = value;
+ }
+ }
+
public override bool UseCompoundFile(SegmentInfos infos, SegmentInfo info)
{
return useCompoundFile;
}
- /// <summary>Sets whether compound file format should be used for
+ /// <summary>Gets or sets whether compound file format should be used for
/// newly flushed and newly merged segments.
/// </summary>
public virtual void SetUseCompoundFile(bool useCompoundFile)
@@ -157,9 +147,6 @@ namespace Lucene.Net.Index
this.useCompoundFile = useCompoundFile;
}
- /// <summary>Returns true if newly flushed and newly merge segments</summary>
- /// <seealso cref="SetUseCompoundFile">
- /// </seealso>
public virtual bool GetUseCompoundFile()
{
return useCompoundFile;
@@ -262,7 +249,7 @@ namespace Lucene.Net.Index
{
bool hasDeletions = writer.NumDeletedDocs(info) > 0;
return !hasDeletions && !info.HasSeparateNorms() && info.dir == writer.GetDirectory() &&
- (info.GetUseCompoundFile() == useCompoundFile || noCFSRatio < 1.0);
+ (info.UseCompoundFile == useCompoundFile || noCFSRatio < 1.0);
}
/// <summary>Returns the merges necessary to optimize the index.
Modified: incubator/lucene.net/trunk/src/core/Index/MergePolicy.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/MergePolicy.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/MergePolicy.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/MergePolicy.cs Mon Mar 12 22:29:26 2012
@@ -217,13 +217,14 @@ namespace Lucene.Net.Index
{
this.dir = dir;
}
- /// <summary>Returns the <see cref="Directory" /> of the index that hit
- /// the exception.
- /// </summary>
- public virtual Directory GetDirectory()
- {
- return dir;
- }
+
+ /// <summary>Returns the <see cref="Directory" /> of the index that hit
+ /// the exception.
+ /// </summary>
+ public virtual Directory Directory
+ {
+ get { return dir; }
+ }
}
[Serializable]
Modified: incubator/lucene.net/trunk/src/core/Index/MultiLevelSkipListReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/MultiLevelSkipListReader.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/MultiLevelSkipListReader.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/MultiLevelSkipListReader.cs Mon Mar 12 22:29:26 2012
@@ -126,7 +126,7 @@ namespace Lucene.Net.Index
else
{
// no more skips on this level, go down one level
- if (level > 0 && lastChildPointer > skipStream[level - 1].GetFilePointer())
+ if (level > 0 && lastChildPointer > skipStream[level - 1].FilePointer)
{
SeekChild(level - 1);
}
@@ -236,7 +236,7 @@ namespace Lucene.Net.Index
long length = skipStream[0].ReadVLong();
// the start pointer of the current level
- skipPointer[i] = skipStream[0].GetFilePointer();
+ skipPointer[i] = skipStream[0].FilePointer;
if (toBuffer > 0)
{
// buffer this level
@@ -253,12 +253,12 @@ namespace Lucene.Net.Index
}
// move base stream beyond the current level
- skipStream[0].Seek(skipStream[0].GetFilePointer() + length);
+ skipStream[0].Seek(skipStream[0].FilePointer + length);
}
}
// use base stream for the lowest level
- skipPointer[0] = skipStream[0].GetFilePointer();
+ skipPointer[0] = skipStream[0].FilePointer;
}
/// <summary> Subclasses must implement the actual skip data encoding in this method.
@@ -290,7 +290,7 @@ namespace Lucene.Net.Index
internal SkipBuffer(IndexInput input, int length)
{
data = new byte[length];
- pointer = input.GetFilePointer();
+ pointer = input.FilePointer;
input.ReadBytes(data, 0, length);
}
@@ -304,13 +304,13 @@ namespace Lucene.Net.Index
isDisposed = true;
}
-
- public override long GetFilePointer()
- {
- return pointer + pos;
- }
-
- public override long Length()
+
+ public override long FilePointer
+ {
+ get { return pointer + pos; }
+ }
+
+ public override long Length()
{
return data.Length;
}
Modified: incubator/lucene.net/trunk/src/core/Index/MultiLevelSkipListWriter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/MultiLevelSkipListWriter.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/MultiLevelSkipListWriter.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/MultiLevelSkipListWriter.cs Mon Mar 12 22:29:26 2012
@@ -128,7 +128,7 @@ namespace Lucene.Net.Index
{
WriteSkipData(level, skipBuffer[level]);
- long newChildPointer = skipBuffer[level].GetFilePointer();
+ long newChildPointer = skipBuffer[level].FilePointer;
if (level != 0)
{
@@ -150,13 +150,13 @@ namespace Lucene.Net.Index
/// </returns>
internal virtual long WriteSkip(IndexOutput output)
{
- long skipPointer = output.GetFilePointer();
+ long skipPointer = output.FilePointer;
if (skipBuffer == null || skipBuffer.Length == 0)
return skipPointer;
for (int level = numberOfSkipLevels - 1; level > 0; level--)
{
- long length = skipBuffer[level].GetFilePointer();
+ long length = skipBuffer[level].FilePointer;
if (length > 0)
{
output.WriteVLong(length);
Modified: incubator/lucene.net/trunk/src/core/Index/MultiReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/MultiReader.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/MultiReader.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/MultiReader.cs Mon Mar 12 22:29:26 2012
@@ -78,7 +78,7 @@ namespace Lucene.Net.Index
for (int i = 0; i < subReaders.Length; i++)
{
starts[i] = maxDoc;
- maxDoc += subReaders[i].MaxDoc(); // compute maxDocs
+ maxDoc += subReaders[i].MaxDoc; // compute maxDocs
if (!closeSubReaders)
{
@@ -90,7 +90,7 @@ namespace Lucene.Net.Index
decrefOnClose[i] = false;
}
- if (subReaders[i].HasDeletions())
+ if (subReaders[i].HasDeletions)
hasDeletions = true;
}
starts[subReaders.Length] = maxDoc;
@@ -245,34 +245,40 @@ namespace Lucene.Net.Index
int i = ReaderIndex(docNumber); // find segment num
subReaders[i].GetTermFreqVector(docNumber - starts[i], mapper);
}
-
- public override bool IsOptimized()
+
+ public override bool IsOptimized
{
- return false;
+ get { return false; }
}
-
- public override int NumDocs()
+
+ public override int NumDocs
{
- // Don't call ensureOpen() here (it could affect performance)
- // NOTE: multiple threads may wind up init'ing
- // numDocs... but that's harmless
- if (numDocs == - 1)
+ get
{
- // check cache
- int n = 0; // cache miss--recompute
- for (int i = 0; i < subReaders.Length; i++)
- n += subReaders[i].NumDocs(); // sum from readers
- numDocs = n;
+ // Don't call ensureOpen() here (it could affect performance)
+ // NOTE: multiple threads may wind up init'ing
+ // numDocs... but that's harmless
+ if (numDocs == - 1)
+ {
+ // check cache
+ int n = 0; // cache miss--recompute
+ for (int i = 0; i < subReaders.Length; i++)
+ n += subReaders[i].NumDocs; // sum from readers
+ numDocs = n;
+ }
+ return numDocs;
}
- return numDocs;
}
-
- public override int MaxDoc()
+
+ public override int MaxDoc
{
- // Don't call ensureOpen() here (it could affect performance)
- return maxDoc;
+ get
+ {
+ // Don't call ensureOpen() here (it could affect performance)
+ return maxDoc;
+ }
}
-
+
// inherit javadoc
public override Document Document(int n, FieldSelector fieldSelector)
{
@@ -287,13 +293,16 @@ namespace Lucene.Net.Index
int i = ReaderIndex(n); // find segment num
return subReaders[i].IsDeleted(n - starts[i]); // dispatch to segment reader
}
-
- public override bool HasDeletions()
+
+ public override bool HasDeletions
{
- // Don't call ensureOpen() here (it could affect performance)
- return hasDeletions;
+ get
+ {
+ // Don't call ensureOpen() here (it could affect performance)
+ return hasDeletions;
+ }
}
-
+
protected internal override void DoDelete(int n)
{
numDocs = - 1; // invalidate cache
@@ -339,7 +348,7 @@ namespace Lucene.Net.Index
if (!HasNorms(field))
return null;
- bytes = new byte[MaxDoc()];
+ bytes = new byte[MaxDoc];
for (int i = 0; i < subReaders.Length; i++)
subReaders[i].Norms(field, bytes, starts[i]);
normsCache[field] = bytes; // update cache
@@ -367,7 +376,7 @@ namespace Lucene.Net.Index
else if (bytes != null)
{
// cache hit
- Array.Copy(bytes, 0, result, offset, MaxDoc());
+ Array.Copy(bytes, 0, result, offset, MaxDoc);
}
else
{
@@ -457,32 +466,35 @@ namespace Lucene.Net.Index
EnsureOpen();
return DirectoryReader.GetFieldNames(fieldNames, this.subReaders);
}
-
+
/// <summary> Checks recursively if all subreaders are up to date. </summary>
- public override bool IsCurrent()
+ public override bool IsCurrent
{
- for (int i = 0; i < subReaders.Length; i++)
+ get
{
- if (!subReaders[i].IsCurrent())
+ for (int i = 0; i < subReaders.Length; i++)
{
- return false;
+ if (!subReaders[i].IsCurrent)
+ {
+ return false;
+ }
}
+
+ // all subreaders are up to date
+ return true;
}
-
- // all subreaders are up to date
- return true;
}
-
+
/// <summary>Not implemented.</summary>
/// <throws> UnsupportedOperationException </throws>
- public override long GetVersion()
+ public override long Version
{
- throw new System.NotSupportedException("MultiReader does not support this method.");
+ get { throw new System.NotSupportedException("MultiReader does not support this method."); }
}
-
- public override IndexReader[] GetSequentialSubReaders()
+
+ public override IndexReader[] SequentialSubReaders
{
- return subReaders;
+ get { return subReaders; }
}
}
}
\ No newline at end of file
Modified: incubator/lucene.net/trunk/src/core/Index/MultipleTermPositions.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/MultipleTermPositions.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/MultipleTermPositions.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/MultipleTermPositions.cs Mon Mar 12 22:29:26 2012
@@ -229,29 +229,28 @@ namespace Lucene.Net.Index
{
throw new System.NotSupportedException();
}
-
-
- /// <summary> Not implemented.</summary>
- /// <throws> UnsupportedOperationException </throws>
- public virtual int GetPayloadLength()
- {
- throw new System.NotSupportedException();
- }
-
- /// <summary> Not implemented.</summary>
+
+
+ /// <summary> Not implemented.</summary>
+ /// <throws> UnsupportedOperationException </throws>
+ public virtual int PayloadLength
+ {
+ get { throw new System.NotSupportedException(); }
+ }
+
+ /// <summary> Not implemented.</summary>
/// <throws> UnsupportedOperationException </throws>
public virtual byte[] GetPayload(byte[] data, int offset)
{
throw new System.NotSupportedException();
}
-
- /// <summary> </summary>
- /// <returns> false
- /// </returns>
- // TODO: Remove warning after API has been finalized
- public virtual bool IsPayloadAvailable()
- {
- return false;
- }
+
+ /// <summary> </summary>
+ /// <value> false </value>
+// TODO: Remove warning after API has been finalized
+ public virtual bool IsPayloadAvailable
+ {
+ get { return false; }
+ }
}
}
\ No newline at end of file
Modified: incubator/lucene.net/trunk/src/core/Index/NormsWriter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/NormsWriter.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/NormsWriter.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/NormsWriter.cs Mon Mar 12 22:29:26 2012
@@ -186,7 +186,7 @@ namespace Lucene.Net.Index
normsOut.WriteByte(defaultNorm);
}
- System.Diagnostics.Debug.Assert(4 + normCount * state.numDocs == normsOut.GetFilePointer(), ".nrm file size mismatch: expected=" +(4 + normCount * state.numDocs) + " actual=" + normsOut.GetFilePointer());
+ System.Diagnostics.Debug.Assert(4 + normCount * state.numDocs == normsOut.FilePointer, ".nrm file size mismatch: expected=" +(4 + normCount * state.numDocs) + " actual=" + normsOut.FilePointer);
}
}
finally
Modified: incubator/lucene.net/trunk/src/core/Index/ParallelReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/ParallelReader.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/ParallelReader.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/ParallelReader.cs Mon Mar 12 22:29:26 2012
@@ -22,7 +22,6 @@ using Lucene.Net.Support;
using Document = Lucene.Net.Documents.Document;
using FieldSelector = Lucene.Net.Documents.FieldSelector;
using FieldSelectorResult = Lucene.Net.Documents.FieldSelectorResult;
-using Fieldable = Lucene.Net.Documents.Fieldable;
namespace Lucene.Net.Index
{
@@ -98,16 +97,16 @@ namespace Lucene.Net.Index
EnsureOpen();
if (readers.Count == 0)
{
- this.maxDoc = reader.MaxDoc();
- this.numDocs = reader.NumDocs();
- this.hasDeletions = reader.HasDeletions();
+ this.maxDoc = reader.MaxDoc;
+ this.numDocs = reader.NumDocs;
+ this.hasDeletions = reader.HasDeletions;
}
- if (reader.MaxDoc() != maxDoc)
+ if (reader.MaxDoc != maxDoc)
// check compatibility
- throw new System.ArgumentException("All readers must have same maxDoc: " + maxDoc + "!=" + reader.MaxDoc());
- if (reader.NumDocs() != numDocs)
- throw new System.ArgumentException("All readers must have same numDocs: " + numDocs + "!=" + reader.NumDocs());
+ throw new System.ArgumentException("All readers must have same maxDoc: " + maxDoc + "!=" + reader.MaxDoc);
+ if (reader.NumDocs != numDocs)
+ throw new System.ArgumentException("All readers must have same numDocs: " + numDocs + "!=" + reader.NumDocs);
ICollection<string> fields = reader.GetFieldNames(IndexReader.FieldOption.ALL);
readerToFields[reader] = fields;
@@ -253,27 +252,36 @@ namespace Lucene.Net.Index
return this;
}
}
-
-
- public override int NumDocs()
- {
- // Don't call ensureOpen() here (it could affect performance)
- return numDocs;
- }
-
- public override int MaxDoc()
- {
- // Don't call ensureOpen() here (it could affect performance)
- return maxDoc;
- }
-
- public override bool HasDeletions()
- {
- // Don't call ensureOpen() here (it could affect performance)
- return hasDeletions;
- }
-
- // check first reader
+
+
+ public override int NumDocs
+ {
+ get
+ {
+ // Don't call ensureOpen() here (it could affect performance)
+ return numDocs;
+ }
+ }
+
+ public override int MaxDoc
+ {
+ get
+ {
+ // Don't call ensureOpen() here (it could affect performance)
+ return maxDoc;
+ }
+ }
+
+ public override bool HasDeletions
+ {
+ get
+ {
+ // Don't call ensureOpen() here (it could affect performance)
+ return hasDeletions;
+ }
+ }
+
+ // check first reader
public override bool IsDeleted(int n)
{
// Don't call ensureOpen() here (it could affect performance)
@@ -452,46 +460,52 @@ namespace Lucene.Net.Index
EnsureOpen();
return new ParallelTermPositions(this);
}
-
- /// <summary> Checks recursively if all subreaders are up to date. </summary>
- public override bool IsCurrent()
- {
- foreach(var reader in readers)
- {
- if (!reader.IsCurrent())
- {
- return false;
- }
- }
-
- // all subreaders are up to date
- return true;
- }
-
- /// <summary> Checks recursively if all subindexes are optimized </summary>
- public override bool IsOptimized()
- {
- foreach (var reader in readers)
- {
- if (!reader.IsOptimized())
- {
- return false;
- }
- }
- // all subindexes are optimized
- return true;
- }
-
-
- /// <summary>Not implemented.</summary>
- /// <throws> UnsupportedOperationException </throws>
- public override long GetVersion()
- {
- throw new System.NotSupportedException("ParallelReader does not support this method.");
- }
-
- // for testing
+ /// <summary> Checks recursively if all subreaders are up to date. </summary>
+ public override bool IsCurrent
+ {
+ get
+ {
+ foreach (var reader in readers)
+ {
+ if (!reader.IsCurrent)
+ {
+ return false;
+ }
+ }
+
+ // all subreaders are up to date
+ return true;
+ }
+ }
+
+ /// <summary> Checks recursively if all subindexes are optimized </summary>
+ public override bool IsOptimized
+ {
+ get
+ {
+ foreach (var reader in readers)
+ {
+ if (!reader.IsOptimized)
+ {
+ return false;
+ }
+ }
+
+ // all subindexes are optimized
+ return true;
+ }
+ }
+
+
+ /// <summary>Not implemented.</summary>
+ /// <throws> UnsupportedOperationException </throws>
+ public override long Version
+ {
+ get { throw new System.NotSupportedException("ParallelReader does not support this method."); }
+ }
+
+ // for testing
public /*internal*/ virtual IndexReader[] GetSubReaders()
{
return readers.ToArray();
@@ -790,23 +804,24 @@ namespace Lucene.Net.Index
// It is an error to call this if there is no next position, e.g. if termDocs==null
return ((TermPositions) termDocs).NextPosition();
}
-
- public virtual int GetPayloadLength()
- {
- return ((TermPositions) termDocs).GetPayloadLength();
- }
-
- public virtual byte[] GetPayload(byte[] data, int offset)
+
+ public virtual int PayloadLength
+ {
+ get { return ((TermPositions) termDocs).PayloadLength; }
+ }
+
+ public virtual byte[] GetPayload(byte[] data, int offset)
{
return ((TermPositions) termDocs).GetPayload(data, offset);
}
// TODO: Remove warning after API has been finalized
- public virtual bool IsPayloadAvailable()
- {
- return ((TermPositions) termDocs).IsPayloadAvailable();
- }
+
+ public virtual bool IsPayloadAvailable
+ {
+ get { return ((TermPositions) termDocs).IsPayloadAvailable; }
+ }
}
}
}
\ No newline at end of file
Modified: incubator/lucene.net/trunk/src/core/Index/Payload.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/Payload.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/Payload.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/Payload.cs Mon Mar 12 22:29:26 2012
@@ -84,48 +84,40 @@ namespace Lucene.Net.Index
this.offset = offset;
this.length = length;
}
-
- /// <summary> Sets this payloads data.
+
+ /// <summary> Sets this payloads data.
/// A reference to the passed-in array is held, i. e. no
/// copy is made.
/// </summary>
- public virtual void SetData(byte[] data)
+ public virtual void SetData(byte[] value, int offset, int length)
{
- SetData(data, 0, data.Length);
- }
-
- /// <summary> Sets this payloads data.
- /// A reference to the passed-in array is held, i. e. no
- /// copy is made.
- /// </summary>
- public virtual void SetData(byte[] data, int offset, int length)
- {
- this.data = data;
+ this.data = value;
this.offset = offset;
this.length = length;
}
-
- /// <summary> Returns a reference to the underlying byte array
- /// that holds this payloads data.
- /// </summary>
- public virtual byte[] GetData()
- {
- return this.data;
- }
-
- /// <summary> Returns the offset in the underlying byte array </summary>
- public virtual int GetOffset()
- {
- return this.offset;
- }
-
- /// <summary> Returns the length of the payload data. </summary>
- public virtual int Length()
- {
- return this.length;
- }
-
- /// <summary> Returns the byte at the given index.</summary>
+
+ /// <summary> Gets or sets a reference to the underlying byte array
+ /// that holds this payloads data. Data is not copied.
+ /// </summary>
+ public virtual byte[] Data
+ {
+ get { return this.data; }
+ set { SetData(value, 0, value.Length); }
+ }
+
+ /// <summary> Returns the offset in the underlying byte array </summary>
+ public virtual int Offset
+ {
+ get { return this.offset; }
+ }
+
+ /// <summary> Returns the length of the payload data. </summary>
+ public virtual int Length
+ {
+ get { return this.length; }
+ }
+
+ /// <summary> Returns the byte at the given index.</summary>
public virtual byte ByteAt(int index)
{
if (0 <= index && index < this.length)
Modified: incubator/lucene.net/trunk/src/core/Index/PositionBasedTermVectorMapper.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/PositionBasedTermVectorMapper.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/PositionBasedTermVectorMapper.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/PositionBasedTermVectorMapper.cs Mon Mar 12 22:29:26 2012
@@ -100,18 +100,17 @@ namespace Lucene.Net.Index
currentPositions = new HashMap<int, TVPositionInfo>();
fieldToTerms[currentField] = currentPositions;
}
-
- /// <summary> Get the mapping between fields and terms, sorted by the comparator
- ///
- /// </summary>
- /// <returns> A map between field names and a Map. The sub-Map key is the position as the integer, the value is <see cref="Lucene.Net.Index.PositionBasedTermVectorMapper.TVPositionInfo" />.
- /// </returns>
- public virtual IDictionary<string, IDictionary<int, TVPositionInfo>> GetFieldToTerms()
- {
- return fieldToTerms;
- }
-
- /// <summary> Container for a term at a position</summary>
+
+ /// <summary> Get the mapping between fields and terms, sorted by the comparator
+ ///
+ /// </summary>
+ /// <value> A map between field names and a Map. The sub-Map key is the position as the integer, the value is <see cref="Lucene.Net.Index.PositionBasedTermVectorMapper.TVPositionInfo" />. </value>
+ public virtual IDictionary<string, IDictionary<int, TVPositionInfo>> FieldToTerms
+ {
+ get { return fieldToTerms; }
+ }
+
+ /// <summary> Container for a term at a position</summary>
public class TVPositionInfo
{
/// <summary> </summary>
Modified: incubator/lucene.net/trunk/src/core/Index/SegmentInfo.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/SegmentInfo.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/SegmentInfo.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/SegmentInfo.cs Mon Mar 12 22:29:26 2012
@@ -128,7 +128,7 @@ namespace Lucene.Net.Index
}
/// <summary> Copy everything from src SegmentInfo into our instance.</summary>
- internal void Reset(SegmentInfo src)
+ internal void Reset(SegmentInfo src)
{
ClearFiles();
name = src.name;
@@ -151,18 +151,14 @@ namespace Lucene.Net.Index
hasSingleNormFile = src.hasSingleNormFile;
delCount = src.delCount;
}
-
- internal void SetDiagnostics(IDictionary<string, string> diagnostics)
- {
- this.diagnostics = diagnostics;
- }
-
- public IDictionary<string, string> GetDiagnostics()
- {
- return diagnostics;
- }
-
- /// <summary> Construct a new SegmentInfo instance by reading a
+
+ public IDictionary<string, string> Diagnostics
+ {
+ get { return diagnostics; }
+ internal set { this.diagnostics = value; }
+ }
+
+ /// <summary> Construct a new SegmentInfo instance by reading a
/// previously saved SegmentInfo from input.
///
/// </summary>
@@ -289,7 +285,7 @@ namespace Lucene.Net.Index
/// <summary>Returns total size in bytes of all of files used by
/// this segment.
/// </summary>
- public long SizeInBytes()
+ public long SizeInBytes()
{
if (sizeInBytes == - 1)
{
@@ -307,8 +303,8 @@ namespace Lucene.Net.Index
}
return sizeInBytes;
}
-
- public bool HasDeletions()
+
+ public bool HasDeletions()
{
// Cases:
//
@@ -456,7 +452,7 @@ namespace Lucene.Net.Index
throw new System.IO.IOException("cannot read directory " + dir + ": ListAll() returned null");
}
- IndexFileNameFilter filter = IndexFileNameFilter.GetFilter();
+ IndexFileNameFilter filter = IndexFileNameFilter.Filter;
System.String pattern;
pattern = name + ".s";
int patternLength = pattern.Length;
@@ -554,46 +550,39 @@ namespace Lucene.Net.Index
prefix = ".f";
return IndexFileNames.FileNameFromGeneration(name, prefix + number, WITHOUT_GEN);
}
-
- /// <summary> Mark whether this segment is stored as a compound file.
- ///
- /// </summary>
- /// <param name="isCompoundFile">true if this is a compound file;
- /// else, false
- /// </param>
- internal void SetUseCompoundFile(bool isCompoundFile)
- {
- if (isCompoundFile)
- {
- this.isCompoundFile = (sbyte) (YES);
- }
- else
- {
- this.isCompoundFile = (sbyte) (NO);
- }
- ClearFiles();
- }
-
- /// <summary> Returns true if this segment is stored as a compound
- /// file; else, false.
- /// </summary>
- public bool GetUseCompoundFile()
- {
- if (isCompoundFile == NO)
- {
- return false;
- }
- else if (isCompoundFile == YES)
- {
- return true;
- }
- else
- {
- return dir.FileExists(name + "." + IndexFileNames.COMPOUND_FILE_EXTENSION);
- }
- }
-
- public int GetDelCount()
+
+ /// <summary> Returns true if this segment is stored as a compound
+ /// file; else, false.
+ /// </summary>
+ public bool UseCompoundFile
+ {
+ get
+ {
+ if (isCompoundFile == NO)
+ {
+ return false;
+ }
+ if (isCompoundFile == YES)
+ {
+ return true;
+ }
+ return dir.FileExists(name + "." + IndexFileNames.COMPOUND_FILE_EXTENSION);
+ }
+ internal set
+ {
+ if (value)
+ {
+ this.isCompoundFile = (sbyte) (YES);
+ }
+ else
+ {
+ this.isCompoundFile = (sbyte) (NO);
+ }
+ ClearFiles();
+ }
+ }
+
+ public int GetDelCount()
{
if (delCount == - 1)
{
@@ -614,35 +603,33 @@ namespace Lucene.Net.Index
this.delCount = delCount;
System.Diagnostics.Debug.Assert(delCount <= docCount);
}
-
- public int GetDocStoreOffset()
- {
- return docStoreOffset;
- }
-
- public bool GetDocStoreIsCompoundFile()
- {
- return docStoreIsCompoundFile;
- }
-
- internal void SetDocStoreIsCompoundFile(bool v)
- {
- docStoreIsCompoundFile = v;
- ClearFiles();
- }
-
- public System.String GetDocStoreSegment()
- {
- return docStoreSegment;
- }
-
- internal void SetDocStoreOffset(int offset)
- {
- docStoreOffset = offset;
- ClearFiles();
- }
-
- internal void SetDocStore(int offset, System.String segment, bool isCompoundFile)
+
+ public int DocStoreOffset
+ {
+ get { return docStoreOffset; }
+ internal set
+ {
+ docStoreOffset = value;
+ ClearFiles();
+ }
+ }
+
+ public bool DocStoreIsCompoundFile
+ {
+ get { return docStoreIsCompoundFile; }
+ internal set
+ {
+ docStoreIsCompoundFile = value;
+ ClearFiles();
+ }
+ }
+
+ public string DocStoreSegment
+ {
+ get { return docStoreSegment; }
+ }
+
+ internal void SetDocStore(int offset, System.String segment, bool isCompoundFile)
{
docStoreOffset = offset;
docStoreSegment = segment;
@@ -680,19 +667,18 @@ namespace Lucene.Net.Index
output.WriteByte((byte) (hasProx?1:0));
output.WriteStringStringMap(diagnostics);
}
-
- internal void SetHasProx(bool hasProx)
- {
- this.hasProx = hasProx;
- ClearFiles();
- }
-
- public bool GetHasProx()
- {
- return hasProx;
- }
-
- private void AddIfExists(IList<string> files, System.String fileName)
+
+ public bool HasProx
+ {
+ get { return hasProx; }
+ internal set
+ {
+ this.hasProx = value;
+ ClearFiles();
+ }
+ }
+
+ private void AddIfExists(IList<string> files, System.String fileName)
{
if (dir.FileExists(fileName))
files.Add(fileName);
@@ -715,7 +701,7 @@ namespace Lucene.Net.Index
var fileList = new System.Collections.Generic.List<string>();
- bool useCompoundFile = GetUseCompoundFile();
+ bool useCompoundFile = UseCompoundFile;
if (useCompoundFile)
{
@@ -813,7 +799,7 @@ namespace Lucene.Net.Index
prefix = name + "." + IndexFileNames.PLAIN_NORMS_EXTENSION;
int prefixLength = prefix.Length;
System.String[] allFiles = dir.ListAll();
- IndexFileNameFilter filter = IndexFileNameFilter.GetFilter();
+ IndexFileNameFilter filter = IndexFileNameFilter.Filter;
for (int i = 0; i < allFiles.Length; i++)
{
System.String fileName = allFiles[i];
@@ -842,7 +828,7 @@ namespace Lucene.Net.Index
System.String cfs;
try
{
- if (GetUseCompoundFile())
+ if (UseCompoundFile)
cfs = "c";
else
cfs = "C";
Modified: incubator/lucene.net/trunk/src/core/Index/SegmentInfos.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/SegmentInfos.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/SegmentInfos.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/SegmentInfos.cs Mon Mar 12 22:29:26 2012
@@ -17,6 +17,7 @@
using System;
using System.Collections.Generic;
+using System.IO;
using Lucene.Net.Support;
using ChecksumIndexInput = Lucene.Net.Store.ChecksumIndexInput;
using ChecksumIndexOutput = Lucene.Net.Store.ChecksumIndexOutput;
@@ -300,7 +301,7 @@ namespace Lucene.Net.Index
if (format >= 0)
{
// in old format the version number may be at the end of the file
- if (input.GetFilePointer() >= input.Length())
+ if (input.FilePointer >= input.Length())
version = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond);
// old file format without version number
else
@@ -451,22 +452,24 @@ namespace Lucene.Net.Index
sis.version = this.version;
return sis;
}
-
- /// <summary> version number when this SegmentInfos was generated.</summary>
- public long GetVersion()
- {
- return version;
- }
- public long GetGeneration()
- {
- return generation;
- }
- public long GetLastGeneration()
- {
- return lastGeneration;
- }
-
- /// <summary> Current version number from segments file.</summary>
+
+ /// <summary> version number when this SegmentInfos was generated.</summary>
+ public long Version
+ {
+ get { return version; }
+ }
+
+ public long Generation
+ {
+ get { return generation; }
+ }
+
+ public long LastGeneration
+ {
+ get { return lastGeneration; }
+ }
+
+ /// <summary> Current version number from segments file.</summary>
/// <throws> CorruptIndexException if the index is corrupt </throws>
/// <throws> IOException if there is a low-level IO error </throws>
public static long ReadCurrentVersion(Directory directory)
@@ -490,7 +493,7 @@ namespace Lucene.Net.Index
{
SegmentInfos sis = new SegmentInfos();
sis.Read(directory);
- return sis.GetUserData();
+ return sis.UserData;
}
/// <summary>If non-null, information about retries when loading
@@ -506,64 +509,48 @@ namespace Lucene.Net.Index
private static int defaultGenFileRetryCount = 10;
private static int defaultGenFileRetryPauseMsec = 50;
private static int defaultGenLookaheadCount = 10;
-
- /// <summary> Advanced: set how many times to try loading the
- /// segments.gen file contents to determine current segment
- /// generation. This file is only referenced when the
- /// primary method (listing the directory) fails.
- /// </summary>
- public static void SetDefaultGenFileRetryCount(int count)
- {
- defaultGenFileRetryCount = count;
- }
-
- /// <seealso cref="SetDefaultGenFileRetryCount">
- /// </seealso>
- public static int GetDefaultGenFileRetryCount()
- {
- return defaultGenFileRetryCount;
- }
-
- /// <summary> Advanced: set how many milliseconds to pause in between
- /// attempts to load the segments.gen file.
- /// </summary>
- public static void SetDefaultGenFileRetryPauseMsec(int msec)
- {
- defaultGenFileRetryPauseMsec = msec;
- }
-
- /// <seealso cref="SetDefaultGenFileRetryPauseMsec">
- /// </seealso>
- public static int GetDefaultGenFileRetryPauseMsec()
- {
- return defaultGenFileRetryPauseMsec;
- }
-
- /// <summary> Advanced: set how many times to try incrementing the
- /// gen when loading the segments file. This only runs if
- /// the primary (listing directory) and secondary (opening
- /// segments.gen file) methods fail to find the segments
- /// file.
- /// </summary>
- public static void SetDefaultGenLookaheadCount(int count)
- {
- defaultGenLookaheadCount = count;
- }
- /// <seealso cref="SetDefaultGenLookaheadCount">
- /// </seealso>
- public static int GetDefaultGenLookahedCount()
- {
- return defaultGenLookaheadCount;
- }
-
- /// <seealso cref="SetInfoStream">
- /// </seealso>
- public static System.IO.StreamWriter GetInfoStream()
- {
- return infoStream;
- }
-
- private static void Message(System.String message)
+
+ /// <summary> Advanced: Gets or sets how many times to try loading the
+ /// segments.gen file contents to determine current segment
+ /// generation. This file is only referenced when the
+ /// primary method (listing the directory) fails.
+ /// </summary>
+ public static int DefaultGenFileRetryCount
+ {
+ get { return defaultGenFileRetryCount; }
+ set { defaultGenFileRetryCount = value; }
+ }
+
+ public static int DefaultGenFileRetryPauseMsec
+ {
+ set { defaultGenFileRetryPauseMsec = value; }
+ get { return defaultGenFileRetryPauseMsec; }
+ }
+
+ /// <summary> Advanced: set how many times to try incrementing the
+ /// gen when loading the segments file. This only runs if
+ /// the primary (listing directory) and secondary (opening
+ /// segments.gen file) methods fail to find the segments
+ /// file.
+ /// </summary>
+ public static int DefaultGenLookaheadCount
+ {
+ set { defaultGenLookaheadCount = value; }
+ }
+
+ public static int DefaultGenLookahedCount
+ {
+ get { return defaultGenLookaheadCount; }
+ }
+
+ /// <seealso cref="SetInfoStream">
+ /// </seealso>
+ public static StreamWriter InfoStream
+ {
+ get { return infoStream; }
+ }
+
+ private static void Message(System.String message)
{
if (infoStream != null)
{
@@ -598,9 +585,9 @@ namespace Lucene.Net.Index
{
if (commit != null)
{
- if (directory != commit.GetDirectory())
+ if (directory != commit.Directory)
throw new System.IO.IOException("the specified commit does not match the specified Directory");
- return DoBody(commit.GetSegmentsFileName());
+ return DoBody(commit.SegmentsFileName);
}
System.String segmentFileName = null;
@@ -1027,25 +1014,16 @@ namespace Lucene.Net.Index
return buffer.ToString();
}
}
-
- public System.Collections.Generic.IDictionary<string,string> GetUserData()
- {
- return userData;
- }
- internal void SetUserData(System.Collections.Generic.IDictionary<string, string> data)
- {
- if (data == null)
- {
- userData = new HashMap<string, string>();
- }
- else
- {
- userData = data;
- }
- }
-
- /// <summary>Replaces all segments in this instance, but keeps
+ public IDictionary<string, string> UserData
+ {
+ get { return userData; }
+ internal set {
+ userData = value ?? new HashMap<string, string>();
+ }
+ }
+
+ /// <summary>Replaces all segments in this instance, but keeps
/// generation, version, counter so that future commits
/// remain write once.
/// </summary>
Modified: incubator/lucene.net/trunk/src/core/Index/SegmentMergeInfo.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/SegmentMergeInfo.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/SegmentMergeInfo.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/SegmentMergeInfo.cs Mon Mar 12 22:29:26 2012
@@ -48,9 +48,9 @@ namespace Lucene.Net.Index
{
delCount = 0;
// build array which maps document numbers around deletions
- if (reader.HasDeletions())
+ if (reader.HasDeletions)
{
- int maxDoc = reader.MaxDoc();
+ int maxDoc = reader.MaxDoc;
docMap = new int[maxDoc];
int j = 0;
for (int i = 0; i < maxDoc; i++)
Modified: incubator/lucene.net/trunk/src/core/Index/SegmentMerger.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/SegmentMerger.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/SegmentMerger.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/SegmentMerger.cs Mon Mar 12 22:29:26 2012
@@ -150,7 +150,7 @@ namespace Lucene.Net.Index
{
checkAbort = new AnonymousClassCheckAbort1(this, null, null);
}
- termIndexInterval = writer.GetTermIndexInterval();
+ termIndexInterval = writer.TermIndexInterval;
}
internal bool HasProx()
@@ -230,7 +230,7 @@ namespace Lucene.Net.Index
}
}
- public /*internal*/ ICollection<string> GetMergedFiles()
+ internal ICollection<string> GetMergedFiles()
{
ISet<string> fileSet = new HashSet<string>();
@@ -409,7 +409,7 @@ namespace Lucene.Net.Index
matchingFieldsReader = fieldsReader;
}
}
- if (reader.HasDeletions())
+ if (reader.HasDeletions)
{
docCount += CopyFieldsWithDeletions(fieldsWriter, reader, matchingFieldsReader);
}
@@ -442,7 +442,7 @@ namespace Lucene.Net.Index
{
foreach(IndexReader reader in readers)
{
- docCount += reader.NumDocs();
+ docCount += reader.NumDocs;
}
}
@@ -452,7 +452,7 @@ namespace Lucene.Net.Index
private int CopyFieldsWithDeletions(FieldsWriter fieldsWriter, IndexReader reader, FieldsReader matchingFieldsReader)
{
int docCount = 0;
- int maxDoc = reader.MaxDoc();
+ int maxDoc = reader.MaxDoc;
if (matchingFieldsReader != null)
{
// We can bulk-copy because the fieldInfos are "congruent"
@@ -509,7 +509,7 @@ namespace Lucene.Net.Index
private int CopyFieldsNoDeletions(FieldsWriter fieldsWriter, IndexReader reader, FieldsReader matchingFieldsReader)
{
- int maxDoc = reader.MaxDoc();
+ int maxDoc = reader.MaxDoc;
int docCount = 0;
if (matchingFieldsReader != null)
{
@@ -560,7 +560,7 @@ namespace Lucene.Net.Index
matchingVectorsReader = vectorsReader;
}
}
- if (reader.HasDeletions())
+ if (reader.HasDeletions)
{
CopyVectorsWithDeletions(termVectorsWriter, matchingVectorsReader, reader);
}
@@ -589,7 +589,7 @@ namespace Lucene.Net.Index
private void CopyVectorsWithDeletions(TermVectorsWriter termVectorsWriter, TermVectorsReader matchingVectorsReader, IndexReader reader)
{
- int maxDoc = reader.MaxDoc();
+ int maxDoc = reader.MaxDoc;
if (matchingVectorsReader != null)
{
// We can bulk-copy because the fieldInfos are "congruent"
@@ -644,7 +644,7 @@ namespace Lucene.Net.Index
private void CopyVectorsNoDeletions(TermVectorsWriter termVectorsWriter, TermVectorsReader matchingVectorsReader, IndexReader reader)
{
- int maxDoc = reader.MaxDoc();
+ int maxDoc = reader.MaxDoc;
if (matchingVectorsReader != null)
{
// We can bulk-copy because the fieldInfos are "congruent"
@@ -714,12 +714,12 @@ namespace Lucene.Net.Index
delCounts = new int[readerCount];
}
docMaps[i] = docMap;
- delCounts[i] = smi.reader.MaxDoc() - smi.reader.NumDocs();
+ delCounts[i] = smi.reader.MaxDoc - smi.reader.NumDocs;
}
- base_Renamed += reader.NumDocs();
+ base_Renamed += reader.NumDocs;
- System.Diagnostics.Debug.Assert(reader.NumDocs() == reader.MaxDoc() - smi.delCount);
+ System.Diagnostics.Debug.Assert(reader.NumDocs == reader.MaxDoc - smi.delCount);
if (smi.Next())
queue.Add(smi);
@@ -827,7 +827,7 @@ namespace Lucene.Net.Index
for (int j = 0; j < freq; j++)
{
int position = postings.NextPosition();
- int payloadLength = postings.GetPayloadLength();
+ int payloadLength = postings.PayloadLength;
if (payloadLength > 0)
{
if (payloadBuffer == null || payloadBuffer.Length < payloadLength)
@@ -864,14 +864,14 @@ namespace Lucene.Net.Index
}
foreach(IndexReader reader in readers)
{
- int maxDoc = reader.MaxDoc();
+ int maxDoc = reader.MaxDoc;
if (normBuffer == null || normBuffer.Length < maxDoc)
{
// the buffer is too small for the current segment
normBuffer = new byte[maxDoc];
}
reader.Norms(fi.name, normBuffer, 0);
- if (!reader.HasDeletions())
+ if (!reader.HasDeletions)
{
//optimized case for segments without deleted docs
output.WriteBytes(normBuffer, maxDoc);
Modified: incubator/lucene.net/trunk/src/core/Index/SegmentReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/SegmentReader.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/SegmentReader.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/SegmentReader.cs Mon Mar 12 22:29:26 2012
@@ -114,7 +114,7 @@ namespace Lucene.Net.Index
try
{
Directory dir0 = dir;
- if (si.GetUseCompoundFile())
+ if (si.UseCompoundFile)
{
cfsReader = new CompoundFileReader(dir, segment + "." + IndexFileNames.COMPOUND_FILE_EXTENSION, readBufferSize);
dir0 = cfsReader;
@@ -232,7 +232,7 @@ namespace Lucene.Net.Index
if (tis == null)
{
Directory dir0;
- if (si.GetUseCompoundFile())
+ if (si.UseCompoundFile)
{
// In some cases, we were originally opened when CFS
// was not used, but then we are asked to open the
@@ -324,12 +324,12 @@ namespace Lucene.Net.Index
if (fieldsReaderOrig == null)
{
Directory storeDir;
- if (si.GetDocStoreOffset() != - 1)
+ if (si.DocStoreOffset != - 1)
{
- if (si.GetDocStoreIsCompoundFile())
+ if (si.DocStoreIsCompoundFile)
{
System.Diagnostics.Debug.Assert(storeCFSReader == null);
- storeCFSReader = new CompoundFileReader(dir, si.GetDocStoreSegment() + "." + IndexFileNames.COMPOUND_FILE_STORE_EXTENSION, readBufferSize);
+ storeCFSReader = new CompoundFileReader(dir, si.DocStoreSegment + "." + IndexFileNames.COMPOUND_FILE_STORE_EXTENSION, readBufferSize);
storeDir = storeCFSReader;
System.Diagnostics.Debug.Assert(storeDir != null);
}
@@ -339,7 +339,7 @@ namespace Lucene.Net.Index
System.Diagnostics.Debug.Assert(storeDir != null);
}
}
- else if (si.GetUseCompoundFile())
+ else if (si.UseCompoundFile)
{
// In some cases, we were originally opened when CFS
// was not used, but then we are asked to open doc
@@ -358,19 +358,19 @@ namespace Lucene.Net.Index
}
System.String storesSegment;
- if (si.GetDocStoreOffset() != - 1)
+ if (si.DocStoreOffset != - 1)
{
- storesSegment = si.GetDocStoreSegment();
+ storesSegment = si.DocStoreSegment;
}
else
{
storesSegment = segment;
}
- fieldsReaderOrig = new FieldsReader(storeDir, storesSegment, fieldInfos, readBufferSize, si.GetDocStoreOffset(), si.docCount);
+ fieldsReaderOrig = new FieldsReader(storeDir, storesSegment, fieldInfos, readBufferSize, si.DocStoreOffset, si.docCount);
// Verify two sources of "maxDoc" agree:
- if (si.GetDocStoreOffset() == - 1 && fieldsReaderOrig.Size() != si.docCount)
+ if (si.DocStoreOffset == - 1 && fieldsReaderOrig.Size() != si.docCount)
{
throw new CorruptIndexException("doc counts differ for segment " + segment + ": fieldsReader shows " + fieldsReaderOrig.Size() + " but segmentInfo shows " + si.docCount);
}
@@ -378,7 +378,7 @@ namespace Lucene.Net.Index
if (fieldInfos.HasVectors())
{
// open term vector files only as needed
- termVectorsReaderOrig = new TermVectorsReader(storeDir, storesSegment, fieldInfos, readBufferSize, si.GetDocStoreOffset(), si.docCount);
+ termVectorsReaderOrig = new TermVectorsReader(storeDir, storesSegment, fieldInfos, readBufferSize, si.DocStoreOffset, si.docCount);
}
}
}
@@ -577,7 +577,7 @@ namespace Lucene.Net.Index
if (bytes != null)
{
// Already cached -- copy from cache:
- System.Diagnostics.Debug.Assert(len <= Enclosing_Instance.MaxDoc());
+ System.Diagnostics.Debug.Assert(len <= Enclosing_Instance.MaxDoc);
Array.Copy(bytes, 0, bytesOut, offset, len);
}
else
@@ -629,7 +629,7 @@ namespace Lucene.Net.Index
{
// We are the origNorm, so load the bytes for real
// ourself:
- int count = Enclosing_Instance.MaxDoc();
+ int count = Enclosing_Instance.MaxDoc;
bytes = new byte[count];
// Since we are orig, in must not be null
@@ -743,7 +743,7 @@ namespace Lucene.Net.Index
try
{
try {
- @out.WriteBytes(bytes, enclosingInstance.MaxDoc());
+ @out.WriteBytes(bytes, enclosingInstance.MaxDoc);
} finally {
@out.Close();
}
@@ -830,7 +830,7 @@ namespace Lucene.Net.Index
// Verify # deletes does not exceed maxDoc for this
// segment:
- System.Diagnostics.Debug.Assert(si.GetDelCount() <= MaxDoc(), "delete count mismatch: " + recomputedCount + ") exceeds max doc (" + MaxDoc() + ") for segment " + si.name);
+ System.Diagnostics.Debug.Assert(si.GetDelCount() <= MaxDoc, "delete count mismatch: " + recomputedCount + ") exceeds max doc (" + MaxDoc + ") for segment " + si.name);
return true;
}
@@ -838,7 +838,8 @@ namespace Lucene.Net.Index
private void LoadDeletedDocs()
{
// NOTE: the bitvector is stored using the regular directory, not cfs
- if (HasDeletions(si))
+ //if(HasDeletions(si))
+ if (si.HasDeletions())
{
deletedDocs = new BitVector(Directory(), si.GetDelFileName());
deletedDocsRef = new Ref();
@@ -988,7 +989,7 @@ namespace Lucene.Net.Index
// If we are not cloning, then this will open anew
// any norms that have changed:
- clone.OpenNorms(si.GetUseCompoundFile()?core.GetCFSReader():Directory(), readBufferSize);
+ clone.OpenNorms(si.UseCompoundFile?core.GetCFSReader():Directory(), readBufferSize);
success = true;
}
@@ -1111,21 +1112,24 @@ namespace Lucene.Net.Index
}
}
- internal static bool HasDeletions(SegmentInfo si)
- {
- // Don't call ensureOpen() here (it could affect performance)
- return si.HasDeletions();
- }
-
- public override bool HasDeletions()
- {
- // Don't call ensureOpen() here (it could affect performance)
- return deletedDocs != null;
- }
-
- internal static bool UsesCompoundFile(SegmentInfo si)
+ //internal static bool HasDeletions(SegmentInfo si)
+ //{
+ // // Don't call ensureOpen() here (it could affect performance)
+ // return si.HasDeletions();
+ //}
+
+ public override bool HasDeletions
+ {
+ get
+ {
+ // Don't call ensureOpen() here (it could affect performance)
+ return deletedDocs != null;
+ }
+ }
+
+ internal static bool UsesCompoundFile(SegmentInfo si)
{
- return si.GetUseCompoundFile();
+ return si.UseCompoundFile;
}
internal static bool HasSeparateNorms(SegmentInfo si)
@@ -1137,7 +1141,7 @@ namespace Lucene.Net.Index
{
if (deletedDocs == null)
{
- deletedDocs = new BitVector(MaxDoc());
+ deletedDocs = new BitVector(MaxDoc);
deletedDocsRef = new Ref();
}
// there is more than 1 SegmentReader with a reference to this
@@ -1244,23 +1248,29 @@ namespace Lucene.Net.Index
else
return 0;
}
-
- public override int NumDocs()
- {
- // Don't call ensureOpen() here (it could affect performance)
- int n = MaxDoc();
- if (deletedDocs != null)
- n -= deletedDocs.Count();
- return n;
- }
-
- public override int MaxDoc()
- {
- // Don't call ensureOpen() here (it could affect performance)
- return si.docCount;
- }
-
- /// <seealso cref="IndexReader.GetFieldNames(IndexReader.FieldOption)">
+
+ public override int NumDocs
+ {
+ get
+ {
+ // Don't call ensureOpen() here (it could affect performance)
+ int n = MaxDoc;
+ if (deletedDocs != null)
+ n -= deletedDocs.Count();
+ return n;
+ }
+ }
+
+ public override int MaxDoc
+ {
+ get
+ {
+ // Don't call ensureOpen() here (it could affect performance)
+ return si.docCount;
+ }
+ }
+
+ /// <seealso cref="IndexReader.GetFieldNames(IndexReader.FieldOption)">
/// </seealso>
public override System.Collections.Generic.ICollection<string> GetFieldNames(IndexReader.FieldOption fieldOption)
{
@@ -1379,7 +1389,7 @@ namespace Lucene.Net.Index
return ;
}
- norm.Bytes(bytes, offset, MaxDoc());
+ norm.Bytes(bytes, offset, MaxDoc);
}
}
@@ -1387,7 +1397,7 @@ namespace Lucene.Net.Index
private void OpenNorms(Directory cfsDir, int readBufferSize)
{
long nextNormSeek = SegmentMerger.NORMS_HEADER.Length; //skip header (header unused for now)
- int maxDoc = MaxDoc();
+ int maxDoc = MaxDoc;
for (int i = 0; i < core.fieldInfos.Size(); i++)
{
FieldInfo fi = core.fieldInfos.FieldInfo(i);
@@ -1578,25 +1588,21 @@ namespace Lucene.Net.Index
return termVectorsReader.Get(docNumber);
}
-
- /// <summary> Return the name of the segment this reader is reading.</summary>
- public virtual System.String GetSegmentName()
- {
- return core.segment;
- }
-
- /// <summary> Return the SegmentInfo of the segment this reader is reading.</summary>
- internal virtual SegmentInfo GetSegmentInfo()
- {
- return si;
- }
-
- internal virtual void SetSegmentInfo(SegmentInfo info)
- {
- si = info;
- }
-
- internal virtual void StartCommit()
+
+ /// <summary> Return the name of the segment this reader is reading.</summary>
+ public virtual string SegmentName
+ {
+ get { return core.segment; }
+ }
+
+ /// <summary> Return the SegmentInfo of the segment this reader is reading.</summary>
+ internal virtual SegmentInfo SegmentInfo
+ {
+ get { return si; }
+ set { si = value; }
+ }
+
+ internal virtual void StartCommit()
{
rollbackSegmentInfo = (SegmentInfo)si.Clone();
rollbackHasChanges = hasChanges;
@@ -1634,23 +1640,24 @@ namespace Lucene.Net.Index
// This is necessary so that cloned SegmentReaders (which
// share the underlying postings data) will map to the
// same entry in the FieldCache. See LUCENE-1579.
- public override System.Object GetFieldCacheKey()
- {
- return core.freqStream;
- }
- public override object GetDeletesCacheKey()
- {
- return deletedDocs;
- }
+ public override object FieldCacheKey
+ {
+ get { return core.freqStream; }
+ }
+
+ public override object DeletesCacheKey
+ {
+ get { return deletedDocs; }
+ }
+
+
+ public override long UniqueTermCount
+ {
+ get { return core.GetTermsReader().Size(); }
+ }
-
- public override long GetUniqueTermCount()
- {
- return core.GetTermsReader().Size();
- }
-
- /// <summary> Lotsa tests did hacks like:<br/>
+ /// <summary> Lotsa tests did hacks like:<br/>
/// SegmentReader reader = (SegmentReader) IndexReader.open(dir);<br/>
/// They broke. This method serves as a hack to keep hacks working
/// We do it with R/W access for the tests (BW compatibility)
@@ -1668,7 +1675,7 @@ namespace Lucene.Net.Index
if (reader is DirectoryReader)
{
- IndexReader[] subReaders = reader.GetSequentialSubReaders();
+ IndexReader[] subReaders = reader.SequentialSubReaders;
if (subReaders.Length != 1)
{
throw new System.ArgumentException(reader + " has " + subReaders.Length + " segments instead of exactly one");
@@ -1679,13 +1686,13 @@ namespace Lucene.Net.Index
throw new System.ArgumentException(reader + " is not a SegmentReader or a single-segment DirectoryReader");
}
-
- public override int GetTermInfosIndexDivisor()
- {
- return core.termsIndexDivisor;
- }
-
- public System.Collections.Generic.IDictionary<string, Norm> norms_ForNUnit
+
+ public override int TermInfosIndexDivisor
+ {
+ get { return core.termsIndexDivisor; }
+ }
+
+ public System.Collections.Generic.IDictionary<string, Norm> norms_ForNUnit
{
get { return norms; }
}
Modified: incubator/lucene.net/trunk/src/core/Index/SegmentTermPositions.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/SegmentTermPositions.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/SegmentTermPositions.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/SegmentTermPositions.cs Mon Mar 12 22:29:26 2012
@@ -146,7 +146,7 @@ namespace Lucene.Net.Index
{
if (needToLoadPayload && payloadLength > 0)
{
- proxStream.Seek(proxStream.GetFilePointer() + payloadLength);
+ proxStream.Seek(proxStream.FilePointer + payloadLength);
}
needToLoadPayload = false;
}
@@ -185,13 +185,13 @@ namespace Lucene.Net.Index
lazySkipProxCount = 0;
}
}
-
- public int GetPayloadLength()
- {
- return payloadLength;
- }
-
- public byte[] GetPayload(byte[] data, int offset)
+
+ public int PayloadLength
+ {
+ get { return payloadLength; }
+ }
+
+ public byte[] GetPayload(byte[] data, int offset)
{
if (!needToLoadPayload)
{
@@ -217,10 +217,10 @@ namespace Lucene.Net.Index
needToLoadPayload = false;
return retArray;
}
-
- public bool IsPayloadAvailable()
- {
- return needToLoadPayload && payloadLength > 0;
- }
+
+ public bool IsPayloadAvailable
+ {
+ get { return needToLoadPayload && payloadLength > 0; }
+ }
}
}
\ No newline at end of file
Modified: incubator/lucene.net/trunk/src/core/Index/SnapshotDeletionPolicy.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/SnapshotDeletionPolicy.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/SnapshotDeletionPolicy.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/SnapshotDeletionPolicy.cs Mon Mar 12 22:29:26 2012
@@ -91,7 +91,7 @@ namespace Lucene.Net.Index
}
if (snapshot == null)
- snapshot = lastCommit.GetSegmentsFileName();
+ snapshot = lastCommit.SegmentsFileName;
else
throw new System.SystemException("snapshot is already set; please call release() first");
return lastCommit;
@@ -137,46 +137,53 @@ namespace Lucene.Net.Index
return "SnapshotDeletionPolicy.SnapshotCommitPoint(" + cp + ")";
}
- public override System.String GetSegmentsFileName()
- {
- return cp.GetSegmentsFileName();
- }
- public override ICollection<string> GetFileNames()
- {
- return cp.GetFileNames();
- }
- public override Directory GetDirectory()
- {
- return cp.GetDirectory();
- }
- public override void Delete()
+ public override string SegmentsFileName
+ {
+ get { return cp.SegmentsFileName; }
+ }
+
+ public override ICollection<string> FileNames
+ {
+ get { return cp.FileNames; }
+ }
+
+ public override Directory Directory
+ {
+ get { return cp.Directory; }
+ }
+
+ public override void Delete()
{
lock (Enclosing_Instance)
{
// Suppress the delete request if this commit point is
// our current snapshot.
- if (Enclosing_Instance.snapshot == null || !Enclosing_Instance.snapshot.Equals(GetSegmentsFileName()))
+ if (Enclosing_Instance.snapshot == null || !Enclosing_Instance.snapshot.Equals(SegmentsFileName))
cp.Delete();
}
}
- public override bool IsDeleted()
- {
- return cp.IsDeleted();
- }
- public override long GetVersion()
- {
- return cp.GetVersion();
- }
- public override long GetGeneration()
- {
- return cp.GetGeneration();
- }
- public override IDictionary<string, string> GetUserData()
- {
- return cp.GetUserData();
- }
- public override bool IsOptimized()
+ public override bool IsDeleted
+ {
+ get { return cp.IsDeleted; }
+ }
+
+ public override long Version
+ {
+ get { return cp.Version; }
+ }
+
+ public override long Generation
+ {
+ get { return cp.Generation; }
+ }
+
+ public override IDictionary<string, string> UserData
+ {
+ get { return cp.UserData; }
+ }
+
+ public override bool IsOptimized()
{
return cp.IsOptimized();
}
Modified: incubator/lucene.net/trunk/src/core/Index/SortedTermVectorMapper.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/SortedTermVectorMapper.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/SortedTermVectorMapper.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/SortedTermVectorMapper.cs Mon Mar 12 22:29:26 2012
@@ -75,10 +75,10 @@ namespace Lucene.Net.Index
}
else
{
- entry.SetFrequency(entry.GetFrequency() + frequency);
+ entry.Frequency = entry.Frequency + frequency;
if (storeOffsets)
{
- TermVectorOffsetInfo[] existingOffsets = entry.GetOffsets();
+ TermVectorOffsetInfo[] existingOffsets = entry.Offsets;
//A few diff. cases here: offsets is null, existing offsets is null, both are null, same for positions
if (existingOffsets != null && offsets != null && offsets.Length > 0)
{
@@ -86,27 +86,27 @@ namespace Lucene.Net.Index
TermVectorOffsetInfo[] newOffsets = new TermVectorOffsetInfo[existingOffsets.Length + offsets.Length];
Array.Copy(existingOffsets, 0, newOffsets, 0, existingOffsets.Length);
Array.Copy(offsets, 0, newOffsets, existingOffsets.Length, offsets.Length);
- entry.SetOffsets(newOffsets);
+ entry.Offsets = newOffsets;
}
else if (existingOffsets == null && offsets != null && offsets.Length > 0)
{
- entry.SetOffsets(offsets);
+ entry.Offsets = offsets;
}
//else leave it alone
}
if (storePositions)
{
- int[] existingPositions = entry.GetPositions();
+ int[] existingPositions = entry.Positions;
if (existingPositions != null && positions != null && positions.Length > 0)
{
int[] newPositions = new int[existingPositions.Length + positions.Length];
Array.Copy(existingPositions, 0, newPositions, 0, existingPositions.Length);
Array.Copy(positions, 0, newPositions, existingPositions.Length, positions.Length);
- entry.SetPositions(newPositions);
+ entry.Positions = newPositions;
}
else if (existingPositions == null && positions != null && positions.Length > 0)
{
- entry.SetPositions(positions);
+ entry.Positions = positions;
}
}
}
@@ -118,17 +118,16 @@ namespace Lucene.Net.Index
this.storeOffsets = storeOffsets;
this.storePositions = storePositions;
}
-
- /// <summary> The TermVectorEntrySet. A SortedSet of <see cref="TermVectorEntry" /> objects. Sort is by the comparator passed into the constructor.
- /// <br/>
- /// This set will be empty until after the mapping process takes place.
- ///
- /// </summary>
- /// <returns> The SortedSet of <see cref="TermVectorEntry" />.
- /// </returns>
- public virtual SortedSet<TermVectorEntry> GetTermVectorEntrySet()
- {
- return currentSet;
- }
+
+ /// <summary> The TermVectorEntrySet. A SortedSet of <see cref="TermVectorEntry" /> objects. Sort is by the comparator passed into the constructor.
+ /// <br/>
+ /// This set will be empty until after the mapping process takes place.
+ ///
+ /// </summary>
+ /// <value> The SortedSet of <see cref="TermVectorEntry" />. </value>
+ public virtual SortedSet<TermVectorEntry> TermVectorEntrySet
+ {
+ get { return currentSet; }
+ }
}
}
\ No newline at end of file
Modified: incubator/lucene.net/trunk/src/core/Index/StoredFieldsWriter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/StoredFieldsWriter.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/StoredFieldsWriter.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/StoredFieldsWriter.cs Mon Mar 12 22:29:26 2012
@@ -65,7 +65,7 @@ namespace Lucene.Net.Index
// Fill fdx file to include any final docs that we
// skipped because they hit non-aborting exceptions
- Fill(state.numDocsInStore - docWriter.GetDocStoreOffset());
+ Fill(state.numDocsInStore - docWriter.DocStoreOffset);
}
if (fieldsWriter != null)
@@ -77,7 +77,7 @@ namespace Lucene.Net.Index
{
if (fieldsWriter == null)
{
- System.String docStoreSegment = docWriter.GetDocStoreSegment();
+ System.String docStoreSegment = docWriter.DocStoreSegment;
if (docStoreSegment != null)
{
System.Diagnostics.Debug.Assert(docStoreSegment != null);
@@ -97,7 +97,7 @@ namespace Lucene.Net.Index
if (inc > 0)
{
InitFieldsWriter();
- Fill(state.numDocsInStore - docWriter.GetDocStoreOffset());
+ Fill(state.numDocsInStore - docWriter.DocStoreOffset);
}
if (fieldsWriter != null)
@@ -166,7 +166,7 @@ namespace Lucene.Net.Index
/// <summary>Fills in any hole in the docIDs </summary>
internal void Fill(int docID)
{
- int docStoreOffset = docWriter.GetDocStoreOffset();
+ int docStoreOffset = docWriter.DocStoreOffset;
// We must "catch up" for all docs before us
// that had no stored fields:
@@ -207,8 +207,8 @@ namespace Lucene.Net.Index
{
System.Diagnostics.Debug.Assert(freeCount < docFreeList.Length);
System.Diagnostics.Debug.Assert(0 == perDoc.numStoredFields);
- System.Diagnostics.Debug.Assert(0 == perDoc.fdt.Length());
- System.Diagnostics.Debug.Assert(0 == perDoc.fdt.GetFilePointer());
+ System.Diagnostics.Debug.Assert(0 == perDoc.fdt.Length);
+ System.Diagnostics.Debug.Assert(0 == perDoc.fdt.FilePointer);
docFreeList[freeCount++] = perDoc;
}
}
@@ -254,7 +254,7 @@ namespace Lucene.Net.Index
public override long SizeInBytes()
{
- return buffer.GetSizeInBytes();
+ return buffer.SizeInBytes;
}
public override void Finish()
Modified: incubator/lucene.net/trunk/src/core/Index/StoredFieldsWriterPerThread.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/StoredFieldsWriterPerThread.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/StoredFieldsWriterPerThread.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/StoredFieldsWriterPerThread.cs Mon Mar 12 22:29:26 2012
@@ -16,8 +16,7 @@
*/
using System;
-
-using Fieldable = Lucene.Net.Documents.Fieldable;
+using Lucene.Net.Documents;
using IndexOutput = Lucene.Net.Store.IndexOutput;
namespace Lucene.Net.Index
@@ -51,7 +50,7 @@ namespace Lucene.Net.Index
}
}
- public void AddField(Fieldable field, FieldInfo fieldInfo)
+ public void AddField(IFieldable field, FieldInfo fieldInfo)
{
if (doc == null)
{
@@ -59,8 +58,8 @@ namespace Lucene.Net.Index
doc.docID = docState.docID;
localFieldsWriter.SetFieldsStream(doc.fdt);
System.Diagnostics.Debug.Assert(doc.numStoredFields == 0, "doc.numStoredFields=" + doc.numStoredFields);
- System.Diagnostics.Debug.Assert(0 == doc.fdt.Length());
- System.Diagnostics.Debug.Assert(0 == doc.fdt.GetFilePointer());
+ System.Diagnostics.Debug.Assert(0 == doc.fdt.Length);
+ System.Diagnostics.Debug.Assert(0 == doc.fdt.FilePointer);
}
localFieldsWriter.WriteField(fieldInfo, field);
Modified: incubator/lucene.net/trunk/src/core/Index/TermFreqVector.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/TermFreqVector.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/TermFreqVector.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/TermFreqVector.cs Mon Mar 12 22:29:26 2012
@@ -16,6 +16,7 @@
*/
using System;
+using Lucene.Net.Documents;
namespace Lucene.Net.Index
{
@@ -27,7 +28,7 @@ namespace Lucene.Net.Index
/// </summary>
public interface TermFreqVector
{
- /// <summary> The <see cref="Lucene.Net.Documents.Fieldable" /> name. </summary>
+ /// <summary> The <see cref="IFieldable" /> name. </summary>
/// <returns> The name of the field this vector is associated with.
///
/// </returns>
Modified: incubator/lucene.net/trunk/src/core/Index/TermInfosWriter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/TermInfosWriter.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/TermInfosWriter.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/TermInfosWriter.cs Mon Mar 12 22:29:26 2012
@@ -193,8 +193,8 @@ namespace Lucene.Net.Index
if (isIndex)
{
- output.WriteVLong(other.output.GetFilePointer() - lastIndexPointer);
- lastIndexPointer = other.output.GetFilePointer(); // write pointer
+ output.WriteVLong(other.output.FilePointer - lastIndexPointer);
+ lastIndexPointer = other.output.FilePointer; // write pointer
}
lastFieldNumber = fieldNumber;
Modified: incubator/lucene.net/trunk/src/core/Index/TermPositions.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/TermPositions.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/TermPositions.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/TermPositions.cs Mon Mar 12 22:29:26 2012
@@ -38,16 +38,15 @@ namespace Lucene.Net.Index
/// the first time.
/// </summary>
int NextPosition();
-
- /// <summary> Returns the length of the payload at the current term position.
- /// This is invalid until <see cref="NextPosition()" /> is called for
- /// the first time.<br/>
- /// </summary>
- /// <returns> length of the current payload in number of bytes
- /// </returns>
- int GetPayloadLength();
-
- /// <summary> Returns the payload data at the current term position.
+
+ /// <summary> Returns the length of the payload at the current term position.
+ /// This is invalid until <see cref="NextPosition()" /> is called for
+ /// the first time.<br/>
+ /// </summary>
+ /// <value> length of the current payload in number of bytes </value>
+ int PayloadLength { get; }
+
+ /// <summary> Returns the payload data at the current term position.
/// This is invalid until <see cref="NextPosition()" /> is called for
/// the first time.
/// This method must not be called more than once after each call
@@ -67,15 +66,14 @@ namespace Lucene.Net.Index
/// </returns>
/// <throws> IOException </throws>
byte[] GetPayload(byte[] data, int offset);
-
- /// <summary> Checks if a payload can be loaded at this position.
- /// <p/>
- /// Payloads can only be loaded once per call to
- /// <see cref="NextPosition()" />.
- ///
- /// </summary>
- /// <returns> true if there is a payload available at this position that can be loaded
- /// </returns>
- bool IsPayloadAvailable();
+
+ /// <summary> Checks if a payload can be loaded at this position.
+ /// <p/>
+ /// Payloads can only be loaded once per call to
+ /// <see cref="NextPosition()" />.
+ ///
+ /// </summary>
+ /// <value> true if there is a payload available at this position that can be loaded </value>
+ bool IsPayloadAvailable { get; }
}
}
\ No newline at end of file
Modified: incubator/lucene.net/trunk/src/core/Index/TermVectorEntry.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/TermVectorEntry.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/TermVectorEntry.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/TermVectorEntry.cs Mon Mar 12 22:29:26 2012
@@ -27,7 +27,7 @@ namespace Lucene.Net.Index
private System.String term;
private int frequency;
private TermVectorOffsetInfo[] offsets;
- internal int[] positions;
+ private int[] positions;
public TermVectorEntry()
@@ -42,50 +42,36 @@ namespace Lucene.Net.Index
this.offsets = offsets;
this.positions = positions;
}
-
-
- public virtual System.String GetField()
- {
- return field;
- }
-
- public virtual int GetFrequency()
- {
- return frequency;
- }
-
- public virtual TermVectorOffsetInfo[] GetOffsets()
- {
- return offsets;
- }
-
- public virtual int[] GetPositions()
- {
- return positions;
- }
-
- public virtual System.String GetTerm()
- {
- return term;
- }
-
- //Keep package local
- internal virtual void SetFrequency(int frequency)
- {
- this.frequency = frequency;
- }
-
- internal virtual void SetOffsets(TermVectorOffsetInfo[] offsets)
- {
- this.offsets = offsets;
- }
-
- internal virtual void SetPositions(int[] positions)
- {
- this.positions = positions;
- }
-
-
+
+
+ public virtual string Field
+ {
+ get { return field; }
+ }
+
+ public virtual int Frequency
+ {
+ get { return frequency; }
+ internal set { this.frequency = value; }
+ }
+
+ public virtual TermVectorOffsetInfo[] Offsets
+ {
+ get { return offsets; }
+ internal set { offsets = value; }
+ }
+
+ public virtual int[] Positions
+ {
+ get { return positions; }
+ internal set { positions = value; }
+ }
+
+ public virtual string Term
+ {
+ get { return term; }
+ }
+
public override bool Equals(System.Object o)
{
if (this == o)
Modified: incubator/lucene.net/trunk/src/core/Index/TermVectorEntryFreqSortedComparator.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/TermVectorEntryFreqSortedComparator.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/TermVectorEntryFreqSortedComparator.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/TermVectorEntryFreqSortedComparator.cs Mon Mar 12 22:29:26 2012
@@ -30,13 +30,13 @@ namespace Lucene.Net.Index
public virtual int Compare(TermVectorEntry entry, TermVectorEntry entry1)
{
int result = 0;
- result = entry1.GetFrequency() - entry.GetFrequency();
+ result = entry1.Frequency - entry.Frequency;
if (result == 0)
{
- result = String.CompareOrdinal(entry.GetTerm(), entry1.GetTerm());
+ result = String.CompareOrdinal(entry.Term, entry1.Term);
if (result == 0)
{
- result = String.CompareOrdinal(entry.GetField(), entry1.GetField());
+ result = String.CompareOrdinal(entry.Field, entry1.Field);
}
}
return result;