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/21 07:04:35 UTC
svn commit: r1303294 [3/6] - in /incubator/lucene.net/trunk:
src/contrib/Analyzers/AR/ src/contrib/Analyzers/BR/
src/contrib/Analyzers/CJK/ src/contrib/Analyzers/Cn/
src/contrib/Analyzers/Compound/ src/contrib/Analyzers/Cz/
src/contrib/Analyzers/De/ sr...
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=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/SegmentInfo.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/SegmentInfo.cs Wed Mar 21 06:04:26 2012
@@ -391,8 +391,9 @@ namespace Lucene.Net.Index
return si;
}
-
- public System.String GetDelFileName()
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
+ public System.String GetDelFileName()
{
if (delGen == NO)
{
@@ -554,35 +555,38 @@ namespace Lucene.Net.Index
/// <summary> Returns true if this segment is stored as a compound
/// file; else, false.
/// </summary>
- public bool UseCompoundFile
+ internal void SetUseCompoundFile(bool value)
{
- get
+ if (value)
{
- if (isCompoundFile == NO)
- {
- return false;
- }
- if (isCompoundFile == YES)
- {
- return true;
- }
- return dir.FileExists(name + "." + IndexFileNames.COMPOUND_FILE_EXTENSION);
+ this.isCompoundFile = (sbyte) (YES);
}
- internal set
+ else
{
- if (value)
- {
- this.isCompoundFile = (sbyte) (YES);
- }
- else
- {
- this.isCompoundFile = (sbyte) (NO);
- }
- ClearFiles();
+ this.isCompoundFile = (sbyte) (NO);
+ }
+ ClearFiles();
+ }
+
+ /// <summary> Returns true if this segment is stored as a compound
+ /// file; else, false.
+ /// </summary>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
+ public bool GetUseCompoundFile()
+ {
+ if (isCompoundFile == NO)
+ {
+ return false;
+ }
+ if (isCompoundFile == YES)
+ {
+ return true;
}
+ return dir.FileExists(name + "." + IndexFileNames.COMPOUND_FILE_EXTENSION);
}
- public int GetDelCount()
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
+ public int GetDelCount()
{
if (delCount == - 1)
{
@@ -701,7 +705,7 @@ namespace Lucene.Net.Index
var fileList = new System.Collections.Generic.List<string>();
- bool useCompoundFile = UseCompoundFile;
+ bool useCompoundFile = GetUseCompoundFile();
if (useCompoundFile)
{
@@ -828,7 +832,7 @@ namespace Lucene.Net.Index
System.String cfs;
try
{
- if (UseCompoundFile)
+ if (GetUseCompoundFile())
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=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/SegmentInfos.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/SegmentInfos.cs Wed Mar 21 06:04:26 2012
@@ -236,7 +236,8 @@ namespace Lucene.Net.Index
/// <summary> Get the next segments_N filename that will be written.</summary>
- public System.String GetNextSegmentFileName()
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
+ public System.String GetNextSegmentFileName()
{
long nextGeneration;
@@ -535,12 +536,8 @@ namespace Lucene.Net.Index
/// </summary>
public static int DefaultGenLookaheadCount
{
- set { defaultGenLookaheadCount = value; }
- }
-
- public static int DefaultGenLookahedCount
- {
- get { return defaultGenLookaheadCount; }
+ set { defaultGenLookaheadCount = value; }
+ get { return defaultGenLookaheadCount; }
}
/// <seealso cref="SetInfoStream">
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=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/SegmentMerger.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/SegmentMerger.cs Wed Mar 21 06:04:26 2012
@@ -140,7 +140,7 @@ namespace Lucene.Net.Index
internal SegmentMerger(IndexWriter writer, System.String name, MergePolicy.OneMerge merge)
{
InitBlock();
- directory = writer.GetDirectory();
+ directory = writer.Directory;
segment = name;
if (merge != null)
{
@@ -442,7 +442,7 @@ namespace Lucene.Net.Index
{
foreach(IndexReader reader in readers)
{
- docCount += reader.NumDocs;
+ docCount += reader.GetNumDocs();
}
}
@@ -635,7 +635,7 @@ namespace Lucene.Net.Index
// NOTE: it's very important to first assign to vectors then pass it to
// termVectorsWriter.addAllDocVectors; see LUCENE-1282
- TermFreqVector[] vectors = reader.GetTermFreqVectors(docNum);
+ ITermFreqVector[] vectors = reader.GetTermFreqVectors(docNum);
termVectorsWriter.AddAllDocVectors(vectors);
checkAbort.Work(300);
}
@@ -664,7 +664,7 @@ namespace Lucene.Net.Index
{
// NOTE: it's very important to first assign to vectors then pass it to
// termVectorsWriter.addAllDocVectors; see LUCENE-1282
- TermFreqVector[] vectors = reader.GetTermFreqVectors(docNum);
+ ITermFreqVector[] vectors = reader.GetTermFreqVectors(docNum);
termVectorsWriter.AddAllDocVectors(vectors);
checkAbort.Work(300);
}
@@ -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.GetNumDocs();
}
- base_Renamed += reader.NumDocs;
+ base_Renamed += reader.GetNumDocs();
- System.Diagnostics.Debug.Assert(reader.NumDocs == reader.MaxDoc - smi.delCount);
+ System.Diagnostics.Debug.Assert(reader.GetNumDocs() == reader.MaxDoc - smi.delCount);
if (smi.Next())
queue.Add(smi);
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=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/SegmentReader.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/SegmentReader.cs Wed Mar 21 06:04:26 2012
@@ -114,7 +114,7 @@ namespace Lucene.Net.Index
try
{
Directory dir0 = dir;
- if (si.UseCompoundFile)
+ if (si.GetUseCompoundFile())
{
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.UseCompoundFile)
+ if (si.GetUseCompoundFile())
{
// In some cases, we were originally opened when CFS
// was not used, but then we are asked to open the
@@ -339,7 +339,7 @@ namespace Lucene.Net.Index
System.Diagnostics.Debug.Assert(storeDir != null);
}
}
- else if (si.UseCompoundFile)
+ else if (si.GetUseCompoundFile())
{
// In some cases, we were originally opened when CFS
// was not used, but then we are asked to open doc
@@ -989,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.UseCompoundFile?core.GetCFSReader():Directory(), readBufferSize);
+ clone.OpenNorms(si.GetUseCompoundFile()?core.GetCFSReader():Directory(), readBufferSize);
success = true;
}
@@ -1129,7 +1129,7 @@ namespace Lucene.Net.Index
internal static bool UsesCompoundFile(SegmentInfo si)
{
- return si.UseCompoundFile;
+ return si.GetUseCompoundFile();
}
internal static bool HasSeparateNorms(SegmentInfo si)
@@ -1249,16 +1249,13 @@ namespace Lucene.Net.Index
return 0;
}
- public override int NumDocs
+ public override int GetNumDocs()
{
- get
- {
- // Don't call ensureOpen() here (it could affect performance)
- int n = MaxDoc;
- if (deletedDocs != null)
- n -= deletedDocs.Count();
- return n;
- }
+ // Don't call ensureOpen() here (it could affect performance)
+ int n = MaxDoc;
+ if (deletedDocs != null)
+ n -= deletedDocs.Count();
+ return n;
}
public override int MaxDoc
@@ -1528,7 +1525,7 @@ namespace Lucene.Net.Index
/// flag set. If the flag was not set, the method returns null.
/// </summary>
/// <throws> IOException </throws>
- public override TermFreqVector GetTermFreqVector(int docNumber, System.String field)
+ public override ITermFreqVector GetTermFreqVector(int docNumber, System.String field)
{
// Check if this field is invalid or has no stored term vector
EnsureOpen();
@@ -1578,7 +1575,7 @@ namespace Lucene.Net.Index
/// If no such fields existed, the method returns null.
/// </summary>
/// <throws> IOException </throws>
- public override TermFreqVector[] GetTermFreqVectors(int docNumber)
+ public override ITermFreqVector[] GetTermFreqVectors(int docNumber)
{
EnsureOpen();
@@ -1675,7 +1672,7 @@ namespace Lucene.Net.Index
if (reader is DirectoryReader)
{
- IndexReader[] subReaders = reader.SequentialSubReaders;
+ IndexReader[] subReaders = reader.GetSequentialSubReaders();
if (subReaders.Length != 1)
{
throw new System.ArgumentException(reader + " has " + subReaders.Length + " segments instead of exactly one");
Modified: incubator/lucene.net/trunk/src/core/Index/SegmentTermVector.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/SegmentTermVector.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/SegmentTermVector.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/SegmentTermVector.cs Wed Mar 21 06:04:26 2012
@@ -21,7 +21,7 @@ namespace Lucene.Net.Index
{
- class SegmentTermVector : TermFreqVector
+ class SegmentTermVector : ITermFreqVector
{
private System.String field;
private System.String[] terms;
@@ -33,16 +33,15 @@ namespace Lucene.Net.Index
this.terms = terms;
this.termFreqs = termFreqs;
}
-
- /// <summary> </summary>
- /// <returns> The number of the field this vector is associated with
- /// </returns>
- public virtual System.String GetField()
- {
- return field;
- }
-
- public override System.String ToString()
+
+ /// <summary> </summary>
+ /// <value> The number of the field this vector is associated with </value>
+ public virtual string Field
+ {
+ get { return field; }
+ }
+
+ public override System.String ToString()
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append('{');
@@ -60,13 +59,13 @@ namespace Lucene.Net.Index
return sb.ToString();
}
-
- public virtual int Size()
- {
- return terms == null?0:terms.Length;
- }
-
- public virtual System.String[] GetTerms()
+
+ public virtual int Size
+ {
+ get { return terms == null ? 0 : terms.Length; }
+ }
+
+ public virtual System.String[] GetTerms()
{
return terms;
}
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=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/SortedTermVectorMapper.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/SortedTermVectorMapper.cs Wed Mar 21 06:04:26 2012
@@ -78,7 +78,7 @@ namespace Lucene.Net.Index
entry.Frequency = entry.Frequency + frequency;
if (storeOffsets)
{
- TermVectorOffsetInfo[] existingOffsets = entry.Offsets;
+ TermVectorOffsetInfo[] existingOffsets = entry.GetOffsets();
//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.Offsets = newOffsets;
+ entry.SetOffsets(newOffsets);
}
else if (existingOffsets == null && offsets != null && offsets.Length > 0)
{
- entry.Offsets = offsets;
+ entry.SetOffsets(offsets);
}
//else leave it alone
}
if (storePositions)
{
- int[] existingPositions = entry.Positions;
+ int[] existingPositions = entry.GetPositions();
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.Positions = newPositions;
+ entry.SetPositions(newPositions);
}
else if (existingPositions == null && positions != null && positions.Length > 0)
{
- entry.Positions = positions;
+ entry.SetPositions(positions);
}
}
}
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=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/TermFreqVector.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/TermFreqVector.cs Wed Mar 21 06:04:26 2012
@@ -26,19 +26,16 @@ namespace Lucene.Net.Index
/// <see cref="Lucene.Net.Documents.Document" /> and a parallel array of frequencies. Thus, getTermFrequencies()[5] corresponds with the
/// frequency of getTerms()[5], assuming there are at least 5 terms in the Document.
/// </summary>
- public interface TermFreqVector
+ public interface ITermFreqVector
{
- /// <summary> The <see cref="IFieldable" /> name. </summary>
- /// <returns> The name of the field this vector is associated with.
- ///
- /// </returns>
- System.String GetField();
-
- /// <returns> The number of terms in the term vector.
- /// </returns>
- int Size();
-
- /// <returns> An Array of term texts in ascending order.
+ /// <summary> The <see cref="IFieldable" /> name. </summary>
+ /// <value> The name of the field this vector is associated with. </value>
+ string Field { get; }
+
+ /// <value> The number of terms in the term vector. </value>
+ int Size { get; }
+
+ /// <returns> An Array of term texts in ascending order.
/// </returns>
System.String[] GetTerms();
Modified: incubator/lucene.net/trunk/src/core/Index/TermPositionVector.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/TermPositionVector.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/TermPositionVector.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/TermPositionVector.cs Wed Mar 21 06:04:26 2012
@@ -24,7 +24,7 @@ namespace Lucene.Net.Index
/// positions in which each of the terms is found. A TermPositionVector not necessarily
/// contains both positions and offsets, but at least one of these arrays exists.
/// </summary>
- public interface TermPositionVector:TermFreqVector
+ public interface TermPositionVector:ITermFreqVector
{
/// <summary>Returns an array of positions in which the term is found.
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=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/TermVectorEntry.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/TermVectorEntry.cs Wed Mar 21 06:04:26 2012
@@ -55,16 +55,24 @@ namespace Lucene.Net.Index
internal set { this.frequency = value; }
}
- public virtual TermVectorOffsetInfo[] Offsets
+ internal virtual void SetOffsets(TermVectorOffsetInfo[] value)
{
- get { return offsets; }
- internal set { offsets = value; }
+ offsets = value;
}
- public virtual int[] Positions
+ public virtual TermVectorOffsetInfo[] GetOffsets()
{
- get { return positions; }
- internal set { positions = value; }
+ return offsets;
+ }
+
+ internal virtual void SetPositions(int[] value)
+ {
+ positions = value;
+ }
+
+ public virtual int[] GetPositions()
+ {
+ return positions;
}
public virtual string Term
Modified: incubator/lucene.net/trunk/src/core/Index/TermVectorMapper.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/TermVectorMapper.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/TermVectorMapper.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/TermVectorMapper.cs Wed Mar 21 06:04:26 2012
@@ -75,29 +75,27 @@ namespace Lucene.Net.Index
/// <param name="positions">null if the position is not specified, otherwise the position in the field of the term
/// </param>
public abstract void Map(System.String term, int frequency, TermVectorOffsetInfo[] offsets, int[] positions);
-
- /// <summary> Indicate to Lucene that even if there are positions stored, this mapper is not interested in them and they
- /// can be skipped over. Derived classes should set this to true if they want to ignore positions. The default
- /// is false, meaning positions will be loaded if they are stored.
- /// </summary>
- /// <returns> false
- /// </returns>
- public virtual bool IsIgnoringPositions()
- {
- return ignoringPositions;
- }
-
- /// <summary> </summary>
- /// <seealso cref="IsIgnoringPositions()"> Same principal as <see cref="IsIgnoringPositions()" />, but applied to offsets. false by default.
- /// </seealso>
- /// <returns> false
- /// </returns>
- public virtual bool IsIgnoringOffsets()
- {
- return ignoringOffsets;
- }
-
- /// <summary> Passes down the index of the document whose term vector is currently being mapped,
+
+ /// <summary> Indicate to Lucene that even if there are positions stored, this mapper is not interested in them and they
+ /// can be skipped over. Derived classes should set this to true if they want to ignore positions. The default
+ /// is false, meaning positions will be loaded if they are stored.
+ /// </summary>
+ /// <value> false </value>
+ public virtual bool IsIgnoringPositions
+ {
+ get { return ignoringPositions; }
+ }
+
+ /// <summary> </summary>
+ /// <seealso cref="IsIgnoringPositions()"> Same principal as <see cref="IsIgnoringPositions()" />, but applied to offsets. false by default.
+ /// </seealso>
+ /// <value> false </value>
+ public virtual bool IsIgnoringOffsets
+ {
+ get { return ignoringOffsets; }
+ }
+
+ /// <summary> Passes down the index of the document whose term vector is currently being mapped,
/// once for each top level call to a term vector reader.
/// <p/>
/// Default implementation IGNORES the document number. Override if your implementation needs the document number.
Modified: incubator/lucene.net/trunk/src/core/Index/TermVectorsReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/TermVectorsReader.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/TermVectorsReader.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/TermVectorsReader.cs Wed Mar 21 06:04:26 2012
@@ -342,8 +342,8 @@ namespace Lucene.Net.Index
position = tvd.ReadVLong();
for (int i = 1; i <= found; i++)
position += tvd.ReadVLong();
-
- mapper.SetDocumentNumber(docNum);
+
+ mapper.SetDocumentNumber(docNum);
ReadTermVector(field, position, mapper);
}
else
@@ -367,7 +367,7 @@ namespace Lucene.Net.Index
/// <returns> The TermFreqVector for the document and field or null if there is no termVector for this field.
/// </returns>
/// <throws> IOException if there is an error reading the term vector files </throws>
- public /*internal*/ virtual TermFreqVector Get(int docNum, System.String field)
+ public /*internal*/ virtual ITermFreqVector Get(int docNum, System.String field)
{
// Check if no term vectors are available for this segment at all
ParallelArrayTermVectorMapper mapper = new ParallelArrayTermVectorMapper();
@@ -427,9 +427,9 @@ namespace Lucene.Net.Index
/// <returns> All term frequency vectors
/// </returns>
/// <throws> IOException if there is an error reading the term vector files </throws>
- public /*internal*/ virtual TermFreqVector[] Get(int docNum)
+ public /*internal*/ virtual ITermFreqVector[] Get(int docNum)
{
- TermFreqVector[] result = null;
+ ITermFreqVector[] result = null;
if (tvx != null)
{
//We need to offset by
@@ -488,7 +488,7 @@ namespace Lucene.Net.Index
SegmentTermVector[] res = new SegmentTermVector[fields.Length];
for (int i = 0; i < fields.Length; i++)
{
- ParallelArrayTermVectorMapper mapper = new ParallelArrayTermVectorMapper();
+ var mapper = new ParallelArrayTermVectorMapper();
mapper.SetDocumentNumber(docNum);
ReadTermVector(fields[i], tvfPointers[i], mapper);
res[i] = (SegmentTermVector) mapper.MaterializeVector();
@@ -599,7 +599,7 @@ namespace Lucene.Net.Index
{
//read in the positions
//does the mapper even care about positions?
- if (mapper.IsIgnoringPositions() == false)
+ if (mapper.IsIgnoringPositions == false)
{
positions = new int[freq];
int prevPosition = 0;
@@ -623,7 +623,7 @@ namespace Lucene.Net.Index
if (storeOffsets)
{
//does the mapper even care about offsets?
- if (mapper.IsIgnoringOffsets() == false)
+ if (mapper.IsIgnoringOffsets == false)
{
offsets = new TermVectorOffsetInfo[freq];
int prevOffset = 0;
@@ -709,9 +709,9 @@ namespace Lucene.Net.Index
}
/// <summary> Construct the vector</summary>
- /// <returns> The <see cref="TermFreqVector" /> based on the mappings.
+ /// <returns> The <see cref="ITermFreqVector" /> based on the mappings.
/// </returns>
- public virtual TermFreqVector MaterializeVector()
+ public virtual ITermFreqVector MaterializeVector()
{
SegmentTermVector tv = null;
if (field != null && terms != null)
Modified: incubator/lucene.net/trunk/src/core/Index/TermVectorsTermsWriterPerField.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/TermVectorsTermsWriterPerField.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/TermVectorsTermsWriterPerField.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/TermVectorsTermsWriterPerField.cs Wed Mar 21 06:04:26 2012
@@ -243,8 +243,8 @@ namespace Lucene.Net.Index
if (doVectorOffsets)
{
- int startOffset = fieldState.offset + offsetAttribute.StartOffset(); ;
- int endOffset = fieldState.offset + offsetAttribute.EndOffset();
+ int startOffset = fieldState.offset + offsetAttribute.StartOffset; ;
+ int endOffset = fieldState.offset + offsetAttribute.EndOffset;
termsHashPerField.WriteVInt(1, startOffset);
termsHashPerField.WriteVInt(1, endOffset - startOffset);
@@ -268,8 +268,8 @@ namespace Lucene.Net.Index
if (doVectorOffsets)
{
- int startOffset = fieldState.offset + offsetAttribute.StartOffset(); ;
- int endOffset = fieldState.offset + offsetAttribute.EndOffset();
+ int startOffset = fieldState.offset + offsetAttribute.StartOffset; ;
+ int endOffset = fieldState.offset + offsetAttribute.EndOffset;
termsHashPerField.WriteVInt(1, startOffset - p.lastOffset);
termsHashPerField.WriteVInt(1, endOffset - startOffset);
Modified: incubator/lucene.net/trunk/src/core/Index/TermVectorsWriter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Index/TermVectorsWriter.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Index/TermVectorsWriter.cs (original)
+++ incubator/lucene.net/trunk/src/core/Index/TermVectorsWriter.cs Wed Mar 21 06:04:26 2012
@@ -51,7 +51,7 @@ namespace Lucene.Net.Index
/// <param name="vectors">
/// </param>
/// <throws> IOException </throws>
- public void AddAllDocVectors(TermFreqVector[] vectors)
+ public void AddAllDocVectors(ITermFreqVector[] vectors)
{
tvx.WriteLong(tvd.FilePointer);
@@ -68,12 +68,12 @@ namespace Lucene.Net.Index
{
fieldPointers[i] = tvf.FilePointer;
- int fieldNumber = fieldInfos.FieldNumber(vectors[i].GetField());
+ int fieldNumber = fieldInfos.FieldNumber(vectors[i].Field);
// 1st pass: write field numbers to tvd
tvd.WriteVInt(fieldNumber);
- int numTerms = vectors[i].Size();
+ int numTerms = vectors[i].Size;
tvf.WriteVInt(numTerms);
TermPositionVector tpVector;
@@ -86,8 +86,8 @@ namespace Lucene.Net.Index
{
// May have positions & offsets
tpVector = (TermPositionVector) vectors[i];
- storePositions = tpVector.Size() > 0 && tpVector.GetTermPositions(0) != null;
- storeOffsets = tpVector.Size() > 0 && tpVector.GetOffsets(0) != null;
+ storePositions = tpVector.Size > 0 && tpVector.GetTermPositions(0) != null;
+ storeOffsets = tpVector.Size > 0 && tpVector.GetOffsets(0) != null;
bits = (byte) ((storePositions?TermVectorsReader.STORE_POSITIONS_WITH_TERMVECTOR: (byte) 0) + (storeOffsets?TermVectorsReader.STORE_OFFSET_WITH_TERMVECTOR: (byte) 0));
}
else
Modified: incubator/lucene.net/trunk/src/core/Messages/Message.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Messages/Message.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Messages/Message.cs (original)
+++ incubator/lucene.net/trunk/src/core/Messages/Message.cs Wed Mar 21 06:04:26 2012
@@ -27,7 +27,7 @@ namespace Lucene.Net.Messages
{
string Key { get; }
- object[] Arguments { get; }
+ object[] GetArguments();
System.String GetLocalizedMessage();
Modified: incubator/lucene.net/trunk/src/core/Messages/MessageImpl.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Messages/MessageImpl.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Messages/MessageImpl.cs (original)
+++ incubator/lucene.net/trunk/src/core/Messages/MessageImpl.cs Wed Mar 21 06:04:26 2012
@@ -44,9 +44,9 @@ namespace Lucene.Net.Messages
this.arguments = args;
}
- public virtual object[] Arguments
+ public virtual object[] GetArguments()
{
- get { return this.arguments; }
+ return this.arguments;
}
public virtual string Key
@@ -61,12 +61,12 @@ namespace Lucene.Net.Messages
public virtual System.String GetLocalizedMessage(System.Globalization.CultureInfo locale)
{
- return NLS.GetLocalizedMessage(Key, locale, Arguments);
+ return NLS.GetLocalizedMessage(Key, locale, GetArguments());
}
public override System.String ToString()
{
- System.Object[] args = Arguments;
+ System.Object[] args = GetArguments();
StringBuilder argsString = new StringBuilder();
if (args != null)
{
Modified: incubator/lucene.net/trunk/src/core/QueryParser/CharStream.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/QueryParser/CharStream.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/QueryParser/CharStream.cs (original)
+++ incubator/lucene.net/trunk/src/core/QueryParser/CharStream.cs Wed Mar 21 06:04:26 2012
@@ -48,18 +48,18 @@ namespace Lucene.Net.QueryParsers
/// <summary> Returns the column position of the character last read.</summary>
/// <deprecated>
/// </deprecated>
- /// <seealso cref="GetEndColumn">
+ /// <seealso cref="EndColumn">
/// </seealso>
[Obsolete]
int Column { get; }
/// <summary> Returns the line number of the character last read.</summary>
- /// <deprecated>
- /// </deprecated>
- /// <seealso cref="GetEndLine">
- /// </seealso>
- [Obsolete]
- int GetLine();
+ /// <deprecated>
+ /// </deprecated>
+ /// <seealso cref="EndLine">
+ /// </seealso>
+ [Obsolete]
+ int Line { get; }
/// <summary> Returns the column number of the last character for current token (being
/// matched after the last call to BeginTOken).
Modified: incubator/lucene.net/trunk/src/core/QueryParser/FastCharStream.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/QueryParser/FastCharStream.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/QueryParser/FastCharStream.cs (original)
+++ incubator/lucene.net/trunk/src/core/QueryParser/FastCharStream.cs Wed Mar 21 06:04:26 2012
@@ -131,10 +131,10 @@ namespace Lucene.Net.QueryParsers
get { return bufferStart + bufferPosition; }
}
- public int GetLine()
- {
- return 1;
- }
+ public int Line
+ {
+ get { return 1; }
+ }
public int EndColumn
{
Modified: incubator/lucene.net/trunk/src/core/QueryParser/QueryParser.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/QueryParser/QueryParser.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/QueryParser/QueryParser.cs (original)
+++ incubator/lucene.net/trunk/src/core/QueryParser/QueryParser.cs Wed Mar 21 06:04:26 2012
@@ -2037,7 +2037,8 @@ label_1_brk: ; // {{Aroush-2.9}} this l
/// <summary>Get the next Token. </summary>
- public Token GetNextToken()
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
+ public Token GetNextToken()
{
if (token.next != null)
token = token.next;
Modified: incubator/lucene.net/trunk/src/core/QueryParser/QueryParserTokenManager.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/QueryParser/QueryParserTokenManager.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/QueryParser/QueryParserTokenManager.cs (original)
+++ incubator/lucene.net/trunk/src/core/QueryParser/QueryParserTokenManager.cs Wed Mar 21 06:04:26 2012
@@ -1333,7 +1333,8 @@ namespace Lucene.Net.QueryParsers
internal int jjmatchedKind;
/// <summary>Get the next Token. </summary>
- public virtual Token GetNextToken()
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
+ public virtual Token GetNextToken()
{
Token matchedToken;
int curPos = 0;
Modified: incubator/lucene.net/trunk/src/core/Search/BooleanClause.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/BooleanClause.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/BooleanClause.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/BooleanClause.cs Wed Mar 21 06:04:26 2012
@@ -25,42 +25,41 @@ namespace Lucene.Net.Search
/// <summary>A clause in a BooleanQuery. </summary>
[Serializable]
public class BooleanClause
- {
-
- /// <summary>Specifies how clauses are to occur in matching documents. </summary>
- [Serializable]
- public sealed class Occur:Parameter
- {
-
- internal Occur(System.String name):base(name)
- {
- }
-
- public override System.String ToString()
- {
- if (this == MUST)
- return "+";
- if (this == MUST_NOT)
- return "-";
- return "";
- }
-
- /// <summary>Use this operator for clauses that <i>must</i> appear in the matching documents. </summary>
- public static readonly Occur MUST = new Occur("MUST");
- /// <summary>Use this operator for clauses that <i>should</i> appear in the
- /// matching documents. For a BooleanQuery with no <c>MUST</c>
- /// clauses one or more <c>SHOULD</c> clauses must match a document
- /// for the BooleanQuery to match.
- /// </summary>
- /// <seealso cref="BooleanQuery.SetMinimumNumberShouldMatch">
- /// </seealso>
- public static readonly Occur SHOULD = new Occur("SHOULD");
- /// <summary>Use this operator for clauses that <i>must not</i> appear in the matching documents.
- /// Note that it is not possible to search for queries that only consist
- /// of a <c>MUST_NOT</c> clause.
- /// </summary>
- public static readonly Occur MUST_NOT = new Occur("MUST_NOT");
- }
+ {
+ /// <summary>Specifies how clauses are to occur in matching documents. </summary>
+ [Serializable]
+ public sealed class Occur : Parameter
+ {
+ internal Occur(System.String name)
+ : base(name)
+ {
+ }
+
+ public override System.String ToString()
+ {
+ if (this == MUST)
+ return "+";
+ if (this == MUST_NOT)
+ return "-";
+ return "";
+ }
+
+ /// <summary>Use this operator for clauses that <i>must</i> appear in the matching documents. </summary>
+ public static readonly Occur MUST = new Occur("MUST");
+ /// <summary>Use this operator for clauses that <i>should</i> appear in the
+ /// matching documents. For a BooleanQuery with no <c>MUST</c>
+ /// clauses one or more <c>SHOULD</c> clauses must match a document
+ /// for the BooleanQuery to match.
+ /// </summary>
+ /// <seealso cref="BooleanQuery.SetMinimumNumberShouldMatch">
+ /// </seealso>
+ public static readonly Occur SHOULD = new Occur("SHOULD");
+ /// <summary>Use this operator for clauses that <i>must not</i> appear in the matching documents.
+ /// Note that it is not possible to search for queries that only consist
+ /// of a <c>MUST_NOT</c> clause.
+ /// </summary>
+ public static readonly Occur MUST_NOT = new Occur("MUST_NOT");
+ }
private Occur occur;
Modified: incubator/lucene.net/trunk/src/core/Search/BooleanQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/BooleanQuery.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/BooleanQuery.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/BooleanQuery.cs Wed Mar 21 06:04:26 2012
@@ -78,48 +78,23 @@ namespace Lucene.Net.Search
}
}
- /// <summary>Gets or sets the maximum number of clauses permitted, 1024 by default.
- /// <para>
- /// Attempts to add more than the permitted number of clauses cause <see cref="TooManyClauses" />
- /// to be thrown.
- /// </para>
- /// </summary>
- public static int MaxClauses
- {
- get
- {
- return _maxClauses;
- }
-
- set
- {
- if (value < 1)
- throw new ArgumentException("maxClauseCount must be >= 1");
- _maxClauses = value;
- }
- }
- /// <summary>Return the maximum number of clauses permitted, 1024 by default.
- /// Attempts to add more than the permitted number of clauses cause <see cref="TooManyClauses" />
- /// to be thrown.
- /// </summary>
- /// <seealso cref="SetMaxClauseCount(int)" />
- [Obsolete("Use MaxClauseCount property")]
- public static int GetMaxClauseCount()
- {
- return MaxClauses;
- }
-
- /// <summary> Set the maximum number of clauses permitted per BooleanQuery.
- /// Default value is 1024.
- /// </summary>
- [Obsolete("Use MaxClauseCount property")]
- public static void SetMaxClauseCount(int maxClauseCount)
- {
- MaxClauses = maxClauseCount;
- }
-
- private EquatableList<BooleanClause> clauses = new EquatableList<BooleanClause>();
+ /// <summary>Gets or sets the maximum number of clauses permitted, 1024 by default.
+ /// Attempts to add more than the permitted number of clauses cause <see cref="TooManyClauses" />
+ /// to be thrown.
+ /// </summary>
+ public static int MaxClauseCount
+ {
+ get { return _maxClauses; }
+ set
+ {
+ if (value < 1)
+ throw new ArgumentException("maxClauseCount must be >= 1");
+ _maxClauses = value;
+ }
+ }
+
+ private EquatableList<BooleanClause> clauses = new EquatableList<BooleanClause>();
private bool disableCoord;
/// <summary>Constructs an empty boolean query. </summary>
@@ -321,24 +296,21 @@ namespace Lucene.Net.Search
get { return Enclosing_Instance.Boost; }
}
- public override float SumOfSquaredWeights
+ public override float GetSumOfSquaredWeights()
{
- get
+ float sum = 0.0f;
+ for (int i = 0; i < weights.Count; i++)
{
- float sum = 0.0f;
- for (int i = 0; i < weights.Count; i++)
- {
- // call sumOfSquaredWeights for all clauses in case of side effects
- float s = weights[i].SumOfSquaredWeights; // sum sub weights
- if (!Enclosing_Instance.clauses[i].Prohibited)
- // only add to sum for non-prohibited clauses
- sum += s;
- }
+ // call sumOfSquaredWeights for all clauses in case of side effects
+ float s = weights[i].GetSumOfSquaredWeights(); // sum sub weights
+ if (!Enclosing_Instance.clauses[i].Prohibited)
+ // only add to sum for non-prohibited clauses
+ sum += s;
+ }
- sum *= Enclosing_Instance.Boost*Enclosing_Instance.Boost; // boost each sub-weight
+ sum *= Enclosing_Instance.Boost*Enclosing_Instance.Boost; // boost each sub-weight
- return sum;
- }
+ return sum;
}
@@ -491,32 +463,29 @@ namespace Lucene.Net.Search
return new BooleanScorer2(similarity, Enclosing_Instance.minNrShouldMatch, required, prohibited, optional);
}
- public override bool ScoresDocsOutOfOrder
+ public override bool GetScoresDocsOutOfOrder()
{
- get
+ int numProhibited = 0;
+ foreach (BooleanClause c in Enclosing_Instance.clauses)
{
- int numProhibited = 0;
- foreach (BooleanClause c in Enclosing_Instance.clauses)
+ if (c.Required)
{
- if (c.Required)
- {
- return false; // BS2 (in-order) will be used by scorer()
- }
- else if (c.Prohibited)
- {
- ++numProhibited;
- }
+ return false; // BS2 (in-order) will be used by scorer()
}
-
- if (numProhibited > 32)
+ else if (c.Prohibited)
{
- // cannot use BS
- return false;
+ ++numProhibited;
}
+ }
- // scorer() will return an out-of-order scorer if requested.
- return true;
+ if (numProhibited > 32)
+ {
+ // cannot use BS
+ return false;
}
+
+ // scorer() will return an out-of-order scorer if requested.
+ return true;
}
}
Modified: incubator/lucene.net/trunk/src/core/Search/BooleanScorer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/BooleanScorer.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/BooleanScorer.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/BooleanScorer.cs Wed Mar 21 06:04:26 2012
@@ -110,11 +110,11 @@ namespace Lucene.Net.Search
{
this.scorer = scorer;
}
-
- public override bool AcceptsDocsOutOfOrder()
- {
- return true;
- }
+
+ public override bool AcceptsDocsOutOfOrder
+ {
+ get { return true; }
+ }
}
// An internal class which is used in score(Collector, int) for setting the
Modified: incubator/lucene.net/trunk/src/core/Search/Collector.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/Collector.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Collector.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Collector.cs Wed Mar 21 06:04:26 2012
@@ -155,22 +155,22 @@ namespace Lucene.Net.Search
/// <param name="docBase">
/// </param>
public abstract void SetNextReader(IndexReader reader, int docBase);
-
- /// <summary>
- /// Return <c>true</c> if this collector does not
- /// require the matching docIDs to be delivered in int sort
- /// order (smallest to largest) to <see cref="Collect" />.
- /// <p/> Most Lucene Query implementations will visit
- /// matching docIDs in order. However, some queries
- /// (currently limited to certain cases of <see cref="BooleanQuery" />)
- /// can achieve faster searching if the
- /// <c>Collector</c> allows them to deliver the
- /// docIDs out of order.
- /// <p/> Many collectors don't mind getting docIDs out of
- /// order, so it's important to return <c>true</c>
- /// here.
- /// </summary>
- /// <returns></returns>
- public abstract bool AcceptsDocsOutOfOrder();
+
+ /// <summary>
+ /// Return <c>true</c> if this collector does not
+ /// require the matching docIDs to be delivered in int sort
+ /// order (smallest to largest) to <see cref="Collect" />.
+ /// <p/> Most Lucene Query implementations will visit
+ /// matching docIDs in order. However, some queries
+ /// (currently limited to certain cases of <see cref="BooleanQuery" />)
+ /// can achieve faster searching if the
+ /// <c>Collector</c> allows them to deliver the
+ /// docIDs out of order.
+ /// <p/> Many collectors don't mind getting docIDs out of
+ /// order, so it's important to return <c>true</c>
+ /// here.
+ /// </summary>
+ /// <value> </value>
+ public abstract bool AcceptsDocsOutOfOrder { get; }
}
}
\ No newline at end of file
Modified: incubator/lucene.net/trunk/src/core/Search/ConstantScoreQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/ConstantScoreQuery.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/ConstantScoreQuery.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/ConstantScoreQuery.cs Wed Mar 21 06:04:26 2012
@@ -88,13 +88,10 @@ namespace Lucene.Net.Search
get { return queryWeight; }
}
- public override float SumOfSquaredWeights
+ public override float GetSumOfSquaredWeights()
{
- get
- {
- queryWeight = Enclosing_Instance.Boost;
- return queryWeight*queryWeight;
- }
+ queryWeight = Enclosing_Instance.Boost;
+ return queryWeight*queryWeight;
}
public override void Normalize(float norm)
Modified: incubator/lucene.net/trunk/src/core/Search/DisjunctionMaxQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/DisjunctionMaxQuery.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/DisjunctionMaxQuery.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/DisjunctionMaxQuery.cs Wed Mar 21 06:04:26 2012
@@ -150,22 +150,19 @@ namespace Lucene.Net.Search
/* Compute the sub of squared weights of us applied to our subqueries. Used for normalization. */
- public override float SumOfSquaredWeights
- {
- get
- {
- float max = 0.0f, sum = 0.0f;
- foreach (Weight currentWeight in weights)
- {
- float sub = currentWeight.SumOfSquaredWeights;
- sum += sub;
- max = System.Math.Max(max, sub);
- }
- float boost = Enclosing_Instance.Boost;
- return (((sum - max)*Enclosing_Instance.tieBreakerMultiplier*Enclosing_Instance.tieBreakerMultiplier) + max)*
- boost*boost;
- }
- }
+ public override float GetSumOfSquaredWeights()
+ {
+ float max = 0.0f, sum = 0.0f;
+ foreach (Weight currentWeight in weights)
+ {
+ float sub = currentWeight.GetSumOfSquaredWeights();
+ sum += sub;
+ max = System.Math.Max(max, sub);
+ }
+ float boost = Enclosing_Instance.Boost;
+ return (((sum - max) * Enclosing_Instance.tieBreakerMultiplier * Enclosing_Instance.tieBreakerMultiplier) + max) *
+ boost * boost;
+ }
/* Apply the computed normalization factor to our subqueries */
public override void Normalize(float norm)
Modified: incubator/lucene.net/trunk/src/core/Search/Explanation.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/Explanation.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Explanation.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Explanation.cs Wed Mar 21 06:04:26 2012
@@ -25,7 +25,7 @@ namespace Lucene.Net.Search
[Serializable]
public class Explanation
{
- private float value_Renamed; // the value of this node
+ private float value; // the value of this node
private System.String description; // what it represents
private List<Explanation> details; // sub-explanations
@@ -33,9 +33,9 @@ namespace Lucene.Net.Search
{
}
- public Explanation(float value_Renamed, System.String description)
+ public Explanation(float value, System.String description)
{
- this.value_Renamed = value_Renamed;
+ this.value = value;
this.description = description;
}
@@ -56,21 +56,8 @@ namespace Lucene.Net.Search
/// <summary>The value assigned to this explanation node. </summary>
public virtual float Value
{
- get { return value_Renamed; }
- set { this.value_Renamed = value; }
- }
-
- /// <summary>The value assigned to this explanation node. </summary>
- [Obsolete("Use Value property instead.")]
- public virtual float GetValue()
- {
- return Value;
- }
- /// <summary>Sets the value assigned to this explanation node. </summary>
- [Obsolete("Use Value property instead.")]
- public virtual void SetValue(float newValue)
- {
- this.Value = newValue;
+ get { return value; }
+ set { this.value = value; }
}
/// <summary>A description of this explanation node. </summary>
@@ -80,19 +67,6 @@ namespace Lucene.Net.Search
set { this.description = value; }
}
- /// <summary>A description of this explanation node. </summary>
- [Obsolete("Use Description property instead.")]
- public virtual System.String GetDescription()
- {
- return Description;
- }
- /// <summary>Sets the description of this explanation node. </summary>
- [Obsolete("Use Description property instead.")]
- public virtual void SetDescription(System.String description)
- {
- Description = description;
- }
-
/// <summary> A short one line summary which should contain all high level
/// information about this Explanation, without the "Details"
/// </summary>
@@ -100,32 +74,13 @@ namespace Lucene.Net.Search
{
get { return Value + " = " + Description; }
}
-
- /// <summary> A short one line summary which should contain all high level
- /// information about this Explanation, without the "Details"
- /// </summary>
- [Obsolete("Use Summary property instead.")]
- protected internal virtual System.String GetSummary()
- {
- return Summary;
- }
/// <summary>The sub-nodes of this explanation node. </summary>
- public virtual Explanation[] Details
- {
- get
- {
- if (details == null)
- return null;
- return details.ToArray();
- }
- }
-
- /// <summary>The sub-nodes of this explanation node. </summary>
- [Obsolete("Use Details property instead.")]
public virtual Explanation[] GetDetails()
{
- return Details;
+ if (details == null)
+ return null;
+ return details.ToArray();
}
/// <summary>Adds a sub-node to this explanation node. </summary>
@@ -152,7 +107,7 @@ namespace Lucene.Net.Search
buffer.Append(Summary);
buffer.Append("\n");
- Explanation[] details = Details;
+ Explanation[] details = GetDetails();
if (details != null)
{
for (int i = 0; i < details.Length; i++)
@@ -174,7 +129,7 @@ namespace Lucene.Net.Search
buffer.Append(Summary);
buffer.Append("<br />\n");
- Explanation[] details = Details;
+ Explanation[] details = GetDetails();
if (details != null)
{
for (int i = 0; i < details.Length; i++)
Modified: incubator/lucene.net/trunk/src/core/Search/FieldComparator.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/FieldComparator.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/FieldComparator.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/FieldComparator.cs Wed Mar 21 06:04:26 2012
@@ -936,9 +936,9 @@ namespace Lucene.Net.Search
get { return values[slot]; }
}
- public string[] Values
+ public string[] GetValues()
{
- get { return values; }
+ return values;
}
public int BottomSlot
Modified: incubator/lucene.net/trunk/src/core/Search/FilterManager.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/FilterManager.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/FilterManager.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/FilterManager.cs Wed Mar 21 06:04:26 2012
@@ -53,11 +53,12 @@ namespace Lucene.Net.Search
/// <summary>Cache cleaner that runs in a separate thread </summary>
protected internal FilterCleaner _filterCleaner;
+ private static readonly object _staticSyncObj = new object();
public static FilterManager Instance
{
get
{
- lock (typeof (Lucene.Net.Search.FilterManager))
+ lock (_staticSyncObj)
{
return manager ?? (manager = new FilterManager());
}
@@ -77,24 +78,22 @@ namespace Lucene.Net.Search
fcThread.IsBackground = true;
fcThread.Start();
}
-
- /// <summary> Sets the max size that cache should reach before it is cleaned up</summary>
- /// <param name="cacheCleanSize">maximum allowed cache size
- /// </param>
- public virtual void SetCacheSize(int cacheCleanSize)
- {
- this.cacheCleanSize = cacheCleanSize;
- }
-
- /// <summary> Sets the cache cleaning frequency in milliseconds.</summary>
- /// <param name="cleanSleepTime">cleaning frequency in millioseconds
- /// </param>
- public virtual void SetCleanThreadSleepTime(long cleanSleepTime)
- {
- this.cleanSleepTime = cleanSleepTime;
- }
-
- /// <summary> Returns the cached version of the filter. Allows the caller to pass up
+
+ /// <summary> Sets the max size that cache should reach before it is cleaned up</summary>
+ /// <param name="value"> maximum allowed cache size </param>
+ public virtual void SetCacheSize(int value)
+ {
+ this.cacheCleanSize = value;
+ }
+
+ /// <summary> Sets the cache cleaning frequency in milliseconds.</summary>
+ /// <param name="value"> cleaning frequency in millioseconds </param>
+ public virtual void SetCleanThreadSleepTime(long value)
+ {
+ this.cleanSleepTime = value;
+ }
+
+ /// <summary> Returns the cached version of the filter. Allows the caller to pass up
/// a small filter but this will keep a persistent version around and allow
/// the caching filter to do its job.
///
Modified: incubator/lucene.net/trunk/src/core/Search/FilteredQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/FilteredQuery.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/FilteredQuery.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/FilteredQuery.cs Wed Mar 21 06:04:26 2012
@@ -134,9 +134,9 @@ namespace Lucene.Net.Search
get { return value_Renamed; }
}
- public override float SumOfSquaredWeights
+ public override float GetSumOfSquaredWeights()
{
- get { return weight.SumOfSquaredWeights*Enclosing_Instance.Boost*Enclosing_Instance.Boost; }
+ return weight.GetSumOfSquaredWeights()*Enclosing_Instance.Boost*Enclosing_Instance.Boost;
}
public override void Normalize(float v)
Modified: incubator/lucene.net/trunk/src/core/Search/Function/CustomScoreQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/Function/CustomScoreQuery.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Function/CustomScoreQuery.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Function/CustomScoreQuery.cs Wed Mar 21 06:04:26 2012
@@ -372,26 +372,23 @@ namespace Lucene.Net.Search.Function
/*(non-Javadoc) <see cref="Lucene.Net.Search.Weight.sumOfSquaredWeights() */
- public override float SumOfSquaredWeights
+ public override float GetSumOfSquaredWeights()
{
- get
+ float sum = subQueryWeight.GetSumOfSquaredWeights();
+ for (int i = 0; i < valSrcWeights.Length; i++)
{
- float sum = subQueryWeight.SumOfSquaredWeights;
- for (int i = 0; i < valSrcWeights.Length; i++)
+ if (qStrict)
{
- if (qStrict)
- {
- var sumsq = valSrcWeights[i].SumOfSquaredWeights;
- // do not include ValueSource part in the query normalization
- }
- else
- {
- sum += valSrcWeights[i].SumOfSquaredWeights;
- }
+ var sumsq = valSrcWeights[i].GetSumOfSquaredWeights();
+ // do not include ValueSource part in the query normalization
+ }
+ else
+ {
+ sum += valSrcWeights[i].GetSumOfSquaredWeights();
}
- sum *= Enclosing_Instance.Boost*Enclosing_Instance.Boost; // boost each sub-weight
- return sum;
}
+ sum *= Enclosing_Instance.Boost*Enclosing_Instance.Boost; // boost each sub-weight
+ return sum;
}
/*(non-Javadoc) <see cref="Lucene.Net.Search.Weight.normalize(float) */
@@ -459,9 +456,9 @@ namespace Lucene.Net.Search.Function
return res;
}
- public override bool ScoresDocsOutOfOrder
+ public override bool GetScoresDocsOutOfOrder()
{
- get { return false; }
+ return false;
}
}
Modified: incubator/lucene.net/trunk/src/core/Search/Function/ValueSourceQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/Function/ValueSourceQuery.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Function/ValueSourceQuery.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Function/ValueSourceQuery.cs Wed Mar 21 06:04:26 2012
@@ -107,13 +107,10 @@ namespace Lucene.Net.Search.Function
/*(non-Javadoc) <see cref="Lucene.Net.Search.Weight.sumOfSquaredWeights() */
- public override float SumOfSquaredWeights
+ public override float GetSumOfSquaredWeights()
{
- get
- {
- queryWeight = Enclosing_Instance.Boost;
- return queryWeight*queryWeight;
- }
+ queryWeight = Enclosing_Instance.Boost;
+ return queryWeight*queryWeight;
}
/*(non-Javadoc) <see cref="Lucene.Net.Search.Weight.normalize(float) */
Modified: incubator/lucene.net/trunk/src/core/Search/FuzzyQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/FuzzyQuery.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/FuzzyQuery.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/FuzzyQuery.cs Wed Mar 21 06:04:26 2012
@@ -140,7 +140,7 @@ namespace Lucene.Net.Search
return new TermQuery(term);
}
- int maxSize = BooleanQuery.GetMaxClauseCount();
+ int maxSize = BooleanQuery.MaxClauseCount;
// TODO: Java uses a PriorityQueue. Using Linq, we can emulate it,
// however it's considerable slower than the java counterpart.
Modified: incubator/lucene.net/trunk/src/core/Search/IndexSearcher.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/IndexSearcher.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/IndexSearcher.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/IndexSearcher.cs Wed Mar 21 06:04:26 2012
@@ -184,7 +184,7 @@ namespace Lucene.Net.Search
}
nDocs = Math.Min(nDocs, reader.MaxDoc);
- TopScoreDocCollector collector = TopScoreDocCollector.create(nDocs, !weight.ScoresDocsOutOfOrder);
+ TopScoreDocCollector collector = TopScoreDocCollector.Create(nDocs, !weight.GetScoresDocsOutOfOrder());
Search(weight, filter, collector);
return collector.TopDocs();
}
@@ -208,7 +208,7 @@ namespace Lucene.Net.Search
{
nDocs = Math.Min(nDocs, reader.MaxDoc);
- TopFieldCollector collector2 = TopFieldCollector.create(sort, nDocs, fillFields, fieldSortDoTrackScores, fieldSortDoMaxScore, !weight.ScoresDocsOutOfOrder);
+ TopFieldCollector collector2 = TopFieldCollector.create(sort, nDocs, fillFields, fieldSortDoTrackScores, fieldSortDoMaxScore, !weight.GetScoresDocsOutOfOrder());
Search(weight, filter, collector2);
return (TopFieldDocs) collector2.TopDocs();
}
@@ -222,7 +222,7 @@ namespace Lucene.Net.Search
{
// search each subreader
collector.SetNextReader(subReaders[i], docStarts[i]);
- Scorer scorer = weight.Scorer(subReaders[i], !collector.AcceptsDocsOutOfOrder(), true);
+ Scorer scorer = weight.Scorer(subReaders[i], !collector.AcceptsDocsOutOfOrder, true);
if (scorer != null)
{
scorer.Score(collector);
Modified: incubator/lucene.net/trunk/src/core/Search/MatchAllDocsQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/MatchAllDocsQuery.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/MatchAllDocsQuery.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/MatchAllDocsQuery.cs Wed Mar 21 06:04:26 2012
@@ -134,13 +134,10 @@ namespace Lucene.Net.Search
get { return queryWeight; }
}
- public override float SumOfSquaredWeights
+ public override float GetSumOfSquaredWeights()
{
- get
- {
- queryWeight = Enclosing_Instance.Boost;
- return queryWeight*queryWeight;
- }
+ queryWeight = Enclosing_Instance.Boost;
+ return queryWeight*queryWeight;
}
public override void Normalize(float queryNorm)
Modified: incubator/lucene.net/trunk/src/core/Search/MultiPhraseQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/MultiPhraseQuery.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/MultiPhraseQuery.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/MultiPhraseQuery.cs Wed Mar 21 06:04:26 2012
@@ -106,7 +106,8 @@ namespace Lucene.Net.Search
/// <summary> Returns a List<Term[]> of the terms in the multiphrase.
/// Do not modify the List or its contents.
/// </summary>
- public virtual System.Collections.Generic.IList<Term[]> GetTermArrays()
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
+ public virtual System.Collections.Generic.IList<Term[]> GetTermArrays()
{
return termArrays.AsReadOnly();
}
@@ -178,13 +179,10 @@ namespace Lucene.Net.Search
get { return value_Renamed; }
}
- public override float SumOfSquaredWeights
+ public override float GetSumOfSquaredWeights()
{
- get
- {
- queryWeight = idf*Enclosing_Instance.Boost; // compute query weight
- return queryWeight*queryWeight; // square it
- }
+ queryWeight = idf*Enclosing_Instance.Boost; // compute query weight
+ return queryWeight*queryWeight; // square it
}
public override void Normalize(float queryNorm)
Modified: incubator/lucene.net/trunk/src/core/Search/MultiSearcher.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/MultiSearcher.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/MultiSearcher.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/MultiSearcher.cs Wed Mar 21 06:04:26 2012
@@ -71,10 +71,11 @@ namespace Lucene.Net.Search
{
collector.SetNextReader(reader, start + docBase);
}
- public override bool AcceptsDocsOutOfOrder()
- {
- return collector.AcceptsDocsOutOfOrder();
- }
+
+ public override bool AcceptsDocsOutOfOrder
+ {
+ get { return collector.AcceptsDocsOutOfOrder; }
+ }
}
/// <summary> Document Frequency cache acting as a Dummy-Searcher. This class is no
Modified: incubator/lucene.net/trunk/src/core/Search/MultiTermQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/MultiTermQuery.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/MultiTermQuery.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/MultiTermQuery.cs Wed Mar 21 06:04:26 2012
@@ -272,7 +272,7 @@ namespace Lucene.Net.Search
// ConstantFilterRewrite:
ICollection<Term> pendingTerms = new List<Term>();
int docCountCutoff = (int) ((docCountPercent / 100.0) * reader.MaxDoc);
- int termCountLimit = System.Math.Min(BooleanQuery.GetMaxClauseCount(), termCountCutoff);
+ int termCountLimit = System.Math.Min(BooleanQuery.MaxClauseCount, termCountCutoff);
int docVisitCount = 0;
FilteredTermEnum enumerator = query.GetEnum(reader);
Modified: incubator/lucene.net/trunk/src/core/Search/ParallelMultiSearcher.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/ParallelMultiSearcher.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/ParallelMultiSearcher.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/ParallelMultiSearcher.cs Wed Mar 21 06:04:26 2012
@@ -67,10 +67,11 @@ namespace Lucene.Net.Search
{
collector.SetNextReader(reader, start + docBase);
}
- public override bool AcceptsDocsOutOfOrder()
- {
- return collector.AcceptsDocsOutOfOrder();
- }
+
+ public override bool AcceptsDocsOutOfOrder
+ {
+ get { return collector.AcceptsDocsOutOfOrder; }
+ }
}
private Searchable[] searchables;
Modified: incubator/lucene.net/trunk/src/core/Search/Payloads/PayloadNearQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/Payloads/PayloadNearQuery.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Payloads/PayloadNearQuery.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Payloads/PayloadNearQuery.cs Wed Mar 21 06:04:26 2012
@@ -207,7 +207,7 @@ namespace Lucene.Net.Search.Payloads
{
if (((NearSpansOrdered) subSpans[i]).IsPayloadAvailable)
{
- ProcessPayloads(((NearSpansOrdered) subSpans[i]).Payload, subSpans[i].Start(), subSpans[i].End());
+ ProcessPayloads(((NearSpansOrdered) subSpans[i]).GetPayload(), subSpans[i].Start(), subSpans[i].End());
}
GetPayloads(((NearSpansOrdered) subSpans[i]).GetSubSpans());
}
@@ -215,7 +215,7 @@ namespace Lucene.Net.Search.Payloads
{
if (((NearSpansUnordered) subSpans[i]).IsPayloadAvailable)
{
- ProcessPayloads(((NearSpansUnordered) subSpans[i]).Payload, subSpans[i].Start(), subSpans[i].End());
+ ProcessPayloads(((NearSpansUnordered) subSpans[i]).GetPayload(), subSpans[i].Start(), subSpans[i].End());
}
GetPayloads(((NearSpansUnordered) subSpans[i]).GetSubSpans());
}
Modified: incubator/lucene.net/trunk/src/core/Search/Payloads/PayloadSpanUtil.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/Payloads/PayloadSpanUtil.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Payloads/PayloadSpanUtil.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Payloads/PayloadSpanUtil.cs Wed Mar 21 06:04:26 2012
@@ -199,7 +199,7 @@ namespace Lucene.Net.Search.Payloads
{
if (spans.IsPayloadAvailable)
{
- ICollection<byte[]> payload = spans.Payload;
+ ICollection<byte[]> payload = spans.GetPayload();
foreach (byte[] bytes in payload)
{
payloads.Add(bytes);
Modified: incubator/lucene.net/trunk/src/core/Search/Payloads/PayloadTermQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/Payloads/PayloadTermQuery.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Payloads/PayloadTermQuery.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Payloads/PayloadTermQuery.cs Wed Mar 21 06:04:26 2012
@@ -181,7 +181,8 @@ namespace Lucene.Net.Search.Payloads
/// </summary>
/// <seealso cref="Score()">
/// </seealso>
- protected internal virtual float GetSpanScore()
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
+ protected internal virtual float GetSpanScore()
{
return base.Score();
}
@@ -192,7 +193,8 @@ namespace Lucene.Net.Search.Payloads
/// <returns> The score, as calculated by
/// <see cref="PayloadFunction.DocScore(int, String, int, float)" />
/// </returns>
- protected internal virtual float GetPayloadScore()
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
+ protected internal virtual float GetPayloadScore()
{
return Enclosing_Instance.Enclosing_Instance.function.DocScore(doc, Enclosing_Instance.Enclosing_Instance.term.Field, payloadsSeen, payloadScore);
}
Modified: incubator/lucene.net/trunk/src/core/Search/PhraseQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/PhraseQuery.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/PhraseQuery.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/PhraseQuery.cs Wed Mar 21 06:04:26 2012
@@ -162,13 +162,10 @@ namespace Lucene.Net.Search
get { return value_Renamed; }
}
- public override float SumOfSquaredWeights
+ public override float GetSumOfSquaredWeights()
{
- get
- {
- queryWeight = idf*Enclosing_Instance.Boost; // compute query weight
- return queryWeight*queryWeight; // square it
- }
+ queryWeight = idf*Enclosing_Instance.Boost; // compute query weight
+ return queryWeight*queryWeight; // square it
}
public override void Normalize(float queryNorm)
Modified: incubator/lucene.net/trunk/src/core/Search/PositiveScoresOnlyCollector.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/PositiveScoresOnlyCollector.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/PositiveScoresOnlyCollector.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/PositiveScoresOnlyCollector.cs Wed Mar 21 06:04:26 2012
@@ -57,10 +57,10 @@ namespace Lucene.Net.Search
this.scorer = new ScoreCachingWrappingScorer(scorer);
c.SetScorer(this.scorer);
}
-
- public override bool AcceptsDocsOutOfOrder()
- {
- return c.AcceptsDocsOutOfOrder();
- }
+
+ public override bool AcceptsDocsOutOfOrder
+ {
+ get { return c.AcceptsDocsOutOfOrder; }
+ }
}
}
\ No newline at end of file
Modified: incubator/lucene.net/trunk/src/core/Search/Query.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/Query.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Query.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Query.cs Wed Mar 21 06:04:26 2012
@@ -95,8 +95,8 @@ namespace Lucene.Net.Search
{
Query query = searcher.Rewrite(this);
Weight weight = query.CreateWeight(searcher);
- float sum = weight.SumOfSquaredWeights;
- float norm = GetSimilarity(searcher).QueryNorm(sum);
+ float sum = weight.GetSumOfSquaredWeights();
+ float norm = GetSimilarity(searcher).QueryNorm(sum);
if (float.IsInfinity(norm) || float.IsNaN(norm))
norm = 1.0f;
weight.Normalize(norm);
Modified: incubator/lucene.net/trunk/src/core/Search/QueryTermVector.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/QueryTermVector.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/QueryTermVector.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/QueryTermVector.cs Wed Mar 21 06:04:26 2012
@@ -18,11 +18,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using Lucene.Net.Index;
using Lucene.Net.Support;
using Analyzer = Lucene.Net.Analysis.Analyzer;
using TokenStream = Lucene.Net.Analysis.TokenStream;
using TermAttribute = Lucene.Net.Analysis.Tokenattributes.TermAttribute;
-using TermFreqVector = Lucene.Net.Index.TermFreqVector;
namespace Lucene.Net.Search
{
@@ -31,17 +31,17 @@ namespace Lucene.Net.Search
///
///
/// </summary>
- public class QueryTermVector : TermFreqVector
+ public class QueryTermVector : ITermFreqVector
{
private System.String[] terms = new System.String[0];
private int[] termFreqs = new int[0];
-
- public virtual System.String GetField()
- {
- return null;
- }
-
- /// <summary> </summary>
+
+ public virtual string Field
+ {
+ get { return null; }
+ }
+
+ /// <summary> </summary>
/// <param name="queryTerms">The original list of terms from the query, can contain duplicates
/// </param>
public QueryTermVector(System.String[] queryTerms)
@@ -130,14 +130,14 @@ namespace Lucene.Net.Search
sb.Append('}');
return sb.ToString();
}
-
-
- public virtual int Size()
- {
- return terms.Length;
- }
-
- public virtual System.String[] GetTerms()
+
+
+ public virtual int Size
+ {
+ get { return terms.Length; }
+ }
+
+ public virtual System.String[] GetTerms()
{
return terms;
}
Modified: incubator/lucene.net/trunk/src/core/Search/Similarity.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/Similarity.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Similarity.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Similarity.cs Wed Mar 21 06:04:26 2012
@@ -404,16 +404,16 @@ namespace Lucene.Net.Search
{
return NORM_TABLE[b & 0xFF]; // & 0xFF maps negative bytes to positive above 127
}
-
- /// <summary>Returns a table for decoding normalization bytes.</summary>
- /// <seealso cref="EncodeNorm(float)">
- /// </seealso>
- public static float[] GetNormDecoder()
- {
- return NORM_TABLE;
- }
-
- /// <summary> Compute the normalization value for a field, given the accumulated
+
+ /// <summary>Returns a table for decoding normalization bytes.</summary>
+ /// <seealso cref="EncodeNorm(float)">
+ /// </seealso>
+ public static float[] GetNormDecoder()
+ {
+ return NORM_TABLE;
+ }
+
+ /// <summary> Compute the normalization value for a field, given the accumulated
/// state of term processing for this field (see <see cref="FieldInvertState" />).
///
/// <p/>Implementations should calculate a float value based on the field
Modified: incubator/lucene.net/trunk/src/core/Search/Spans/NearSpansOrdered.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/Spans/NearSpansOrdered.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Spans/NearSpansOrdered.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Spans/NearSpansOrdered.cs Wed Mar 21 06:04:26 2012
@@ -146,9 +146,9 @@ namespace Lucene.Net.Search.Spans
// TODO: Remove warning after API has been finalized
// TODO: Would be nice to be able to lazy load payloads
- public override ICollection<byte[]> Payload
+ public override ICollection<byte[]> GetPayload()
{
- get { return matchPayload; }
+ return matchPayload;
}
// TODO: Remove warning after API has been finalized
@@ -328,7 +328,7 @@ namespace Lucene.Net.Search.Spans
System.Collections.Generic.Dictionary<byte[], byte[]> possibleMatchPayloads = new System.Collections.Generic.Dictionary<byte[], byte[]>();
if (subSpans[subSpans.Length - 1].IsPayloadAvailable)
{
- System.Collections.Generic.ICollection<byte[]> payload = subSpans[subSpans.Length - 1].Payload;
+ System.Collections.Generic.ICollection<byte[]> payload = subSpans[subSpans.Length - 1].GetPayload();
foreach(byte[] pl in payload)
{
if (!possibleMatchPayloads.ContainsKey(pl))
@@ -348,7 +348,7 @@ namespace Lucene.Net.Search.Spans
Spans prevSpans = subSpans[i];
if (collectPayloads && prevSpans.IsPayloadAvailable)
{
- System.Collections.Generic.ICollection<byte[]> payload = prevSpans.Payload;
+ System.Collections.Generic.ICollection<byte[]> payload = prevSpans.GetPayload();
possiblePayload = new System.Collections.Generic.List<byte[]>(payload.Count);
possiblePayload.AddRange(payload);
}
@@ -384,7 +384,7 @@ namespace Lucene.Net.Search.Spans
prevEnd = ppEnd;
if (collectPayloads && prevSpans.IsPayloadAvailable)
{
- System.Collections.Generic.ICollection<byte[]> payload = prevSpans.Payload;
+ System.Collections.Generic.ICollection<byte[]> payload = prevSpans.GetPayload();
possiblePayload = new System.Collections.Generic.List<byte[]>(payload.Count);
possiblePayload.AddRange(payload);
}
Modified: incubator/lucene.net/trunk/src/core/Search/Spans/NearSpansUnordered.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/Spans/NearSpansUnordered.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Spans/NearSpansUnordered.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Spans/NearSpansUnordered.cs Wed Mar 21 06:04:26 2012
@@ -155,9 +155,9 @@ namespace Lucene.Net.Search.Spans
}
// TODO: Remove warning after API has been finalized
- public override ICollection<byte[]> Payload
+ public override ICollection<byte[]> GetPayload()
{
- get { return spans.Payload.ToArray(); }
+ return spans.GetPayload().ToArray();
}
// TODO: Remove warning after API has been finalized
@@ -317,28 +317,26 @@ namespace Lucene.Net.Search.Spans
// TODO: Remove warning after API has been finalized
/// <summary> WARNING: The List is not necessarily in order of the the positions</summary>
- /// <value> Collection of <c>byte[]</c> payloads </value>
+ /// <returns> Collection of &lt;c&gt;byte[]&lt;/c&gt; payloads </returns>
/// <throws> IOException </throws>
- public override ICollection<byte[]> Payload
+ public override ICollection<byte[]> GetPayload()
{
- get
+ System.Collections.Generic.ISet<byte[]> matchPayload = new System.Collections.Generic.HashSet<byte[]>();
+ for (SpansCell cell = first; cell != null; cell = cell.next)
{
- System.Collections.Generic.ISet<byte[]> matchPayload = new System.Collections.Generic.HashSet<byte[]>();
- for (SpansCell cell = first; cell != null; cell = cell.next)
+ if (cell.IsPayloadAvailable)
{
- if (cell.IsPayloadAvailable)
- {
- matchPayload.UnionWith(cell.Payload);
- }
+ matchPayload.UnionWith(cell.GetPayload());
}
- return matchPayload;
}
+ return matchPayload;
}
// TODO: Remove warning after API has been finalized
-
public override bool IsPayloadAvailable
{
+ // this is a lot for a property, but it's the only span of the 5 others
+ // that has this much logic.
get
{
SpansCell pointer = Min();
Modified: incubator/lucene.net/trunk/src/core/Search/Spans/SpanFirstQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/Spans/SpanFirstQuery.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Spans/SpanFirstQuery.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Spans/SpanFirstQuery.cs Wed Mar 21 06:04:26 2012
@@ -88,17 +88,14 @@ namespace Lucene.Net.Search.Spans
// TODO: Remove warning after API has been finalized
- public override ICollection<byte[]> Payload
+ public override ICollection<byte[]> GetPayload()
{
- get
+ System.Collections.Generic.ICollection<byte[]> result = null;
+ if (spans.IsPayloadAvailable)
{
- System.Collections.Generic.ICollection<byte[]> result = null;
- if (spans.IsPayloadAvailable)
- {
- result = spans.Payload;
- }
- return result; //TODO: any way to avoid the new construction?
+ result = spans.GetPayload();
}
+ return result; //TODO: any way to avoid the new construction?
}
// TODO: Remove warning after API has been finalized
Modified: incubator/lucene.net/trunk/src/core/Search/Spans/SpanNotQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/Spans/SpanNotQuery.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Spans/SpanNotQuery.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Spans/SpanNotQuery.cs Wed Mar 21 06:04:26 2012
@@ -124,17 +124,14 @@ namespace Lucene.Net.Search.Spans
// TODO: Remove warning after API has been finalizedb
- public override ICollection<byte[]> Payload
+ public override ICollection<byte[]> GetPayload()
{
- get
+ System.Collections.Generic.ICollection<byte[]> result = null;
+ if (includeSpans.IsPayloadAvailable)
{
- System.Collections.Generic.ICollection<byte[]> result = null;
- if (includeSpans.IsPayloadAvailable)
- {
- result = includeSpans.Payload;
- }
- return result;
+ result = includeSpans.GetPayload();
}
+ return result;
}
// TODO: Remove warning after API has been finalized
Modified: incubator/lucene.net/trunk/src/core/Search/Spans/SpanOrQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/Spans/SpanOrQuery.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Spans/SpanOrQuery.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Spans/SpanOrQuery.cs Wed Mar 21 06:04:26 2012
@@ -139,18 +139,15 @@ namespace Lucene.Net.Search.Spans
return Top().End();
}
- public override ICollection<byte[]> Payload
+ public override ICollection<byte[]> GetPayload()
{
- get
+ System.Collections.Generic.ICollection<byte[]> result = null;
+ Spans theTop = Top();
+ if (theTop != null && theTop.IsPayloadAvailable)
{
- System.Collections.Generic.ICollection<byte[]> result = null;
- Spans theTop = Top();
- if (theTop != null && theTop.IsPayloadAvailable)
- {
- result = theTop.Payload;
- }
- return result;
+ result = theTop.GetPayload();
}
+ return result;
}
public override bool IsPayloadAvailable
Modified: incubator/lucene.net/trunk/src/core/Search/Spans/SpanWeight.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/Spans/SpanWeight.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Spans/SpanWeight.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Spans/SpanWeight.cs Wed Mar 21 06:04:26 2012
@@ -61,13 +61,10 @@ namespace Lucene.Net.Search.Spans
get { return value_Renamed; }
}
- public override float SumOfSquaredWeights
+ public override float GetSumOfSquaredWeights()
{
- get
- {
- queryWeight = idf*query.Boost; // compute query weight
- return queryWeight*queryWeight; // square it
- }
+ queryWeight = idf*query.Boost; // compute query weight
+ return queryWeight*queryWeight; // square it
}
public override void Normalize(float queryNorm)
Modified: incubator/lucene.net/trunk/src/core/Search/Spans/Spans.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/Spans/Spans.cs?rev=1303294&r1=1303293&r2=1303294&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Spans/Spans.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Spans/Spans.cs Wed Mar 21 06:04:26 2012
@@ -74,10 +74,11 @@ namespace Lucene.Net.Search.Spans
/// supported anymore in such a case.</font><p/>
///
/// </summary>
- /// <value> a List of byte arrays containing the data of this payload, otherwise null if isPayloadAvailable is false </value>
+ /// <returns> a List of byte arrays containing the data of this payload, otherwise null if isPayloadAvailable is false </returns>
/// <throws> java.io.IOException </throws>
- // TODO: Remove warning after API has been finalized
- public abstract ICollection<byte[]> Payload { get; }
+ // TODO: Remove warning after API has been finalized
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
+ public abstract ICollection<byte[]> GetPayload();
/// <summary> Checks if a payload can be loaded at this position.
/// <p/>