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 [7/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/Search/Payloads/PayloadTermQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/Payloads/PayloadTermQuery.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Payloads/PayloadTermQuery.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Payloads/PayloadTermQuery.cs Mon Mar 12 22:29:26 2012
@@ -91,7 +91,7 @@ namespace Lucene.Net.Search.Payloads
public override Scorer Scorer(IndexReader reader, bool scoreDocsInOrder, bool topScorer)
{
- return new PayloadTermSpanScorer(this, (TermSpans) query.GetSpans(reader), this, similarity, reader.Norms(query.GetField()));
+ return new PayloadTermSpanScorer(this, (TermSpans) query.GetSpans(reader), this, similarity, reader.Norms(query.Field));
}
protected internal class PayloadTermSpanScorer:SpanScorer
@@ -118,7 +118,7 @@ namespace Lucene.Net.Search.Payloads
public PayloadTermSpanScorer(PayloadTermWeight enclosingInstance, TermSpans spans, Weight weight, Similarity similarity, byte[] norms):base(spans, weight, similarity, norms)
{
InitBlock(enclosingInstance);
- positions = spans.GetPositions();
+ positions = spans.Positions;
}
public /*protected internal*/ override bool SetFreqCurrentDoc()
@@ -131,7 +131,7 @@ namespace Lucene.Net.Search.Payloads
freq = 0.0f;
payloadScore = 0;
payloadsSeen = 0;
- Similarity similarity1 = GetSimilarity();
+ Similarity similarity1 = Similarity;
while (more && doc == spans.Doc())
{
int matchLength = spans.End() - spans.Start();
@@ -147,10 +147,10 @@ namespace Lucene.Net.Search.Payloads
protected internal virtual void ProcessPayload(Similarity similarity)
{
- if (positions.IsPayloadAvailable())
+ if (positions.IsPayloadAvailable)
{
payload = positions.GetPayload(payload, 0);
- payloadScore = Enclosing_Instance.Enclosing_Instance.function.CurrentScore(doc, Enclosing_Instance.Enclosing_Instance.term.Field(), spans.Start(), spans.End(), payloadsSeen, payloadScore, similarity.ScorePayload(doc, Enclosing_Instance.Enclosing_Instance.term.Field(), spans.Start(), spans.End(), payload, 0, positions.GetPayloadLength()));
+ payloadScore = Enclosing_Instance.Enclosing_Instance.function.CurrentScore(doc, Enclosing_Instance.Enclosing_Instance.term.Field(), spans.Start(), spans.End(), payloadsSeen, payloadScore, similarity.ScorePayload(doc, Enclosing_Instance.Enclosing_Instance.term.Field(), spans.Start(), spans.End(), payload, 0, positions.PayloadLength));
payloadsSeen++;
}
else
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=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/PhraseQuery.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/PhraseQuery.cs Mon Mar 12 22:29:26 2012
@@ -44,30 +44,26 @@ namespace Lucene.Net.Search
public PhraseQuery()
{
}
-
- /// <summary>Sets the number of other words permitted between words in query phrase.
- /// If zero, then this is an exact phrase search. For larger values this works
- /// like a <c>WITHIN</c> or <c>NEAR</c> operator.
- /// <p/>The slop is in fact an edit-distance, where the units correspond to
- /// moves of terms in the query phrase out of position. For example, to switch
- /// the order of two words requires two moves (the first move places the words
- /// atop one another), so to permit re-orderings of phrases, the slop must be
- /// at least two.
- /// <p/>More exact matches are scored higher than sloppier matches, thus search
- /// results are sorted by exactness.
- /// <p/>The slop is zero by default, requiring exact matches.
- /// </summary>
- public virtual void SetSlop(int s)
- {
- slop = s;
- }
- /// <summary>Returns the slop. See setSlop(). </summary>
- public virtual int GetSlop()
- {
- return slop;
- }
-
- /// <summary> Adds a term to the end of the query phrase.
+
+ /// <summary>Sets the number of other words permitted between words in query phrase.
+ /// If zero, then this is an exact phrase search. For larger values this works
+ /// like a <c>WITHIN</c> or <c>NEAR</c> operator.
+ /// <p/>The slop is in fact an edit-distance, where the units correspond to
+ /// moves of terms in the query phrase out of position. For example, to switch
+ /// the order of two words requires two moves (the first move places the words
+ /// atop one another), so to permit re-orderings of phrases, the slop must be
+ /// at least two.
+ /// <p/>More exact matches are scored higher than sloppier matches, thus search
+ /// results are sorted by exactness.
+ /// <p/>The slop is zero by default, requiring exact matches.
+ /// </summary>
+ public virtual int Slop
+ {
+ get { return slop; }
+ set { slop = value; }
+ }
+
+ /// <summary> Adds a term to the end of the query phrase.
/// The relative position of the term is the one immediately after the last term added.
/// </summary>
public virtual void Add(Term term)
@@ -148,30 +144,34 @@ namespace Lucene.Net.Search
this.similarity = Enclosing_Instance.GetSimilarity(searcher);
idfExp = similarity.IdfExplain(Enclosing_Instance.terms, searcher);
- idf = idfExp.GetIdf();
+ idf = idfExp.Idf;
}
public override System.String ToString()
{
return "weight(" + Enclosing_Instance + ")";
}
-
- public override Query GetQuery()
- {
- return Enclosing_Instance;
- }
- public override float GetValue()
- {
- return value_Renamed;
- }
-
- public override float SumOfSquaredWeights()
- {
- queryWeight = idf * Enclosing_Instance.GetBoost(); // compute query weight
- return queryWeight * queryWeight; // square it
- }
-
- public override void Normalize(float queryNorm)
+
+ public override Query Query
+ {
+ get { return Enclosing_Instance; }
+ }
+
+ public override float Value
+ {
+ get { return value_Renamed; }
+ }
+
+ public override float SumOfSquaredWeights
+ {
+ get
+ {
+ queryWeight = idf*Enclosing_Instance.Boost; // compute query weight
+ return queryWeight*queryWeight; // square it
+ }
+ }
+
+ public override void Normalize(float queryNorm)
{
this.queryNorm = queryNorm;
queryWeight *= queryNorm; // normalize query weight
@@ -204,7 +204,7 @@ namespace Lucene.Net.Search
{
Explanation result = new Explanation();
- result.Description = "weight(" + GetQuery() + " in " + doc + "), product of:";
+ result.Description = "weight(" + Query + " in " + doc + "), product of:";
System.Text.StringBuilder docFreqs = new System.Text.StringBuilder();
System.Text.StringBuilder query = new System.Text.StringBuilder();
@@ -227,10 +227,10 @@ namespace Lucene.Net.Search
// explain query weight
Explanation queryExpl = new Explanation();
- queryExpl.Description = "queryWeight(" + GetQuery() + "), product of:";
+ queryExpl.Description = "queryWeight(" + Query + "), product of:";
- Explanation boostExpl = new Explanation(Enclosing_Instance.GetBoost(), "boost");
- if (Enclosing_Instance.GetBoost() != 1.0f)
+ Explanation boostExpl = new Explanation(Enclosing_Instance.Boost, "boost");
+ if (Enclosing_Instance.Boost != 1.0f)
queryExpl.AddDetail(boostExpl);
queryExpl.AddDetail(idfExpl);
@@ -287,7 +287,7 @@ namespace Lucene.Net.Search
// optimize one-term case
Term term = terms[0];
Query termQuery = new TermQuery(term);
- termQuery.SetBoost(GetBoost());
+ termQuery.Boost = Boost;
return termQuery.CreateWeight(searcher);
}
return new PhraseWeight(this, searcher);
@@ -350,7 +350,7 @@ namespace Lucene.Net.Search
buffer.Append(slop);
}
- buffer.Append(ToStringUtils.Boost(GetBoost()));
+ buffer.Append(ToStringUtils.Boost(Boost));
return buffer.ToString();
}
@@ -361,13 +361,13 @@ namespace Lucene.Net.Search
if (!(o is PhraseQuery))
return false;
PhraseQuery other = (PhraseQuery) o;
- return (this.GetBoost() == other.GetBoost()) && (this.slop == other.slop) && this.terms.Equals(other.terms) && this.positions.Equals(other.positions);
+ return (this.Boost == other.Boost) && (this.slop == other.slop) && this.terms.Equals(other.terms) && this.positions.Equals(other.positions);
}
/// <summary>Returns a hash code value for this object.</summary>
public override int GetHashCode()
{
- return BitConverter.ToInt32(BitConverter.GetBytes(GetBoost()), 0) ^ slop ^ terms.GetHashCode() ^ positions.GetHashCode();
+ return BitConverter.ToInt32(BitConverter.GetBytes(Boost), 0) ^ slop ^ terms.GetHashCode() ^ positions.GetHashCode();
}
}
}
\ No newline at end of file
Modified: incubator/lucene.net/trunk/src/core/Search/PhraseScorer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/PhraseScorer.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/PhraseScorer.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/PhraseScorer.cs Mon Mar 12 22:29:26 2012
@@ -49,7 +49,7 @@ namespace Lucene.Net.Search
{
this.norms = norms;
this.weight = weight;
- this.value_Renamed = weight.GetValue();
+ this.value_Renamed = weight.Value;
// convert tps to a list of phrase positions.
// note: phrase-position differs from term-position in that its position
@@ -128,7 +128,7 @@ namespace Lucene.Net.Search
public override float Score()
{
//System.out.println("scoring " + first.doc);
- float raw = GetSimilarity().Tf(freq) * value_Renamed; // raw score
+ float raw = Similarity.Tf(freq) * value_Renamed; // raw score
return norms == null?raw:raw * Similarity.DecodeNorm(norms[first.doc]); // normalize
}
Modified: incubator/lucene.net/trunk/src/core/Search/PrefixFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/PrefixFilter.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/PrefixFilter.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/PrefixFilter.cs Mon Mar 12 22:29:26 2012
@@ -32,18 +32,18 @@ namespace Lucene.Net.Search
public PrefixFilter(Term prefix):base(new PrefixQuery(prefix))
{
}
-
- public virtual Term GetPrefix()
- {
- return query.GetPrefix();
- }
-
- /// <summary>Prints a user-readable version of this query. </summary>
+
+ public virtual Term Prefix
+ {
+ get { return query.Prefix; }
+ }
+
+ /// <summary>Prints a user-readable version of this query. </summary>
public override System.String ToString()
{
System.Text.StringBuilder buffer = new System.Text.StringBuilder();
buffer.Append("PrefixFilter(");
- buffer.Append(GetPrefix().ToString());
+ buffer.Append(Prefix.ToString());
buffer.Append(")");
return buffer.ToString();
}
Modified: incubator/lucene.net/trunk/src/core/Search/PrefixQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/PrefixQuery.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/PrefixQuery.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/PrefixQuery.cs Mon Mar 12 22:29:26 2012
@@ -41,14 +41,14 @@ namespace Lucene.Net.Search
{ //will be removed in 3.0
this.prefix = prefix;
}
-
- /// <summary>Returns the prefix of this query. </summary>
- public virtual Term GetPrefix()
- {
- return prefix;
- }
-
- public /*protected internal*/ override FilteredTermEnum GetEnum(IndexReader reader)
+
+ /// <summary>Returns the prefix of this query. </summary>
+ public virtual Term Prefix
+ {
+ get { return prefix; }
+ }
+
+ protected internal override FilteredTermEnum GetEnum(IndexReader reader)
{
return new PrefixTermEnum(reader, prefix);
}
@@ -64,7 +64,7 @@ namespace Lucene.Net.Search
}
buffer.Append(prefix.Text());
buffer.Append('*');
- buffer.Append(ToStringUtils.Boost(GetBoost()));
+ buffer.Append(ToStringUtils.Boost(Boost));
return buffer.ToString();
}
Modified: incubator/lucene.net/trunk/src/core/Search/PrefixTermEnum.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/PrefixTermEnum.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/PrefixTermEnum.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/PrefixTermEnum.cs Mon Mar 12 22:29:26 2012
@@ -52,13 +52,13 @@ namespace Lucene.Net.Search
{
return endEnum;
}
-
- protected internal virtual Term GetPrefixTerm()
- {
- return prefix;
- }
-
- public /*protected internal*/ override bool TermCompare(Term term)
+
+ protected internal virtual Term PrefixTerm
+ {
+ get { return prefix; }
+ }
+
+ protected internal override bool TermCompare(Term term)
{
if ((System.Object) term.Field() == (System.Object) prefix.Field() && term.Text().StartsWith(prefix.Text()))
{
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=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Query.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Query.cs Mon Mar 12 22:29:26 2012
@@ -47,26 +47,18 @@ namespace Lucene.Net.Search
public abstract class Query : System.ICloneable
{
private float boost = 1.0f; // query boost factor
-
- /// <summary>Sets the boost for this query clause to <c>b</c>. Documents
- /// matching this clause will (in addition to the normal weightings) have
- /// their score multiplied by <c>b</c>.
- /// </summary>
- public virtual void SetBoost(float b)
- {
- boost = b;
- }
-
- /// <summary>Gets the boost for this clause. Documents matching
- /// this clause will (in addition to the normal weightings) have their score
- /// multiplied by <c>b</c>. The boost is 1.0 by default.
- /// </summary>
- public virtual float GetBoost()
- {
- return boost;
- }
-
- /// <summary>Prints a query to a string, with <c>field</c> assumed to be the
+
+ /// <summary>Gets or sets the boost for this query clause to <c>b</c>. Documents
+ /// matching this clause will (in addition to the normal weightings) have
+ /// their score multiplied by <c>b</c>. The boost is 1.0 by default.
+ /// </summary>
+ public virtual float Boost
+ {
+ get { return boost; }
+ set { boost = value; }
+ }
+
+ /// <summary>Prints a query to a string, with <c>field</c> assumed to be the
/// default field and omitted.
/// <p/>The representation used is one that is supposed to be readable
/// by <see cref="Lucene.Net.QueryParsers.QueryParser">QueryParser</see>. However,
@@ -103,7 +95,7 @@ namespace Lucene.Net.Search
{
Query query = searcher.Rewrite(this);
Weight weight = query.CreateWeight(searcher);
- float sum = weight.SumOfSquaredWeights();
+ float sum = weight.SumOfSquaredWeights;
float norm = GetSimilarity(searcher).QueryNorm(sum);
if (float.IsInfinity(norm) || float.IsNaN(norm))
norm = 1.0f;
@@ -224,7 +216,7 @@ namespace Lucene.Net.Search
/// </summary>
public virtual Similarity GetSimilarity(Searcher searcher)
{
- return searcher.GetSimilarity();
+ return searcher.Similarity;
}
/// <summary>Returns a clone of this query. </summary>
Modified: incubator/lucene.net/trunk/src/core/Search/QueryWrapperFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/QueryWrapperFilter.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/QueryWrapperFilter.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/QueryWrapperFilter.cs Mon Mar 12 22:29:26 2012
@@ -64,10 +64,11 @@ namespace Lucene.Net.Search
{
return weight.Scorer(reader, true, false);
}
- public override bool IsCacheable()
- {
- return false;
- }
+
+ public override bool IsCacheable
+ {
+ get { return false; }
+ }
}
private Query query;
Modified: incubator/lucene.net/trunk/src/core/Search/ScoreCachingWrappingScorer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/ScoreCachingWrappingScorer.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/ScoreCachingWrappingScorer.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/ScoreCachingWrappingScorer.cs Mon Mar 12 22:29:26 2012
@@ -38,7 +38,7 @@ namespace Lucene.Net.Search
private float curScore;
/// <summary>Creates a new instance by wrapping the given scorer. </summary>
- public ScoreCachingWrappingScorer(Scorer scorer):base(scorer.GetSimilarity())
+ public ScoreCachingWrappingScorer(Scorer scorer):base(scorer.Similarity)
{
this.scorer = scorer;
}
@@ -47,13 +47,13 @@ namespace Lucene.Net.Search
{
return scorer.Score(collector, max, firstDocID);
}
-
- public override Similarity GetSimilarity()
- {
- return scorer.GetSimilarity();
- }
-
- public override float Score()
+
+ public override Similarity Similarity
+ {
+ get { return scorer.Similarity; }
+ }
+
+ public override float Score()
{
int doc = scorer.DocID();
if (doc != curDoc)
Modified: incubator/lucene.net/trunk/src/core/Search/ScoreDoc.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/ScoreDoc.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/ScoreDoc.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/ScoreDoc.cs Mon Mar 12 22:29:26 2012
@@ -26,13 +26,8 @@ namespace Lucene.Net.Search
[Serializable]
public class ScoreDoc
{
- /// <summary>Expert: The score of this document for the query. </summary>
- public float score;
-
- /// <summary>Expert: A hit document's number.</summary>
- /// <seealso cref="Searcher.Doc(int)">
- /// </seealso>
- public int doc;
+ private float score;
+ private int doc;
/// <summary>Expert: Constructs a ScoreDoc. </summary>
public ScoreDoc(int doc, float score)
@@ -40,8 +35,24 @@ namespace Lucene.Net.Search
this.doc = doc;
this.score = score;
}
-
- // A convenience method for debugging.
+
+ /// <summary>Expert: The score of this document for the query. </summary>
+ public float Score
+ {
+ get { return score; }
+ set { score = value; }
+ }
+
+ /// <summary>Expert: A hit document's number.</summary>
+ /// <seealso cref="Searcher.Doc(int)">
+ /// </seealso>
+ public int Doc
+ {
+ get { return doc; }
+ set { doc = value; }
+ }
+
+ // A convenience method for debugging.
public override System.String ToString()
{
return "doc=" + doc + " score=" + score;
Modified: incubator/lucene.net/trunk/src/core/Search/Scorer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/Scorer.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Scorer.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Scorer.cs Mon Mar 12 22:29:26 2012
@@ -49,14 +49,14 @@ namespace Lucene.Net.Search
{
this.similarity = similarity;
}
-
- /// <summary>Returns the Similarity implementation used by this scorer. </summary>
- public virtual Similarity GetSimilarity()
- {
- return this.similarity;
- }
-
- /// <summary>Scores and collects all matching documents.</summary>
+
+ /// <summary>Returns the Similarity implementation used by this scorer. </summary>
+ public virtual Similarity Similarity
+ {
+ get { return this.similarity; }
+ }
+
+ /// <summary>Scores and collects all matching documents.</summary>
/// <param name="collector">The collector to which all matching documents are passed.
/// </param>
public virtual void Score(Collector collector)
Modified: incubator/lucene.net/trunk/src/core/Search/Searchable.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/Searchable.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Searchable.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Searchable.cs Mon Mar 12 22:29:26 2012
@@ -16,7 +16,7 @@
*/
using System;
-
+using Lucene.Net.Documents;
using Document = Lucene.Net.Documents.Document;
using FieldSelector = Lucene.Net.Documents.FieldSelector;
using CorruptIndexException = Lucene.Net.Index.CorruptIndexException;
@@ -131,7 +131,7 @@ namespace Lucene.Net.Search
/// </summary>
/// <seealso cref="Lucene.Net.Index.IndexReader.Document(int, FieldSelector)">
/// </seealso>
- /// <seealso cref="Lucene.Net.Documents.Fieldable">
+ /// <seealso cref="IFieldable">
/// </seealso>
/// <seealso cref="Lucene.Net.Documents.FieldSelector">
/// </seealso>
Modified: incubator/lucene.net/trunk/src/core/Search/Searcher.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/Searcher.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Searcher.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Searcher.cs Mon Mar 12 22:29:26 2012
@@ -39,7 +39,7 @@ namespace Lucene.Net.Search
}
private void InitBlock()
{
- similarity = Similarity.GetDefault();
+ similarity = Net.Search.Similarity.Default;
}
/// <summary>Search implementation with arbitrary sorting. Finds
@@ -133,27 +133,19 @@ namespace Lucene.Net.Search
/// <summary>The Similarity implementation used by this searcher. </summary>
private Similarity similarity;
-
- /// <summary>Expert: Set the Similarity implementation used by this Searcher.
- ///
- /// </summary>
- /// <seealso cref="Similarity.SetDefault(Similarity)">
- /// </seealso>
- public virtual void SetSimilarity(Similarity similarity)
- {
- this.similarity = similarity;
- }
-
- /// <summary>Expert: Return the Similarity implementation used by this Searcher.
- ///
- /// <p/>This defaults to the current value of <see cref="Similarity.GetDefault()" />.
- /// </summary>
- public virtual Similarity GetSimilarity()
- {
- return this.similarity;
- }
-
- /// <summary> creates a weight for <c>query</c></summary>
+
+ /// <summary>Expert: Gets or Sets the Similarity implementation used by this Searcher.
+ ///
+ /// </summary>
+ /// <seealso cref="Similarity.SetDefault(Similarity)">
+ /// </seealso>
+ public virtual Similarity Similarity
+ {
+ get { return this.similarity; }
+ set { this.similarity = value; }
+ }
+
+ /// <summary> creates a weight for <c>query</c></summary>
/// <returns> new weight
/// </returns>
public /*protected internal*/ virtual Weight CreateWeight(Query query)
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=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Similarity.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Similarity.cs Mon Mar 12 22:29:26 2012
@@ -17,6 +17,7 @@
using System;
using System.Collections.Generic;
+using Lucene.Net.Documents;
using FieldInvertState = Lucene.Net.Index.FieldInvertState;
using Term = Lucene.Net.Index.Term;
using SmallFloat = Lucene.Net.Util.SmallFloat;
@@ -229,7 +230,7 @@ namespace Lucene.Net.Search
/// before adding the document to the index.
/// </item>
/// <item><b>Field boost</b> - set by calling
- /// <see cref="Lucene.Net.Documents.Fieldable.SetBoost(float)">field.SetBoost()</see>
+ /// <see cref="IFieldable.SetBoost(float)">field.SetBoost()</see>
/// before adding the field to a document.
/// </item>
/// <item><see cref="LengthNorm(String, int)">LengthNorm(field)</see> - computed
@@ -257,7 +258,7 @@ namespace Lucene.Net.Search
/// <big><big><big>∏</big></big></big>
/// </td>
/// <td valign="middle" align="right" rowspan="1">
- /// <see cref="Lucene.Net.Documents.Fieldable.GetBoost()">field.GetBoost()</see>
+ /// <see cref="IFieldable.GetBoost()">field.GetBoost()</see>
/// </td>
/// </tr>
/// <tr valigh="top">
@@ -327,10 +328,11 @@ namespace Lucene.Net.Search
return "idf(docFreq=" + df + ", maxDocs=" + max + ")";
}
//@Override
- public override float GetIdf()
- {
- return idf;
- }
+
+ public override float Idf
+ {
+ get { return idf; }
+ }
}
[Serializable]
private class AnonymousClassIDFExplanation3:IDFExplanation
@@ -357,11 +359,13 @@ namespace Lucene.Net.Search
}
//@Override
- public override float GetIdf()
- {
- return fIdf;
- }
- //@Override
+
+ public override float Idf
+ {
+ get { return fIdf; }
+ }
+
+ //@Override
public override System.String Explain()
{
return exp.ToString();
@@ -375,36 +379,22 @@ namespace Lucene.Net.Search
/// <summary>The Similarity implementation used by default.</summary>
private static Similarity defaultImpl = new DefaultSimilarity();
public const int NO_DOC_ID_PROVIDED = - 1;
-
- /// <summary>Set the default Similarity implementation used by indexing and search
- /// code.
- ///
- /// </summary>
- /// <seealso cref="Searcher.SetSimilarity(Similarity)">
- /// </seealso>
- /// <seealso cref="Lucene.Net.Index.IndexWriter.SetSimilarity(Similarity)">
- /// </seealso>
- public static void SetDefault(Similarity similarity)
- {
- Similarity.defaultImpl = similarity;
- }
-
- /// <summary>Return the default Similarity implementation used by indexing and search
- /// code.
- ///
- /// <p/>This is initially an instance of <see cref="DefaultSimilarity" />.
- ///
- /// </summary>
- /// <seealso cref="Searcher.SetSimilarity(Similarity)">
- /// </seealso>
- /// <seealso cref="Lucene.Net.Index.IndexWriter.SetSimilarity(Similarity)">
- /// </seealso>
- public static Similarity GetDefault()
- {
- return Similarity.defaultImpl;
- }
-
- /// <summary>Cache of decoded bytes. </summary>
+
+ /// <summary>Gets or sets the default Similarity implementation
+ /// used by indexing and search code.
+ /// <p/>This is initially an instance of <see cref="DefaultSimilarity" />.
+ /// </summary>
+ /// <seealso cref="Searcher.Similarity">
+ /// </seealso>
+ /// <seealso cref="Lucene.Net.Index.IndexWriter.SetSimilarity(Similarity)">
+ /// </seealso>
+ public static Similarity Default
+ {
+ get { return defaultImpl; }
+ set { defaultImpl = value; }
+ }
+
+ /// <summary>Cache of decoded bytes. </summary>
private static readonly float[] NORM_TABLE = new float[256];
/// <summary>Decodes a normalization factor stored in an index.</summary>
@@ -446,7 +436,7 @@ namespace Lucene.Net.Search
/// </returns>
public virtual float ComputeNorm(System.String field, FieldInvertState state)
{
- return (float) (state.GetBoost() * LengthNorm(field, state.GetLength()));
+ return (float) (state.Boost * LengthNorm(field, state.Length));
}
/// <summary>Computes the normalization value for a field given the total number of
Modified: incubator/lucene.net/trunk/src/core/Search/SingleTermEnum.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/SingleTermEnum.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/SingleTermEnum.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/SingleTermEnum.cs Mon Mar 12 22:29:26 2012
@@ -54,7 +54,7 @@ namespace Lucene.Net.Search
return _endEnum;
}
- public override bool TermCompare(Term term)
+ protected internal override bool TermCompare(Term term)
{
if (term.Equals(singleTerm))
{
Modified: incubator/lucene.net/trunk/src/core/Search/SloppyPhraseScorer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/SloppyPhraseScorer.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/SloppyPhraseScorer.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/SloppyPhraseScorer.cs Mon Mar 12 22:29:26 2012
@@ -84,7 +84,7 @@ namespace Lucene.Net.Search
int matchLength = end - start;
if (matchLength <= slop)
- freq += GetSimilarity().SloppyFreq(matchLength); // score match
+ freq += Similarity.SloppyFreq(matchLength); // score match
if (pp.position > end)
end = pp.position;
Modified: incubator/lucene.net/trunk/src/core/Search/SortField.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/SortField.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/SortField.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/SortField.cs Mon Mar 12 22:29:26 2012
@@ -16,6 +16,7 @@
*/
using System;
+using System.Globalization;
using Lucene.Net.Support;
using NumericField = Lucene.Net.Documents.NumericField;
using IndexReader = Lucene.Net.Index.IndexReader;
@@ -144,11 +145,11 @@ namespace Lucene.Net.Search
}
/// <summary>Creates a sort by terms in the given field, parsed
- /// to numeric values using a custom <see cref="Parser" />.
+ /// to numeric values using a custom <see cref="Search.Parser" />.
/// </summary>
/// <param name="field"> Name of field to sort by. Must not be null.
/// </param>
- /// <param name="parser">Instance of a <see cref="Parser" />,
+ /// <param name="parser">Instance of a <see cref="Search.Parser" />,
/// which must subclass one of the existing numeric
/// parsers from <see cref="FieldCache" />. Sort type is inferred
/// by testing which numeric parser the parser subclasses.
@@ -161,11 +162,11 @@ namespace Lucene.Net.Search
}
/// <summary>Creates a sort, possibly in reverse, by terms in the given field, parsed
- /// to numeric values using a custom <see cref="Parser" />.
+ /// to numeric values using a custom <see cref="Search.Parser" />.
/// </summary>
/// <param name="field"> Name of field to sort by. Must not be null.
/// </param>
- /// <param name="parser">Instance of a <see cref="Parser" />,
+ /// <param name="parser">Instance of a <see cref="Search.Parser" />,
/// which must subclass one of the existing numeric
/// parsers from <see cref="FieldCache" />. Sort type is inferred
/// by testing which numeric parser the parser subclasses.
@@ -265,63 +266,58 @@ namespace Lucene.Net.Search
this.field = StringHelper.Intern(field);
}
}
-
- /// <summary>Returns the name of the field. Could return <c>null</c>
- /// if the sort is by SCORE or DOC.
- /// </summary>
- /// <returns> Name of field, possibly <c>null</c>.
- /// </returns>
- public virtual System.String GetField()
- {
- return field;
- }
-
- /// <summary>Returns the type of contents in the field.</summary>
- /// <returns> One of the constants SCORE, DOC, STRING, INT or FLOAT.
- /// </returns>
- public new virtual int GetType()
- {
- return type;
- }
-
- /// <summary>Returns the Locale by which term values are interpreted.
- /// May return <c>null</c> if no Locale was specified.
- /// </summary>
- /// <returns> Locale, or <c>null</c>.
- /// </returns>
- public virtual System.Globalization.CultureInfo GetLocale()
- {
- return locale;
- }
-
- /// <summary>Returns the instance of a <see cref="FieldCache" /> parser that fits to the given sort type.
- /// May return <c>null</c> if no parser was specified. Sorting is using the default parser then.
- /// </summary>
- /// <returns> An instance of a <see cref="FieldCache" /> parser, or <c>null</c>.
- /// </returns>
- public virtual Lucene.Net.Search.Parser GetParser()
- {
- return parser;
- }
-
- /// <summary>Returns whether the sort should be reversed.</summary>
- /// <returns> True if natural order should be reversed.
- /// </returns>
- public virtual bool GetReverse()
- {
- return reverse;
- }
-
- /// <summary>
- /// Returns the <see cref="FieldComparatorSource"/> used for
- /// custom sorting
- /// </summary>
- public virtual FieldComparatorSource GetComparatorSource()
- {
- return comparatorSource;
- }
-
- public override System.String ToString()
+
+ /// <summary>Returns the name of the field. Could return <c>null</c>
+ /// if the sort is by SCORE or DOC.
+ /// </summary>
+ /// <value> Name of field, possibly <c>null</c>. </value>
+ public virtual string Field
+ {
+ get { return field; }
+ }
+
+ /// <summary>Returns the type of contents in the field.</summary>
+ /// <value> One of the constants SCORE, DOC, STRING, INT or FLOAT. </value>
+ public virtual int Type
+ {
+ get { return type; }
+ }
+
+ /// <summary>Returns the Locale by which term values are interpreted.
+ /// May return <c>null</c> if no Locale was specified.
+ /// </summary>
+ /// <value> Locale, or <c>null</c>. </value>
+ public virtual CultureInfo Locale
+ {
+ get { return locale; }
+ }
+
+ /// <summary>Returns the instance of a <see cref="FieldCache" /> parser that fits to the given sort type.
+ /// May return <c>null</c> if no parser was specified. Sorting is using the default parser then.
+ /// </summary>
+ /// <value> An instance of a <see cref="FieldCache" /> parser, or <c>null</c>. </value>
+ public virtual Parser Parser
+ {
+ get { return parser; }
+ }
+
+ /// <summary>Returns whether the sort should be reversed.</summary>
+ /// <value> True if natural order should be reversed. </value>
+ public virtual bool Reverse
+ {
+ get { return reverse; }
+ }
+
+ /// <summary>
+ /// Returns the <see cref="FieldComparatorSource"/> used for
+ /// custom sorting
+ /// </summary>
+ public virtual FieldComparatorSource ComparatorSource
+ {
+ get { return comparatorSource; }
+ }
+
+ public override System.String ToString()
{
System.Text.StringBuilder buffer = new System.Text.StringBuilder();
switch (type)
@@ -388,7 +384,7 @@ namespace Lucene.Net.Search
}
/// <summary>Returns true if <c>o</c> is equal to this. If a
- /// <see cref="FieldComparatorSource" /> or <see cref="Parser" />
+ /// <see cref="FieldComparatorSource" /> or <see cref="Search.Parser" />
/// was provided, it must properly
/// implement equals (unless a singleton is always used).
/// </summary>
@@ -409,7 +405,7 @@ namespace Lucene.Net.Search
}
/// <summary>Returns true if <c>o</c> is equal to this. If a
- /// <see cref="FieldComparatorSource" /> (deprecated) or <see cref="Parser" />
+ /// <see cref="FieldComparatorSource" /> (deprecated) or <see cref="Search.Parser" />
/// was provided, it must properly
/// implement hashCode (unless a singleton is always
/// used).
Modified: incubator/lucene.net/trunk/src/core/Search/SpanFilterResult.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/SpanFilterResult.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/SpanFilterResult.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/SpanFilterResult.cs Mon Mar 12 22:29:26 2012
@@ -40,24 +40,23 @@ namespace Lucene.Net.Search
this.docIdSet = docIdSet;
this.positions = positions;
}
-
- /// <summary> The first entry in the array corresponds to the first "on" bit.
- /// Entries are increasing by document order
- /// </summary>
- /// <returns> A List of PositionInfo objects
- /// </returns>
- public virtual IList<PositionInfo> GetPositions()
- {
- return positions;
- }
-
- /// <summary>Returns the docIdSet </summary>
- public virtual DocIdSet GetDocIdSet()
- {
- return docIdSet;
- }
-
- public class PositionInfo
+
+ /// <summary> The first entry in the array corresponds to the first "on" bit.
+ /// Entries are increasing by document order
+ /// </summary>
+ /// <value> A List of PositionInfo objects </value>
+ public virtual IList<PositionInfo> Positions
+ {
+ get { return positions; }
+ }
+
+ /// <summary>Returns the docIdSet </summary>
+ public virtual DocIdSet DocIdSet
+ {
+ get { return docIdSet; }
+ }
+
+ public class PositionInfo
{
private int doc;
private IList<StartEnd> positions;
@@ -73,19 +72,18 @@ namespace Lucene.Net.Search
{
positions.Add(new StartEnd(start, end));
}
-
- public virtual int GetDoc()
- {
- return doc;
- }
-
- /// <summary> </summary>
- /// <returns> A List of <see cref="Lucene.Net.Search.SpanFilterResult.StartEnd" /> objects
- /// </returns>
- public virtual IList<StartEnd> GetPositions()
- {
- return positions;
- }
+
+ public virtual int Doc
+ {
+ get { return doc; }
+ }
+
+ /// <summary> </summary>
+ /// <value> A List of <see cref="Lucene.Net.Search.SpanFilterResult.StartEnd" /> objects </value>
+ public virtual IList<StartEnd> Positions
+ {
+ get { return positions; }
+ }
}
public class StartEnd
@@ -99,22 +97,20 @@ namespace Lucene.Net.Search
this.start = start;
this.end = end;
}
-
- /// <summary> </summary>
- /// <returns> The end position of this match
- /// </returns>
- public virtual int GetEnd()
- {
- return end;
- }
-
- /// <summary> The Start position</summary>
- /// <returns> The start position of this match
- /// </returns>
- public virtual int GetStart()
- {
- return start;
- }
+
+ /// <summary> </summary>
+ /// <value> The end position of this match </value>
+ public virtual int End
+ {
+ get { return end; }
+ }
+
+ /// <summary> The Start position</summary>
+ /// <value> The start position of this match </value>
+ public virtual int Start
+ {
+ get { return start; }
+ }
}
}
}
\ No newline at end of file
Modified: incubator/lucene.net/trunk/src/core/Search/SpanQueryFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/SpanQueryFilter.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/SpanQueryFilter.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/SpanQueryFilter.cs Mon Mar 12 22:29:26 2012
@@ -59,13 +59,13 @@ namespace Lucene.Net.Search
public override DocIdSet GetDocIdSet(IndexReader reader)
{
SpanFilterResult result = BitSpans(reader);
- return result.GetDocIdSet();
+ return result.DocIdSet;
}
public override SpanFilterResult BitSpans(IndexReader reader)
{
- OpenBitSet bits = new OpenBitSet(reader.MaxDoc());
+ OpenBitSet bits = new OpenBitSet(reader.MaxDoc);
Lucene.Net.Search.Spans.Spans spans = query.GetSpans(reader);
IList<SpanFilterResult.PositionInfo> tmp = new List<SpanFilterResult.PositionInfo>(20);
int currentDoc = - 1;
@@ -84,14 +84,14 @@ namespace Lucene.Net.Search
}
return new SpanFilterResult(bits, tmp);
}
-
-
- public virtual SpanQuery GetQuery()
- {
- return query;
- }
-
- public override System.String ToString()
+
+
+ public virtual SpanQuery Query
+ {
+ get { return query; }
+ }
+
+ public override System.String ToString()
{
return "SpanQueryFilter(" + query + ")";
}
Modified: incubator/lucene.net/trunk/src/core/Search/Spans/FieldMaskingSpanQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/Spans/FieldMaskingSpanQuery.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Spans/FieldMaskingSpanQuery.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Spans/FieldMaskingSpanQuery.cs Mon Mar 12 22:29:26 2012
@@ -79,18 +79,18 @@ namespace Lucene.Net.Search.Spans
this.maskedQuery = maskedQuery;
this.field = maskedField;
}
-
- public override System.String GetField()
- {
- return field;
- }
-
- public virtual SpanQuery GetMaskedQuery()
- {
- return maskedQuery;
- }
-
- // :NOTE: getBoost and setBoost are not proxied to the maskedQuery
+
+ public override string Field
+ {
+ get { return field; }
+ }
+
+ public virtual SpanQuery MaskedQuery
+ {
+ get { return maskedQuery; }
+ }
+
+ // :NOTE: getBoost and setBoost are not proxied to the maskedQuery
// ...this is done to be more consistent with thigns like SpanFirstQuery
public override Spans GetSpans(IndexReader reader)
@@ -140,7 +140,7 @@ namespace Lucene.Net.Search.Spans
buffer.Append("mask(");
buffer.Append(maskedQuery.ToString(field));
buffer.Append(")");
- buffer.Append(ToStringUtils.Boost(GetBoost()));
+ buffer.Append(ToStringUtils.Boost(Boost));
buffer.Append(" as ");
buffer.Append(this.field);
return buffer.ToString();
@@ -151,12 +151,12 @@ namespace Lucene.Net.Search.Spans
if (!(o is FieldMaskingSpanQuery))
return false;
FieldMaskingSpanQuery other = (FieldMaskingSpanQuery) o;
- return (this.GetField().Equals(other.GetField()) && (this.GetBoost() == other.GetBoost()) && this.GetMaskedQuery().Equals(other.GetMaskedQuery()));
+ return (this.Field.Equals(other.Field) && (this.Boost == other.Boost) && this.MaskedQuery.Equals(other.MaskedQuery));
}
public override int GetHashCode()
{
- return GetMaskedQuery().GetHashCode() ^ GetField().GetHashCode() ^ System.Convert.ToInt32(GetBoost());
+ return MaskedQuery.GetHashCode() ^ Field.GetHashCode() ^ System.Convert.ToInt32(Boost);
}
}
}
\ No newline at end of file
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=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Spans/NearSpansOrdered.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Spans/NearSpansOrdered.cs Mon Mar 12 22:29:26 2012
@@ -16,7 +16,7 @@
*/
using System;
-
+using System.Collections.Generic;
using IndexReader = Lucene.Net.Index.IndexReader;
namespace Lucene.Net.Search.Spans
@@ -107,7 +107,7 @@ namespace Lucene.Net.Search.Spans
throw new System.ArgumentException("Less than 2 clauses: " + spanNearQuery);
}
this.collectPayloads = collectPayloads;
- allowedSlop = spanNearQuery.GetSlop();
+ allowedSlop = spanNearQuery.Slop;
SpanQuery[] clauses = spanNearQuery.GetClauses();
subSpans = new Spans[clauses.Length];
matchPayload = new System.Collections.Generic.List<byte[]>();
@@ -145,18 +145,20 @@ 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 System.Collections.Generic.ICollection<byte[]> GetPayload()
- {
- return matchPayload;
- }
-
- // TODO: Remove warning after API has been finalized
- public override bool IsPayloadAvailable()
- {
- return (matchPayload.Count == 0) == false;
- }
-
- // inherit javadocs
+
+ public override ICollection<byte[]> Payload
+ {
+ get { return matchPayload; }
+ }
+
+ // TODO: Remove warning after API has been finalized
+
+ public override bool IsPayloadAvailable
+ {
+ get { return (matchPayload.Count == 0) == false; }
+ }
+
+ // inherit javadocs
public override bool Next()
{
if (firstTime)
@@ -324,9 +326,9 @@ namespace Lucene.Net.Search.Spans
matchStart = subSpans[subSpans.Length - 1].Start();
matchEnd = subSpans[subSpans.Length - 1].End();
System.Collections.Generic.Dictionary<byte[], byte[]> possibleMatchPayloads = new System.Collections.Generic.Dictionary<byte[], byte[]>();
- if (subSpans[subSpans.Length - 1].IsPayloadAvailable())
+ if (subSpans[subSpans.Length - 1].IsPayloadAvailable)
{
- System.Collections.Generic.ICollection<byte[]> payload = subSpans[subSpans.Length - 1].GetPayload();
+ System.Collections.Generic.ICollection<byte[]> payload = subSpans[subSpans.Length - 1].Payload;
foreach(byte[] pl in payload)
{
if (!possibleMatchPayloads.ContainsKey(pl))
@@ -344,9 +346,9 @@ namespace Lucene.Net.Search.Spans
for (int i = subSpans.Length - 2; i >= 0; i--)
{
Spans prevSpans = subSpans[i];
- if (collectPayloads && prevSpans.IsPayloadAvailable())
+ if (collectPayloads && prevSpans.IsPayloadAvailable)
{
- System.Collections.Generic.ICollection<byte[]> payload = prevSpans.GetPayload();
+ System.Collections.Generic.ICollection<byte[]> payload = prevSpans.Payload;
possiblePayload = new System.Collections.Generic.List<byte[]>(payload.Count);
possiblePayload.AddRange(payload);
}
@@ -380,9 +382,9 @@ namespace Lucene.Net.Search.Spans
// prevSpans still before (lastStart, lastEnd)
prevStart = ppStart;
prevEnd = ppEnd;
- if (collectPayloads && prevSpans.IsPayloadAvailable())
+ if (collectPayloads && prevSpans.IsPayloadAvailable)
{
- System.Collections.Generic.ICollection<byte[]> payload = prevSpans.GetPayload();
+ System.Collections.Generic.ICollection<byte[]> payload = prevSpans.Payload;
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=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Spans/NearSpansUnordered.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Spans/NearSpansUnordered.cs Mon Mar 12 22:29:26 2012
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using System.Linq;
using Lucene.Net.Util;
using IndexReader = Lucene.Net.Index.IndexReader;
@@ -153,18 +154,20 @@ namespace Lucene.Net.Search.Spans
return spans.End();
}
// TODO: Remove warning after API has been finalized
- public override System.Collections.Generic.ICollection<byte[]> GetPayload()
- {
- return spans.GetPayload().ToArray();
- }
-
- // TODO: Remove warning after API has been finalized
- public override bool IsPayloadAvailable()
- {
- return spans.IsPayloadAvailable();
- }
-
- public override System.String ToString()
+
+ public override ICollection<byte[]> Payload
+ {
+ get { return spans.Payload.ToArray(); }
+ }
+
+ // TODO: Remove warning after API has been finalized
+
+ public override bool IsPayloadAvailable
+ {
+ get { return spans.IsPayloadAvailable; }
+ }
+
+ public override System.String ToString()
{
return spans.ToString() + "#" + index;
}
@@ -174,7 +177,7 @@ namespace Lucene.Net.Search.Spans
public NearSpansUnordered(SpanNearQuery query, IndexReader reader)
{
this.query = query;
- this.slop = query.GetSlop();
+ this.slop = query.Slop;
SpanQuery[] clauses = query.GetClauses();
queue = new CellQueue(this, clauses.Length);
@@ -312,40 +315,47 @@ 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>
- /// <returns> Collection of <c>byte[]</c> payloads
- /// </returns>
- /// <throws> IOException </throws>
- public override System.Collections.Generic.ICollection<byte[]> GetPayload()
- {
- System.Collections.Generic.ISet<byte[]> matchPayload = new System.Collections.Generic.HashSet<byte[]>();
- for (SpansCell cell = first; cell != null; cell = cell.next)
- {
- if (cell.IsPayloadAvailable())
- {
- matchPayload.UnionWith(cell.GetPayload());
- }
- }
- return matchPayload;
- }
-
- // TODO: Remove warning after API has been finalized
- public override bool IsPayloadAvailable()
- {
- SpansCell pointer = Min();
- while (pointer != null)
- {
- if (pointer.IsPayloadAvailable())
- {
- return true;
- }
- pointer = pointer.next;
- }
-
- return false;
- }
-
- public override System.String ToString()
+
+ /// <summary> WARNING: The List is not necessarily in order of the the positions</summary>
+ /// <value> Collection of <c>byte[]</c> payloads </value>
+ /// <throws> IOException </throws>
+ public override ICollection<byte[]> Payload
+ {
+ get
+ {
+ System.Collections.Generic.ISet<byte[]> matchPayload = new System.Collections.Generic.HashSet<byte[]>();
+ for (SpansCell cell = first; cell != null; cell = cell.next)
+ {
+ if (cell.IsPayloadAvailable)
+ {
+ matchPayload.UnionWith(cell.Payload);
+ }
+ }
+ return matchPayload;
+ }
+ }
+
+ // TODO: Remove warning after API has been finalized
+
+ public override bool IsPayloadAvailable
+ {
+ get
+ {
+ SpansCell pointer = Min();
+ while (pointer != null)
+ {
+ if (pointer.IsPayloadAvailable)
+ {
+ return true;
+ }
+ pointer = pointer.next;
+ }
+
+ return false;
+ }
+ }
+
+ public override System.String ToString()
{
return GetType().FullName + "(" + query.ToString() + ")@" + (firstTime?"START":(more?(Doc() + ":" + Start() + "-" + End()):"END"));
}
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=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Spans/SpanFirstQuery.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Spans/SpanFirstQuery.cs Mon Mar 12 22:29:26 2012
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using Lucene.Net.Index;
using Lucene.Net.Support;
using IndexReader = Lucene.Net.Index.IndexReader;
@@ -86,23 +87,28 @@ namespace Lucene.Net.Search.Spans
}
// TODO: Remove warning after API has been finalized
- public override System.Collections.Generic.ICollection<byte[]> GetPayload()
- {
- System.Collections.Generic.ICollection<byte[]> result = null;
- if (spans.IsPayloadAvailable())
- {
- result = spans.GetPayload();
- }
- return result; //TODO: any way to avoid the new construction?
- }
-
- // TODO: Remove warning after API has been finalized
- public override bool IsPayloadAvailable()
- {
- return spans.IsPayloadAvailable();
- }
-
- public override System.String ToString()
+
+ public override ICollection<byte[]> Payload
+ {
+ get
+ {
+ System.Collections.Generic.ICollection<byte[]> result = null;
+ if (spans.IsPayloadAvailable)
+ {
+ result = spans.Payload;
+ }
+ return result; //TODO: any way to avoid the new construction?
+ }
+ }
+
+ // TODO: Remove warning after API has been finalized
+
+ public override bool IsPayloadAvailable
+ {
+ get { return spans.IsPayloadAvailable; }
+ }
+
+ public override System.String ToString()
{
return "spans(" + Enclosing_Instance.ToString() + ")";
}
@@ -118,25 +124,25 @@ namespace Lucene.Net.Search.Spans
this.match = match;
this.end = end;
}
-
- /// <summary>Return the SpanQuery whose matches are filtered. </summary>
- public virtual SpanQuery GetMatch()
- {
- return match;
- }
-
- /// <summary>Return the maximum end position permitted in a match. </summary>
- public virtual int GetEnd()
- {
- return end;
- }
-
- public override System.String GetField()
- {
- return match.GetField();
- }
-
- public override System.String ToString(System.String field)
+
+ /// <summary>Return the SpanQuery whose matches are filtered. </summary>
+ public virtual SpanQuery Match
+ {
+ get { return match; }
+ }
+
+ /// <summary>Return the maximum end position permitted in a match. </summary>
+ public virtual int End
+ {
+ get { return end; }
+ }
+
+ public override string Field
+ {
+ get { return match.Field; }
+ }
+
+ public override System.String ToString(System.String field)
{
System.Text.StringBuilder buffer = new System.Text.StringBuilder();
buffer.Append("spanFirst(");
@@ -144,14 +150,14 @@ namespace Lucene.Net.Search.Spans
buffer.Append(", ");
buffer.Append(end);
buffer.Append(")");
- buffer.Append(ToStringUtils.Boost(GetBoost()));
+ buffer.Append(ToStringUtils.Boost(Boost));
return buffer.ToString();
}
public override System.Object Clone()
{
SpanFirstQuery spanFirstQuery = new SpanFirstQuery((SpanQuery) match.Clone(), end);
- spanFirstQuery.SetBoost(GetBoost());
+ spanFirstQuery.Boost = Boost;
return spanFirstQuery;
}
@@ -194,14 +200,14 @@ namespace Lucene.Net.Search.Spans
return false;
SpanFirstQuery other = (SpanFirstQuery) o;
- return this.end == other.end && this.match.Equals(other.match) && this.GetBoost() == other.GetBoost();
+ return this.end == other.end && this.match.Equals(other.match) && this.Boost == other.Boost;
}
public override int GetHashCode()
{
int h = match.GetHashCode();
h ^= ((h << 8) | (Number.URShift(h, 25))); // reversible
- h ^= System.Convert.ToInt32(GetBoost()) ^ end;
+ h ^= System.Convert.ToInt32(Boost) ^ end;
return h;
}
}
Modified: incubator/lucene.net/trunk/src/core/Search/Spans/SpanNearQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/Spans/SpanNearQuery.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Spans/SpanNearQuery.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Spans/SpanNearQuery.cs Mon Mar 12 22:29:26 2012
@@ -60,9 +60,9 @@ namespace Lucene.Net.Search.Spans
if (i == 0)
{
// check field
- field = clause.GetField();
+ field = clause.Field;
}
- else if (!clause.GetField().Equals(field))
+ else if (!clause.Field.Equals(field))
{
throw new System.ArgumentException("Clauses must have same field.");
}
@@ -76,35 +76,35 @@ namespace Lucene.Net.Search.Spans
/// <summary>Return the clauses whose spans are matched. </summary>
public virtual SpanQuery[] GetClauses()
{
+ // Return a copy
return clauses.ToArray();
}
-
- /// <summary>Return the maximum number of intervening unmatched positions permitted.</summary>
- public virtual int GetSlop()
- {
- return slop;
- }
-
- /// <summary>Return true if matches are required to be in-order.</summary>
- public virtual bool IsInOrder()
- {
- return inOrder;
- }
-
- public override System.String GetField()
- {
- return field;
- }
-
- public override void ExtractTerms(System.Collections.Generic.ISet<Term> terms)
+
+ /// <summary>Return the maximum number of intervening unmatched positions permitted.</summary>
+ public virtual int Slop
+ {
+ get { return slop; }
+ }
+
+ /// <summary>Return true if matches are required to be in-order.</summary>
+ public virtual bool IsInOrder
+ {
+ get { return inOrder; }
+ }
+
+ public override string Field
+ {
+ get { return field; }
+ }
+
+ public override void ExtractTerms(System.Collections.Generic.ISet<Term> terms)
{
foreach (SpanQuery clause in clauses)
{
clause.ExtractTerms(terms);
}
}
-
-
+
public override System.String ToString(System.String field)
{
System.Text.StringBuilder buffer = new System.Text.StringBuilder();
@@ -122,7 +122,7 @@ namespace Lucene.Net.Search.Spans
buffer.Append(", ");
buffer.Append(inOrder);
buffer.Append(")");
- buffer.Append(ToStringUtils.Boost(GetBoost()));
+ buffer.Append(ToStringUtils.Boost(Boost));
return buffer.ToString();
}
@@ -175,7 +175,7 @@ namespace Lucene.Net.Search.Spans
newClauses[i] = (SpanQuery) clause.Clone();
}
SpanNearQuery spanNearQuery = new SpanNearQuery(newClauses, slop, inOrder);
- spanNearQuery.SetBoost(GetBoost());
+ spanNearQuery.Boost = Boost;
return spanNearQuery;
}
@@ -205,7 +205,7 @@ namespace Lucene.Net.Search.Spans
return false;
}
- return GetBoost() == spanNearQuery.GetBoost();
+ return Boost == spanNearQuery.Boost;
}
public override int GetHashCode()
@@ -221,7 +221,7 @@ namespace Lucene.Net.Search.Spans
// last element of clauses. This particular mix also serves to
// differentiate SpanNearQuery hashcodes from others.
result ^= ((result << 14) | (Number.URShift(result, 19))); // reversible
- result += System.Convert.ToInt32(GetBoost());
+ result += System.Convert.ToInt32(Boost);
result += slop;
result ^= (inOrder ? (long) 0x99AFD3BD : 0);
return (int) result;
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=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Spans/SpanNotQuery.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Spans/SpanNotQuery.cs Mon Mar 12 22:29:26 2012
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using Lucene.Net.Index;
using Lucene.Net.Support;
using IndexReader = Lucene.Net.Index.IndexReader;
@@ -122,23 +123,28 @@ namespace Lucene.Net.Search.Spans
}
// TODO: Remove warning after API has been finalizedb
- public override System.Collections.Generic.ICollection<byte[]> GetPayload()
- {
- System.Collections.Generic.ICollection<byte[]> result = null;
- if (includeSpans.IsPayloadAvailable())
- {
- result = includeSpans.GetPayload();
- }
- return result;
- }
-
- // TODO: Remove warning after API has been finalized
- public override bool IsPayloadAvailable()
- {
- return includeSpans.IsPayloadAvailable();
- }
-
- public override System.String ToString()
+
+ public override ICollection<byte[]> Payload
+ {
+ get
+ {
+ System.Collections.Generic.ICollection<byte[]> result = null;
+ if (includeSpans.IsPayloadAvailable)
+ {
+ result = includeSpans.Payload;
+ }
+ return result;
+ }
+ }
+
+ // TODO: Remove warning after API has been finalized
+
+ public override bool IsPayloadAvailable
+ {
+ get { return includeSpans.IsPayloadAvailable; }
+ }
+
+ public override System.String ToString()
{
return "spans(" + Enclosing_Instance.ToString() + ")";
}
@@ -154,28 +160,28 @@ namespace Lucene.Net.Search.Spans
this.include = include;
this.exclude = exclude;
- if (!include.GetField().Equals(exclude.GetField()))
+ if (!include.Field.Equals(exclude.Field))
throw new System.ArgumentException("Clauses must have same field.");
}
-
- /// <summary>Return the SpanQuery whose matches are filtered. </summary>
- public virtual SpanQuery GetInclude()
- {
- return include;
- }
-
- /// <summary>Return the SpanQuery whose matches must not overlap those returned. </summary>
- public virtual SpanQuery GetExclude()
- {
- return exclude;
- }
-
- public override System.String GetField()
- {
- return include.GetField();
- }
-
- public override void ExtractTerms(System.Collections.Generic.ISet<Term> terms)
+
+ /// <summary>Return the SpanQuery whose matches are filtered. </summary>
+ public virtual SpanQuery Include
+ {
+ get { return include; }
+ }
+
+ /// <summary>Return the SpanQuery whose matches must not overlap those returned. </summary>
+ public virtual SpanQuery Exclude
+ {
+ get { return exclude; }
+ }
+
+ public override string Field
+ {
+ get { return include.Field; }
+ }
+
+ public override void ExtractTerms(System.Collections.Generic.ISet<Term> terms)
{
include.ExtractTerms(terms);
}
@@ -188,14 +194,14 @@ namespace Lucene.Net.Search.Spans
buffer.Append(", ");
buffer.Append(exclude.ToString(field));
buffer.Append(")");
- buffer.Append(ToStringUtils.Boost(GetBoost()));
+ buffer.Append(ToStringUtils.Boost(Boost));
return buffer.ToString();
}
public override System.Object Clone()
{
SpanNotQuery spanNotQuery = new SpanNotQuery((SpanQuery) include.Clone(), (SpanQuery) exclude.Clone());
- spanNotQuery.SetBoost(GetBoost());
+ spanNotQuery.Boost = Boost;
return spanNotQuery;
}
@@ -241,7 +247,7 @@ namespace Lucene.Net.Search.Spans
return false;
SpanNotQuery other = (SpanNotQuery) o;
- return this.include.Equals(other.include) && this.exclude.Equals(other.exclude) && this.GetBoost() == other.GetBoost();
+ return this.include.Equals(other.include) && this.exclude.Equals(other.exclude) && this.Boost == other.Boost;
}
public override int GetHashCode()
@@ -250,7 +256,7 @@ namespace Lucene.Net.Search.Spans
h = (h << 1) | (Number.URShift(h, 31)); // rotate left
h ^= exclude.GetHashCode();
h = (h << 1) | (Number.URShift(h, 31)); // rotate left
- h ^= System.Convert.ToInt32(GetBoost());
+ h ^= System.Convert.ToInt32(Boost);
return h;
}
}
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=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Spans/SpanOrQuery.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Spans/SpanOrQuery.cs Mon Mar 12 22:29:26 2012
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
using Lucene.Net.Index;
using Lucene.Net.Support;
using Lucene.Net.Util;
@@ -137,25 +138,31 @@ namespace Lucene.Net.Search.Spans
{
return Top().End();
}
-
- public override System.Collections.Generic.ICollection<byte[]> GetPayload()
- {
- System.Collections.Generic.ICollection<byte[]> result = null;
- Spans theTop = Top();
- if (theTop != null && theTop.IsPayloadAvailable())
- {
- result = theTop.GetPayload();
- }
- return result;
- }
-
- public override bool IsPayloadAvailable()
- {
- Spans top = Top();
- return top != null && top.IsPayloadAvailable();
- }
-
- public override System.String ToString()
+
+ public override ICollection<byte[]> Payload
+ {
+ get
+ {
+ System.Collections.Generic.ICollection<byte[]> result = null;
+ Spans theTop = Top();
+ if (theTop != null && theTop.IsPayloadAvailable)
+ {
+ result = theTop.Payload;
+ }
+ return result;
+ }
+ }
+
+ public override bool IsPayloadAvailable
+ {
+ get
+ {
+ Spans top = Top();
+ return top != null && top.IsPayloadAvailable;
+ }
+ }
+
+ public override System.String ToString()
{
return "spans(" + Enclosing_Instance + ")@" + ((queue == null)?"START":(queue.Size() > 0?(Doc() + ":" + Start() + "-" + End()):"END"));
}
@@ -176,9 +183,9 @@ namespace Lucene.Net.Search.Spans
if (i == 0)
{
// check field
- field = clause.GetField();
+ field = clause.Field;
}
- else if (!clause.GetField().Equals(field))
+ else if (!clause.Field.Equals(field))
{
throw new System.ArgumentException("Clauses must have same field.");
}
@@ -191,13 +198,13 @@ namespace Lucene.Net.Search.Spans
{
return clauses.ToArray();
}
-
- public override System.String GetField()
- {
- return field;
- }
-
- public override void ExtractTerms(System.Collections.Generic.ISet<Term> terms)
+
+ public override string Field
+ {
+ get { return field; }
+ }
+
+ public override void ExtractTerms(System.Collections.Generic.ISet<Term> terms)
{
foreach(SpanQuery clause in clauses)
{
@@ -215,7 +222,7 @@ namespace Lucene.Net.Search.Spans
newClauses[i] = (SpanQuery) clauses[i].Clone();
}
SpanOrQuery soq = new SpanOrQuery(newClauses);
- soq.SetBoost(GetBoost());
+ soq.Boost = Boost;
return soq;
}
@@ -261,7 +268,7 @@ namespace Lucene.Net.Search.Spans
}
}
buffer.Append("])");
- buffer.Append(ToStringUtils.Boost(GetBoost()));
+ buffer.Append(ToStringUtils.Boost(Boost));
return buffer.ToString();
}
@@ -279,14 +286,14 @@ namespace Lucene.Net.Search.Spans
if (!(clauses.Count == 0) && !field.Equals(that.field))
return false;
- return GetBoost() == that.GetBoost();
+ return Boost == that.Boost;
}
public override int GetHashCode()
{
int h = clauses.GetHashCode();
h ^= ((h << 10) | (Number.URShift(h, 23)));
- h ^= System.Convert.ToInt32(GetBoost());
+ h ^= System.Convert.ToInt32(Boost);
return h;
}
Modified: incubator/lucene.net/trunk/src/core/Search/Spans/SpanQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/Spans/SpanQuery.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Spans/SpanQuery.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Spans/SpanQuery.cs Mon Mar 12 22:29:26 2012
@@ -33,11 +33,11 @@ namespace Lucene.Net.Search.Spans
/// to search for spans.
/// </summary>
public abstract Spans GetSpans(IndexReader reader);
-
- /// <summary>Returns the name of the field matched by this query.</summary>
- public abstract System.String GetField();
-
- public override Weight CreateWeight(Searcher searcher)
+
+ /// <summary>Returns the name of the field matched by this query.</summary>
+ public abstract string Field { get; }
+
+ public override Weight CreateWeight(Searcher searcher)
{
return new SpanWeight(this, searcher);
}
Modified: incubator/lucene.net/trunk/src/core/Search/Spans/SpanScorer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/Spans/SpanScorer.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Spans/SpanScorer.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Spans/SpanScorer.cs Mon Mar 12 22:29:26 2012
@@ -42,7 +42,7 @@ namespace Lucene.Net.Search.Spans
this.spans = spans;
this.norms = norms;
this.weight = weight;
- this.value_Renamed = weight.GetValue();
+ this.value_Renamed = weight.Value;
if (this.spans.Next())
{
doc = - 1;
@@ -92,7 +92,7 @@ namespace Lucene.Net.Search.Spans
do
{
int matchLength = spans.End() - spans.Start();
- freq += GetSimilarity().SloppyFreq(matchLength);
+ freq += Similarity.SloppyFreq(matchLength);
more = spans.Next();
}
while (more && (doc == spans.Doc()));
@@ -106,7 +106,7 @@ namespace Lucene.Net.Search.Spans
public override float Score()
{
- float raw = GetSimilarity().Tf(freq) * value_Renamed; // raw score
+ float raw = Similarity.Tf(freq) * value_Renamed; // raw score
return norms == null?raw:raw * Similarity.DecodeNorm(norms[doc]); // normalize
}
@@ -121,7 +121,7 @@ namespace Lucene.Net.Search.Spans
int expDoc = Advance(doc);
float phraseFreq = (expDoc == doc)?freq:0.0f;
- tfExplanation.Value = GetSimilarity().Tf(phraseFreq);
+ tfExplanation.Value = Similarity.Tf(phraseFreq);
tfExplanation.Description = "tf(phraseFreq=" + phraseFreq + ")";
return tfExplanation;
Modified: incubator/lucene.net/trunk/src/core/Search/Spans/SpanTermQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/Spans/SpanTermQuery.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Spans/SpanTermQuery.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Spans/SpanTermQuery.cs Mon Mar 12 22:29:26 2012
@@ -35,19 +35,19 @@ namespace Lucene.Net.Search.Spans
{
this.term = term;
}
-
- /// <summary>Return the term whose spans are matched. </summary>
- public virtual Term GetTerm()
- {
- return term;
- }
-
- public override System.String GetField()
- {
- return term.Field();
- }
- public override void ExtractTerms(System.Collections.Generic.ISet<Term> terms)
+ /// <summary>Return the term whose spans are matched. </summary>
+ public virtual Term Term
+ {
+ get { return term; }
+ }
+
+ public override string Field
+ {
+ get { return term.Field(); }
+ }
+
+ public override void ExtractTerms(System.Collections.Generic.ISet<Term> terms)
{
terms.Add(term);
}
@@ -61,7 +61,7 @@ namespace Lucene.Net.Search.Spans
{
buffer.Append(term.ToString());
}
- buffer.Append(ToStringUtils.Boost(GetBoost()));
+ buffer.Append(ToStringUtils.Boost(Boost));
return buffer.ToString();
}
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=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Spans/SpanWeight.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Spans/SpanWeight.cs Mon Mar 12 22:29:26 2012
@@ -48,25 +48,29 @@ namespace Lucene.Net.Search.Spans
query.ExtractTerms(terms);
idfExp = similarity.IdfExplain(terms, searcher);
- idf = idfExp.GetIdf();
+ idf = idfExp.Idf;
}
-
- public override Query GetQuery()
- {
- return query;
- }
- public override float GetValue()
- {
- return value_Renamed;
- }
-
- public override float SumOfSquaredWeights()
- {
- queryWeight = idf * query.GetBoost(); // compute query weight
- return queryWeight * queryWeight; // square it
- }
-
- public override void Normalize(float queryNorm)
+
+ public override Query Query
+ {
+ get { return query; }
+ }
+
+ public override float Value
+ {
+ get { return value_Renamed; }
+ }
+
+ public override float SumOfSquaredWeights
+ {
+ get
+ {
+ queryWeight = idf*query.Boost; // compute query weight
+ return queryWeight*queryWeight; // square it
+ }
+ }
+
+ public override void Normalize(float queryNorm)
{
this.queryNorm = queryNorm;
queryWeight *= queryNorm; // normalize query weight
@@ -75,24 +79,24 @@ namespace Lucene.Net.Search.Spans
public override Scorer Scorer(IndexReader reader, bool scoreDocsInOrder, bool topScorer)
{
- return new SpanScorer(query.GetSpans(reader), this, similarity, reader.Norms(query.GetField()));
+ return new SpanScorer(query.GetSpans(reader), this, similarity, reader.Norms(query.Field));
}
public override Explanation Explain(IndexReader reader, int doc)
{
ComplexExplanation result = new ComplexExplanation();
- result.Description = "weight(" + GetQuery() + " in " + doc + "), product of:";
- System.String field = ((SpanQuery) GetQuery()).GetField();
+ result.Description = "weight(" + Query + " in " + doc + "), product of:";
+ System.String field = ((SpanQuery) Query).Field;
Explanation idfExpl = new Explanation(idf, "idf(" + field + ": " + idfExp.Explain() + ")");
// explain query weight
Explanation queryExpl = new Explanation();
- queryExpl.Description = "queryWeight(" + GetQuery() + "), product of:";
+ queryExpl.Description = "queryWeight(" + Query + "), product of:";
- Explanation boostExpl = new Explanation(GetQuery().GetBoost(), "boost");
- if (GetQuery().GetBoost() != 1.0f)
+ Explanation boostExpl = new Explanation(Query.Boost, "boost");
+ if (Query.Boost != 1.0f)
queryExpl.AddDetail(boostExpl);
queryExpl.AddDetail(idfExpl);
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=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Spans/Spans.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Spans/Spans.cs Mon Mar 12 22:29:26 2012
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
namespace Lucene.Net.Search.Spans
{
@@ -53,40 +54,38 @@ namespace Lucene.Net.Search.Spans
/// <summary>Returns the end position of the current match. Initially invalid. </summary>
public abstract int End();
-
- /// <summary> Returns the payload data for the current span.
- /// This is invalid until <see cref="Next()" /> is called for
- /// the first time.
- /// This method must not be called more than once after each call
- /// of <see cref="Next()" />. However, most payloads are loaded lazily,
- /// so if the payload data for the current position is not needed,
- /// this method may not be called at all for performance reasons. An ordered
- /// SpanQuery does not lazy load, so if you have payloads in your index and
- /// you do not want ordered SpanNearQuerys to collect payloads, you can
- /// disable collection with a constructor option.<br/>
- ///
- /// Note that the return type is a collection, thus the ordering should not be relied upon.
- /// <br/>
- /// <p/><font color="#FF0000">
- /// WARNING: The status of the <b>Payloads</b> feature is experimental.
- /// The APIs introduced here might change in the future and will not be
- /// supported anymore in such a case.</font><p/>
- ///
- /// </summary>
- /// <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 System.Collections.Generic.ICollection<byte[]> GetPayload();
-
- /// <summary> Checks if a payload can be loaded at this position.
- /// <p/>
- /// Payloads can only be loaded once per call to
- /// <see cref="Next()" />.
- ///
- /// </summary>
- /// <returns> true if there is a payload available at this position that can be loaded
- /// </returns>
- public abstract bool IsPayloadAvailable();
+
+ /// <summary> Returns the payload data for the current span.
+ /// This is invalid until <see cref="Next()" /> is called for
+ /// the first time.
+ /// This method must not be called more than once after each call
+ /// of <see cref="Next()" />. However, most payloads are loaded lazily,
+ /// so if the payload data for the current position is not needed,
+ /// this method may not be called at all for performance reasons. An ordered
+ /// SpanQuery does not lazy load, so if you have payloads in your index and
+ /// you do not want ordered SpanNearQuerys to collect payloads, you can
+ /// disable collection with a constructor option.<br/>
+ ///
+ /// Note that the return type is a collection, thus the ordering should not be relied upon.
+ /// <br/>
+ /// <p/><font color="#FF0000">
+ /// WARNING: The status of the <b>Payloads</b> feature is experimental.
+ /// The APIs introduced here might change in the future and will not be
+ /// 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>
+ /// <throws> java.io.IOException </throws>
+ // TODO: Remove warning after API has been finalized
+ public abstract ICollection<byte[]> Payload { get; }
+
+ /// <summary> Checks if a payload can be loaded at this position.
+ /// <p/>
+ /// Payloads can only be loaded once per call to
+ /// <see cref="Next()" />.
+ ///
+ /// </summary>
+ /// <value> true if there is a payload available at this position that can be loaded </value>
+ public abstract bool IsPayloadAvailable { get; }
}
}
\ No newline at end of file
Modified: incubator/lucene.net/trunk/src/core/Search/Spans/TermSpans.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/Spans/TermSpans.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/Spans/TermSpans.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/Spans/TermSpans.cs Mon Mar 12 22:29:26 2012
@@ -16,7 +16,7 @@
*/
using System;
-
+using System.Collections.Generic;
using Term = Lucene.Net.Index.Term;
using TermPositions = Lucene.Net.Index.TermPositions;
@@ -96,30 +96,35 @@ namespace Lucene.Net.Search.Spans
}
// TODO: Remove warning after API has been finalized
- public override System.Collections.Generic.ICollection<byte[]> GetPayload()
- {
- byte[] bytes = new byte[positions.GetPayloadLength()];
- bytes = positions.GetPayload(bytes, 0);
- System.Collections.Generic.List<byte[]> val = new System.Collections.Generic.List<byte[]>();
- val.Add(bytes);
- return val;
- }
-
- // TODO: Remove warning after API has been finalized
- public override bool IsPayloadAvailable()
- {
- return positions.IsPayloadAvailable();
- }
-
- public override System.String ToString()
+
+ public override ICollection<byte[]> Payload
+ {
+ get
+ {
+ byte[] bytes = new byte[positions.PayloadLength];
+ bytes = positions.GetPayload(bytes, 0);
+ System.Collections.Generic.List<byte[]> val = new System.Collections.Generic.List<byte[]>();
+ val.Add(bytes);
+ return val;
+ }
+ }
+
+ // TODO: Remove warning after API has been finalized
+
+ public override bool IsPayloadAvailable
+ {
+ get { return positions.IsPayloadAvailable; }
+ }
+
+ public override System.String ToString()
{
return "spans(" + term.ToString() + ")@" + (doc == - 1?"START":((doc == System.Int32.MaxValue)?"END":doc + "-" + position));
}
-
-
- public virtual TermPositions GetPositions()
- {
- return positions;
- }
+
+
+ public virtual TermPositions Positions
+ {
+ get { return positions; }
+ }
}
}
\ No newline at end of file
Modified: incubator/lucene.net/trunk/src/core/Search/TermQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/TermQuery.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/TermQuery.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/TermQuery.cs Mon Mar 12 22:29:26 2012
@@ -62,30 +62,34 @@ namespace Lucene.Net.Search
InitBlock(enclosingInstance);
this.similarity = Enclosing_Instance.GetSimilarity(searcher);
idfExp = similarity.IdfExplain(Enclosing_Instance.term, searcher);
- idf = idfExp.GetIdf();
+ idf = idfExp.Idf;
}
public override System.String ToString()
{
return "weight(" + Enclosing_Instance + ")";
}
-
- public override Query GetQuery()
- {
- return Enclosing_Instance;
- }
- public override float GetValue()
- {
- return value_Renamed;
- }
-
- public override float SumOfSquaredWeights()
- {
- queryWeight = idf * Enclosing_Instance.GetBoost(); // compute query weight
- return queryWeight * queryWeight; // square it
- }
-
- public override void Normalize(float queryNorm)
+
+ public override Query Query
+ {
+ get { return Enclosing_Instance; }
+ }
+
+ public override float Value
+ {
+ get { return value_Renamed; }
+ }
+
+ public override float SumOfSquaredWeights
+ {
+ get
+ {
+ queryWeight = idf*Enclosing_Instance.Boost; // compute query weight
+ return queryWeight*queryWeight; // square it
+ }
+ }
+
+ public override void Normalize(float queryNorm)
{
this.queryNorm = queryNorm;
queryWeight *= queryNorm; // normalize query weight
@@ -106,16 +110,16 @@ namespace Lucene.Net.Search
{
ComplexExplanation result = new ComplexExplanation();
- result.Description = "weight(" + GetQuery() + " in " + doc + "), product of:";
+ result.Description = "weight(" + Query + " in " + doc + "), product of:";
Explanation expl = new Explanation(idf, idfExp.Explain());
// explain query weight
Explanation queryExpl = new Explanation();
- queryExpl.Description = "queryWeight(" + GetQuery() + "), product of:";
+ queryExpl.Description = "queryWeight(" + Query + "), product of:";
- Explanation boostExpl = new Explanation(Enclosing_Instance.GetBoost(), "boost");
- if (Enclosing_Instance.GetBoost() != 1.0f)
+ Explanation boostExpl = new Explanation(Enclosing_Instance.Boost, "boost");
+ if (Enclosing_Instance.Boost != 1.0f)
queryExpl.AddDetail(boostExpl);
queryExpl.AddDetail(expl);
@@ -187,21 +191,21 @@ namespace Lucene.Net.Search
{
term = t;
}
-
- /// <summary>Returns the term of this query. </summary>
- public virtual Term GetTerm()
- {
- return term;
- }
-
- public override Weight CreateWeight(Searcher searcher)
+
+ /// <summary>Returns the term of this query. </summary>
+ public virtual Term Term
+ {
+ get { return term; }
+ }
+
+ public override Weight CreateWeight(Searcher searcher)
{
return new TermWeight(this, searcher);
}
public override void ExtractTerms(System.Collections.Generic.ISet<Term> terms)
{
- terms.Add(GetTerm());
+ terms.Add(Term);
}
/// <summary>Prints a user-readable version of this query. </summary>
@@ -214,7 +218,7 @@ namespace Lucene.Net.Search
buffer.Append(":");
}
buffer.Append(term.Text());
- buffer.Append(ToStringUtils.Boost(GetBoost()));
+ buffer.Append(ToStringUtils.Boost(Boost));
return buffer.ToString();
}
@@ -224,13 +228,13 @@ namespace Lucene.Net.Search
if (!(o is TermQuery))
return false;
TermQuery other = (TermQuery) o;
- return (this.GetBoost() == other.GetBoost()) && this.term.Equals(other.term);
+ return (this.Boost == other.Boost) && this.term.Equals(other.term);
}
/// <summary>Returns a hash code value for this object.</summary>
public override int GetHashCode()
{
- return BitConverter.ToInt32(BitConverter.GetBytes(GetBoost()), 0) ^ term.GetHashCode();
+ return BitConverter.ToInt32(BitConverter.GetBytes(Boost), 0) ^ term.GetHashCode();
}
}
}
\ No newline at end of file
Modified: incubator/lucene.net/trunk/src/core/Search/TermRangeFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/src/core/Search/TermRangeFilter.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/src/core/Search/TermRangeFilter.cs (original)
+++ incubator/lucene.net/trunk/src/core/Search/TermRangeFilter.cs Mon Mar 12 22:29:26 2012
@@ -16,6 +16,7 @@
*/
using System;
+using System.Globalization;
namespace Lucene.Net.Search
{
@@ -96,41 +97,41 @@ namespace Lucene.Net.Search
{
return new TermRangeFilter(fieldName, lowerTerm, null, true, false);
}
-
- /// <summary>Returns the field name for this filter </summary>
- public virtual System.String GetField()
- {
- return query.GetField();
- }
-
- /// <summary>Returns the lower value of this range filter </summary>
- public virtual System.String GetLowerTerm()
- {
- return query.GetLowerTerm();
- }
-
- /// <summary>Returns the upper value of this range filter </summary>
- public virtual System.String GetUpperTerm()
- {
- return query.GetUpperTerm();
- }
-
- /// <summary>Returns <c>true</c> if the lower endpoint is inclusive </summary>
- public virtual bool IncludesLower()
- {
- return query.IncludesLower();
- }
-
- /// <summary>Returns <c>true</c> if the upper endpoint is inclusive </summary>
- public virtual bool IncludesUpper()
- {
- return query.IncludesUpper();
- }
-
- /// <summary>Returns the collator used to determine range inclusion, if any. </summary>
- public virtual System.Globalization.CompareInfo GetCollator()
- {
- return query.GetCollator();
- }
+
+ /// <summary>Returns the field name for this filter </summary>
+ public virtual string Field
+ {
+ get { return query.Field; }
+ }
+
+ /// <summary>Returns the lower value of this range filter </summary>
+ public virtual string LowerTerm
+ {
+ get { return query.LowerTerm; }
+ }
+
+ /// <summary>Returns the upper value of this range filter </summary>
+ public virtual string UpperTerm
+ {
+ get { return query.UpperTerm; }
+ }
+
+ /// <summary>Returns <c>true</c> if the lower endpoint is inclusive </summary>
+ public virtual bool IncludesLower
+ {
+ get { return query.IncludesLower; }
+ }
+
+ /// <summary>Returns <c>true</c> if the upper endpoint is inclusive </summary>
+ public virtual bool IncludesUpper
+ {
+ get { return query.IncludesUpper; }
+ }
+
+ /// <summary>Returns the collator used to determine range inclusion, if any. </summary>
+ public virtual CompareInfo Collator
+ {
+ get { return query.Collator; }
+ }
}
}
\ No newline at end of file