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 [13/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/...
Modified: incubator/lucene.net/trunk/test/core/Search/TestFilteredQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/test/core/Search/TestFilteredQuery.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/test/core/Search/TestFilteredQuery.cs (original)
+++ incubator/lucene.net/trunk/test/core/Search/TestFilteredQuery.cs Mon Mar 12 22:29:26 2012
@@ -121,12 +121,12 @@ namespace Lucene.Net.Search
Query filteredquery = new FilteredQuery(query, filter);
ScoreDoc[] hits = searcher.Search(filteredquery, null, 1000).ScoreDocs;
Assert.AreEqual(1, hits.Length);
- Assert.AreEqual(1, hits[0].doc);
+ Assert.AreEqual(1, hits[0].Doc);
QueryUtils.Check(filteredquery, searcher);
hits = searcher.Search(filteredquery, null, 1000, new Sort(new SortField("sorter", SortField.STRING))).ScoreDocs;
Assert.AreEqual(1, hits.Length);
- Assert.AreEqual(1, hits[0].doc);
+ Assert.AreEqual(1, hits[0].Doc);
filteredquery = new FilteredQuery(new TermQuery(new Term("field", "one")), filter);
hits = searcher.Search(filteredquery, null, 1000).ScoreDocs;
@@ -136,7 +136,7 @@ namespace Lucene.Net.Search
filteredquery = new FilteredQuery(new TermQuery(new Term("field", "x")), filter);
hits = searcher.Search(filteredquery, null, 1000).ScoreDocs;
Assert.AreEqual(1, hits.Length);
- Assert.AreEqual(3, hits[0].doc);
+ Assert.AreEqual(3, hits[0].Doc);
QueryUtils.Check(filteredquery, searcher);
filteredquery = new FilteredQuery(new TermQuery(new Term("field", "y")), filter);
@@ -150,20 +150,20 @@ namespace Lucene.Net.Search
float boost = 2.5f;
BooleanQuery bq1 = new BooleanQuery();
TermQuery tq = new TermQuery(new Term("field", "one"));
- tq.SetBoost(boost);
+ tq.Boost = boost;
bq1.Add(tq, Occur.MUST);
bq1.Add(new TermQuery(new Term("field", "five")), Occur.MUST);
BooleanQuery bq2 = new BooleanQuery();
tq = new TermQuery(new Term("field", "one"));
filteredquery = new FilteredQuery(tq, f);
- filteredquery.SetBoost(boost);
+ filteredquery.Boost = boost;
bq2.Add(filteredquery, Occur.MUST);
bq2.Add(new TermQuery(new Term("field", "five")), Occur.MUST);
AssertScoreEquals(bq1, bq2);
- Assert.AreEqual(boost, filteredquery.GetBoost(), 0);
- Assert.AreEqual(1.0f, tq.GetBoost(), 0); // the boost value of the underlying query shouldn't have changed
+ Assert.AreEqual(boost, filteredquery.Boost, 0);
+ Assert.AreEqual(1.0f, tq.Boost, 0); // the boost value of the underlying query shouldn't have changed
}
// must be static for serialization tests
@@ -182,7 +182,7 @@ namespace Lucene.Net.Search
for (int i = 0; i < hits1.Length; i++)
{
- Assert.AreEqual(hits1[i].score, hits2[i].score, 0.0000001f);
+ Assert.AreEqual(hits1[i].Score, hits2[i].Score, 0.0000001f);
}
}
Modified: incubator/lucene.net/trunk/test/core/Search/TestFilteredSearch.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/test/core/Search/TestFilteredSearch.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/test/core/Search/TestFilteredSearch.cs (original)
+++ incubator/lucene.net/trunk/test/core/Search/TestFilteredSearch.cs Mon Mar 12 22:29:26 2012
@@ -109,7 +109,7 @@ namespace Lucene.Net.Search
public override DocIdSet GetDocIdSet(IndexReader reader)
{
OpenBitSet set = new OpenBitSet();
- int limit = docBase + reader.MaxDoc();
+ int limit = docBase + reader.MaxDoc;
for (; index < docs.Length; index++)
{
int docId = docs[index];
Modified: incubator/lucene.net/trunk/test/core/Search/TestFuzzyQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/test/core/Search/TestFuzzyQuery.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/test/core/Search/TestFuzzyQuery.cs (original)
+++ incubator/lucene.net/trunk/test/core/Search/TestFuzzyQuery.cs Mon Mar 12 22:29:26 2012
@@ -90,7 +90,7 @@ namespace Lucene.Net.Search
List<String> order = new List<string>(new[] {"bbbbb", "abbbb", "aabbb"});
for (int i = 0; i < hits.Length; i++)
{
- String term = searcher.Doc(hits[i].doc).Get("field");
+ String term = searcher.Doc(hits[i].Doc).Get("field");
//System.out.println(hits[i].score);
Assert.AreEqual(order[i], term);
}
@@ -107,7 +107,7 @@ namespace Lucene.Net.Search
order = new List<string>(new[] {"bbbbb", "abbbb"});
for (int i = 0; i < hits.Length; i++)
{
- String term = searcher.Doc(hits[i].doc).Get("field");
+ String term = searcher.Doc(hits[i].Doc).Get("field");
//System.out.println(hits[i].score);
Assert.AreEqual(order[i], term);
}
@@ -130,43 +130,43 @@ namespace Lucene.Net.Search
query = new FuzzyQuery(new Term("field", "aaaaa"), FuzzyQuery.defaultMinSimilarity, 0);
hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.AreEqual(3, hits.Length);
- Assert.AreEqual(searcher.Doc(hits[0].doc).Get("field"), ("aaaaa"));
+ Assert.AreEqual(searcher.Doc(hits[0].Doc).Get("field"), ("aaaaa"));
// default allows for up to two edits:
- Assert.AreEqual(searcher.Doc(hits[1].doc).Get("field"), ("aaaab"));
- Assert.AreEqual(searcher.Doc(hits[2].doc).Get("field"), ("aaabb"));
+ Assert.AreEqual(searcher.Doc(hits[1].Doc).Get("field"), ("aaaab"));
+ Assert.AreEqual(searcher.Doc(hits[2].Doc).Get("field"), ("aaabb"));
// query similar to a word in the index:
query = new FuzzyQuery(new Term("field", "aaaac"), FuzzyQuery.defaultMinSimilarity, 0);
hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.AreEqual(3, hits.Length);
- Assert.AreEqual(searcher.Doc(hits[0].doc).Get("field"), ("aaaaa"));
- Assert.AreEqual(searcher.Doc(hits[1].doc).Get("field"), ("aaaab"));
- Assert.AreEqual(searcher.Doc(hits[2].doc).Get("field"), ("aaabb"));
+ Assert.AreEqual(searcher.Doc(hits[0].Doc).Get("field"), ("aaaaa"));
+ Assert.AreEqual(searcher.Doc(hits[1].Doc).Get("field"), ("aaaab"));
+ Assert.AreEqual(searcher.Doc(hits[2].Doc).Get("field"), ("aaabb"));
// now with prefix
query = new FuzzyQuery(new Term("field", "aaaac"), FuzzyQuery.defaultMinSimilarity, 1);
hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.AreEqual(3, hits.Length);
- Assert.AreEqual(searcher.Doc(hits[0].doc).Get("field"), ("aaaaa"));
- Assert.AreEqual(searcher.Doc(hits[1].doc).Get("field"), ("aaaab"));
- Assert.AreEqual(searcher.Doc(hits[2].doc).Get("field"), ("aaabb"));
+ Assert.AreEqual(searcher.Doc(hits[0].Doc).Get("field"), ("aaaaa"));
+ Assert.AreEqual(searcher.Doc(hits[1].Doc).Get("field"), ("aaaab"));
+ Assert.AreEqual(searcher.Doc(hits[2].Doc).Get("field"), ("aaabb"));
query = new FuzzyQuery(new Term("field", "aaaac"), FuzzyQuery.defaultMinSimilarity, 2);
hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.AreEqual(3, hits.Length);
- Assert.AreEqual(searcher.Doc(hits[0].doc).Get("field"), ("aaaaa"));
- Assert.AreEqual(searcher.Doc(hits[1].doc).Get("field"), ("aaaab"));
- Assert.AreEqual(searcher.Doc(hits[2].doc).Get("field"), ("aaabb"));
+ Assert.AreEqual(searcher.Doc(hits[0].Doc).Get("field"), ("aaaaa"));
+ Assert.AreEqual(searcher.Doc(hits[1].Doc).Get("field"), ("aaaab"));
+ Assert.AreEqual(searcher.Doc(hits[2].Doc).Get("field"), ("aaabb"));
query = new FuzzyQuery(new Term("field", "aaaac"), FuzzyQuery.defaultMinSimilarity, 3);
hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.AreEqual(3, hits.Length);
- Assert.AreEqual(searcher.Doc(hits[0].doc).Get("field"), ("aaaaa"));
- Assert.AreEqual(searcher.Doc(hits[1].doc).Get("field"), ("aaaab"));
- Assert.AreEqual(searcher.Doc(hits[2].doc).Get("field"), ("aaabb"));
+ Assert.AreEqual(searcher.Doc(hits[0].Doc).Get("field"), ("aaaaa"));
+ Assert.AreEqual(searcher.Doc(hits[1].Doc).Get("field"), ("aaaab"));
+ Assert.AreEqual(searcher.Doc(hits[2].Doc).Get("field"), ("aaabb"));
query = new FuzzyQuery(new Term("field", "aaaac"), FuzzyQuery.defaultMinSimilarity, 4);
hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.AreEqual(2, hits.Length);
- Assert.AreEqual(searcher.Doc(hits[0].doc).Get("field"), ("aaaaa"));
- Assert.AreEqual(searcher.Doc(hits[1].doc).Get("field"), ("aaaab"));
+ Assert.AreEqual(searcher.Doc(hits[0].Doc).Get("field"), ("aaaaa"));
+ Assert.AreEqual(searcher.Doc(hits[1].Doc).Get("field"), ("aaaab"));
query = new FuzzyQuery(new Term("field", "aaaac"), FuzzyQuery.defaultMinSimilarity, 5);
hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.AreEqual(0, hits.Length);
@@ -175,25 +175,25 @@ namespace Lucene.Net.Search
query = new FuzzyQuery(new Term("field", "ddddX"), FuzzyQuery.defaultMinSimilarity, 0);
hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.AreEqual(1, hits.Length);
- Assert.AreEqual(searcher.Doc(hits[0].doc).Get("field"), ("ddddd"));
+ Assert.AreEqual(searcher.Doc(hits[0].Doc).Get("field"), ("ddddd"));
// now with prefix
query = new FuzzyQuery(new Term("field", "ddddX"), FuzzyQuery.defaultMinSimilarity, 1);
hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.AreEqual(1, hits.Length);
- Assert.AreEqual(searcher.Doc(hits[0].doc).Get("field"), ("ddddd"));
+ Assert.AreEqual(searcher.Doc(hits[0].Doc).Get("field"), ("ddddd"));
query = new FuzzyQuery(new Term("field", "ddddX"), FuzzyQuery.defaultMinSimilarity, 2);
hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.AreEqual(1, hits.Length);
- Assert.AreEqual(searcher.Doc(hits[0].doc).Get("field"), ("ddddd"));
+ Assert.AreEqual(searcher.Doc(hits[0].Doc).Get("field"), ("ddddd"));
query = new FuzzyQuery(new Term("field", "ddddX"), FuzzyQuery.defaultMinSimilarity, 3);
hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.AreEqual(1, hits.Length);
- Assert.AreEqual(searcher.Doc(hits[0].doc).Get("field"), ("ddddd"));
+ Assert.AreEqual(searcher.Doc(hits[0].Doc).Get("field"), ("ddddd"));
query = new FuzzyQuery(new Term("field", "ddddX"), FuzzyQuery.defaultMinSimilarity, 4);
hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.AreEqual(1, hits.Length);
- Assert.AreEqual(searcher.Doc(hits[0].doc).Get("field"), ("ddddd"));
+ Assert.AreEqual(searcher.Doc(hits[0].Doc).Get("field"), ("ddddd"));
query = new FuzzyQuery(new Term("field", "ddddX"), FuzzyQuery.defaultMinSimilarity, 5);
hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.AreEqual(0, hits.Length);
@@ -229,17 +229,17 @@ namespace Lucene.Net.Search
query = new FuzzyQuery(new Term("field", "aaaaccc"), FuzzyQuery.defaultMinSimilarity, 0);
hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.AreEqual(1, hits.Length);
- Assert.AreEqual(searcher.Doc(hits[0].doc).Get("field"), ("aaaaaaa"));
+ Assert.AreEqual(searcher.Doc(hits[0].Doc).Get("field"), ("aaaaaaa"));
// now with prefix
query = new FuzzyQuery(new Term("field", "aaaaccc"), FuzzyQuery.defaultMinSimilarity, 1);
hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.AreEqual(1, hits.Length);
- Assert.AreEqual(searcher.Doc(hits[0].doc).Get("field"), ("aaaaaaa"));
+ Assert.AreEqual(searcher.Doc(hits[0].Doc).Get("field"), ("aaaaaaa"));
query = new FuzzyQuery(new Term("field", "aaaaccc"), FuzzyQuery.defaultMinSimilarity, 4);
hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.AreEqual(1, hits.Length);
- Assert.AreEqual(searcher.Doc(hits[0].doc).Get("field"), ("aaaaaaa"));
+ Assert.AreEqual(searcher.Doc(hits[0].Doc).Get("field"), ("aaaaaaa"));
query = new FuzzyQuery(new Term("field", "aaaaccc"), FuzzyQuery.defaultMinSimilarity, 5);
hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.AreEqual(0, hits.Length);
@@ -372,7 +372,7 @@ namespace Lucene.Net.Search
IndexSearcher searcher = new IndexSearcher(r);
ScoreDoc[] hits = searcher.Search(q, 10).ScoreDocs;
Assert.AreEqual(1, hits.Length);
- Assert.AreEqual(searcher.Doc(hits[0].doc).Get("field"), "Giga byte");
+ Assert.AreEqual(searcher.Doc(hits[0].Doc).Get("field"), "Giga byte");
r.Close();
}
Modified: incubator/lucene.net/trunk/test/core/Search/TestMatchAllDocsQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/test/core/Search/TestMatchAllDocsQuery.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/test/core/Search/TestMatchAllDocsQuery.cs (original)
+++ incubator/lucene.net/trunk/test/core/Search/TestMatchAllDocsQuery.cs Mon Mar 12 22:29:26 2012
@@ -70,9 +70,9 @@ namespace Lucene.Net.Search
hits = is_Renamed.Search(new MatchAllDocsQuery(), null, 1000).ScoreDocs;
Assert.AreEqual(3, hits.Length);
- Assert.AreEqual(ir.Document(hits[0].doc).Get("key"), "one");
- Assert.AreEqual(ir.Document(hits[1].doc).Get("key"), "two");
- Assert.AreEqual(ir.Document(hits[2].doc).Get("key"), "three four");
+ Assert.AreEqual(ir.Document(hits[0].Doc).Get("key"), "one");
+ Assert.AreEqual(ir.Document(hits[1].Doc).Get("key"), "two");
+ Assert.AreEqual(ir.Document(hits[2].Doc).Get("key"), "three four");
// assert with norms scoring turned on
@@ -80,9 +80,9 @@ namespace Lucene.Net.Search
hits = is_Renamed.Search(normsQuery, null, 1000).ScoreDocs;
Assert.AreEqual(3, hits.Length);
- Assert.AreEqual(ir.Document(hits[0].doc).Get("key"), "three four");
- Assert.AreEqual(ir.Document(hits[1].doc).Get("key"), "two");
- Assert.AreEqual(ir.Document(hits[2].doc).Get("key"), "one");
+ Assert.AreEqual(ir.Document(hits[0].Doc).Get("key"), "three four");
+ Assert.AreEqual(ir.Document(hits[1].Doc).Get("key"), "two");
+ Assert.AreEqual(ir.Document(hits[2].Doc).Get("key"), "one");
// change norm & retest
ir.SetNorm(0, "key", 400f);
@@ -90,9 +90,9 @@ namespace Lucene.Net.Search
hits = is_Renamed.Search(normsQuery, null, 1000).ScoreDocs;
Assert.AreEqual(3, hits.Length);
- Assert.AreEqual(ir.Document(hits[0].doc).Get("key"), "one");
- Assert.AreEqual(ir.Document(hits[1].doc).Get("key"), "three four");
- Assert.AreEqual(ir.Document(hits[2].doc).Get("key"), "two");
+ Assert.AreEqual(ir.Document(hits[0].Doc).Get("key"), "one");
+ Assert.AreEqual(ir.Document(hits[1].Doc).Get("key"), "three four");
+ Assert.AreEqual(ir.Document(hits[2].Doc).Get("key"), "two");
// some artificial queries to trigger the use of skipTo():
@@ -109,7 +109,7 @@ namespace Lucene.Net.Search
Assert.AreEqual(1, hits.Length);
// delete a document:
- is_Renamed.GetIndexReader().DeleteDocument(0);
+ is_Renamed.IndexReader.DeleteDocument(0);
hits = is_Renamed.Search(new MatchAllDocsQuery(), null, 1000).ScoreDocs;
Assert.AreEqual(2, hits.Length);
@@ -120,7 +120,7 @@ namespace Lucene.Net.Search
// test parsable toString() with non default boost
Query maq = new MatchAllDocsQuery();
- maq.SetBoost(2.3f);
+ maq.Boost = 2.3f;
Query pq = qp.Parse(maq.ToString());
hits = is_Renamed.Search(pq, null, 1000).ScoreDocs;
Assert.AreEqual(2, hits.Length);
@@ -136,7 +136,7 @@ namespace Lucene.Net.Search
Query q1 = new MatchAllDocsQuery();
Query q2 = new MatchAllDocsQuery();
Assert.IsTrue(q1.Equals(q2));
- q1.SetBoost(1.5f);
+ q1.Boost = 1.5f;
Assert.IsFalse(q1.Equals(q2));
}
@@ -144,7 +144,7 @@ namespace Lucene.Net.Search
{
Document doc = new Document();
Field f = new Field("key", text, Field.Store.YES, Field.Index.ANALYZED);
- f.SetBoost(boost);
+ f.Boost = boost;
doc.Add(f);
iw.AddDocument(doc);
}
Modified: incubator/lucene.net/trunk/test/core/Search/TestMultiPhraseQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/test/core/Search/TestMultiPhraseQuery.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/test/core/Search/TestMultiPhraseQuery.cs (original)
+++ incubator/lucene.net/trunk/test/core/Search/TestMultiPhraseQuery.cs Mon Mar 12 22:29:26 2012
@@ -109,7 +109,7 @@ namespace Lucene.Net.Search
Assert.AreEqual("body:\"(blueberry bluebird) pizza\"", query3.ToString());
// test slop:
- query3.SetSlop(1);
+ query3.Slop = 1;
result = searcher.Search(query3, null, 1000).ScoreDocs;
Assert.AreEqual(3, result.Length); // blueberry pizza, bluebird pizza, bluebird foobar pizza
Modified: incubator/lucene.net/trunk/test/core/Search/TestMultiSearcher.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/test/core/Search/TestMultiSearcher.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/test/core/Search/TestMultiSearcher.cs (original)
+++ incubator/lucene.net/trunk/test/core/Search/TestMultiSearcher.cs Mon Mar 12 22:29:26 2012
@@ -159,7 +159,7 @@ namespace Lucene.Net.Search
// iterating over the hit documents
for (int i = 0; i < hits.Length; i++)
{
- mSearcher.Doc(hits[i].doc);
+ mSearcher.Doc(hits[i].Doc);
}
mSearcher.Close();
@@ -190,19 +190,19 @@ namespace Lucene.Net.Search
for (int i = 0; i < hits2.Length; i++)
{
// no exception should happen at this point
- mSearcher2.Doc(hits2[i].doc);
+ mSearcher2.Doc(hits2[i].Doc);
}
// test the subSearcher() method:
Query subSearcherQuery = parser.Parse("id:doc1");
hits2 = mSearcher2.Search(subSearcherQuery, null, 1000).ScoreDocs;
Assert.AreEqual(2, hits2.Length);
- Assert.AreEqual(0, mSearcher2.SubSearcher(hits2[0].doc)); // hit from searchers2[0]
- Assert.AreEqual(1, mSearcher2.SubSearcher(hits2[1].doc)); // hit from searchers2[1]
+ Assert.AreEqual(0, mSearcher2.SubSearcher(hits2[0].Doc)); // hit from searchers2[0]
+ Assert.AreEqual(1, mSearcher2.SubSearcher(hits2[1].Doc)); // hit from searchers2[1]
subSearcherQuery = parser.Parse("id:doc2");
hits2 = mSearcher2.Search(subSearcherQuery, null, 1000).ScoreDocs;
Assert.AreEqual(1, hits2.Length);
- Assert.AreEqual(1, mSearcher2.SubSearcher(hits2[0].doc)); // hit from searchers2[1]
+ Assert.AreEqual(1, mSearcher2.SubSearcher(hits2[0].Doc)); // hit from searchers2[1]
mSearcher2.Close();
//--------------------------------------------------------------------
@@ -235,7 +235,7 @@ namespace Lucene.Net.Search
// iterating over the hit documents
for (int i = 0; i < hits3.Length; i++)
{
- mSearcher3.Doc(hits3[i].doc);
+ mSearcher3.Doc(hits3[i].Doc);
}
mSearcher3.Close();
indexStoreA.Close();
@@ -300,7 +300,7 @@ namespace Lucene.Net.Search
ScoreDoc[] hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.IsTrue(hits != null, "hits is null and it shouldn't be");
Assert.IsTrue(hits.Length == 2, hits.Length + " does not equal: " + 2);
- Document document = searcher.Doc(hits[0].doc);
+ Document document = searcher.Doc(hits[0].Doc);
Assert.IsTrue(document != null, "document is null and it shouldn't be");
Assert.IsTrue(document.GetFields().Count == 2, "document.getFields() Size: " + document.GetFields().Count + " is not: " + 2);
//Should be one document from each directory
@@ -308,7 +308,7 @@ namespace Lucene.Net.Search
ISet<string> ftl = new HashSet<string>();
ftl.Add("other");
SetBasedFieldSelector fs = new SetBasedFieldSelector(ftl, new HashSet<string>());
- document = searcher.Doc(hits[0].doc, fs);
+ document = searcher.Doc(hits[0].Doc, fs);
Assert.IsTrue(document != null, "document is null and it shouldn't be");
Assert.IsTrue(document.GetFields().Count == 1, "document.getFields() Size: " + document.GetFields().Count + " is not: " + 1);
System.String value_Renamed = document.Get("contents");
@@ -318,7 +318,7 @@ namespace Lucene.Net.Search
ftl.Clear();
ftl.Add("contents");
fs = new SetBasedFieldSelector(ftl, new HashSet<string>());
- document = searcher.Doc(hits[1].doc, fs);
+ document = searcher.Doc(hits[1].Doc, fs);
value_Renamed = document.Get("contents");
Assert.IsTrue(value_Renamed != null, "value is null and it shouldn't be");
value_Renamed = document.Get("other");
@@ -359,7 +359,7 @@ namespace Lucene.Net.Search
Assert.AreEqual(2, hits.Length, message);
// Store the scores for use later
- float[] scores = new float[]{hits[0].score, hits[1].score};
+ float[] scores = new float[]{hits[0].Score, hits[1].Score};
Assert.IsTrue(scores[0] > scores[1], message);
@@ -391,8 +391,8 @@ namespace Lucene.Net.Search
Assert.AreEqual(2, hits.Length, message);
// The scores should be the same (within reason)
- Assert.AreEqual(scores[0], hits[0].score, 1e-6, message); // This will a document from ramDirectory1
- Assert.AreEqual(scores[1], hits[1].score, 1e-6, message); // This will a document from ramDirectory2
+ Assert.AreEqual(scores[0], hits[0].Score, 1e-6, message); // This will a document from ramDirectory1
+ Assert.AreEqual(scores[1], hits[1].Score, 1e-6, message); // This will a document from ramDirectory2
@@ -401,8 +401,8 @@ namespace Lucene.Net.Search
Assert.AreEqual(2, hits.Length, message);
- Assert.AreEqual(scores[0], hits[0].score, 1e-6, message); // This will a document from ramDirectory1
- Assert.AreEqual(scores[1], hits[1].score, 1e-6, message); // This will a document from ramDirectory2
+ Assert.AreEqual(scores[0], hits[0].Score, 1e-6, message); // This will a document from ramDirectory1
+ Assert.AreEqual(scores[1], hits[1].Score, 1e-6, message); // This will a document from ramDirectory2
searcher.Close();
@@ -422,18 +422,18 @@ namespace Lucene.Net.Search
Similarity customSimilarity = new AnonymousClassDefaultSimilarity(this);
- srchr.SetSimilarity(customSimilarity);
- msrchr.SetSimilarity(customSimilarity);
+ srchr.Similarity = customSimilarity;
+ msrchr.Similarity = customSimilarity;
Query query = new TermQuery(new Term("contents", "doc0"));
// Get a score from IndexSearcher
TopDocs topDocs = srchr.Search(query, null, 1);
- float score1 = topDocs.GetMaxScore();
+ float score1 = topDocs.MaxScore;
// Get the score from MultiSearcher
topDocs = msrchr.Search(query, null, 1);
- float scoreN = topDocs.GetMaxScore();
+ float scoreN = topDocs.MaxScore;
// The scores from the IndexSearcher and Multisearcher should be the same
// if the same similarity is used.
Modified: incubator/lucene.net/trunk/test/core/Search/TestMultiSearcherRanking.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/test/core/Search/TestMultiSearcherRanking.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/test/core/Search/TestMultiSearcherRanking.cs (original)
+++ incubator/lucene.net/trunk/test/core/Search/TestMultiSearcherRanking.cs Mon Mar 12 22:29:26 2012
@@ -113,13 +113,13 @@ namespace Lucene.Net.Search
Assert.AreEqual(multiSearcherHits.Length, singleSearcherHits.Length);
for (int i = 0; i < multiSearcherHits.Length; i++)
{
- Document docMulti = multiSearcher.Doc(multiSearcherHits[i].doc);
- Document docSingle = singleSearcher.Doc(singleSearcherHits[i].doc);
+ Document docMulti = multiSearcher.Doc(multiSearcherHits[i].Doc);
+ Document docSingle = singleSearcher.Doc(singleSearcherHits[i].Doc);
if (verbose)
- System.Console.Out.WriteLine("Multi: " + docMulti.Get(FIELD_NAME) + " score=" + multiSearcherHits[i].score);
+ System.Console.Out.WriteLine("Multi: " + docMulti.Get(FIELD_NAME) + " score=" + multiSearcherHits[i].Score);
if (verbose)
- System.Console.Out.WriteLine("Single: " + docSingle.Get(FIELD_NAME) + " score=" + singleSearcherHits[i].score);
- Assert.AreEqual(multiSearcherHits[i].score, singleSearcherHits[i].score, 0.001f);
+ System.Console.Out.WriteLine("Single: " + docSingle.Get(FIELD_NAME) + " score=" + singleSearcherHits[i].Score);
+ Assert.AreEqual(multiSearcherHits[i].Score, singleSearcherHits[i].Score, 0.001f);
Assert.AreEqual(docMulti.Get(FIELD_NAME), docSingle.Get(FIELD_NAME));
}
if (verbose)
Modified: incubator/lucene.net/trunk/test/core/Search/TestMultiTermConstantScore.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/test/core/Search/TestMultiTermConstantScore.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/test/core/Search/TestMultiTermConstantScore.cs (original)
+++ incubator/lucene.net/trunk/test/core/Search/TestMultiTermConstantScore.cs Mon Mar 12 22:29:26 2012
@@ -127,14 +127,14 @@ namespace Lucene.Net.Search
public static Query Csrq(System.String f, System.String l, System.String h, bool il, bool ih)
{
TermRangeQuery query = new TermRangeQuery(f, l, h, il, ih);
- query.SetRewriteMethod(MultiTermQuery.CONSTANT_SCORE_FILTER_REWRITE);
+ query.QueryRewriteMethod = MultiTermQuery.CONSTANT_SCORE_FILTER_REWRITE;
return query;
}
public static Query Csrq(System.String f, System.String l, System.String h, bool il, bool ih, MultiTermQuery.RewriteMethod method)
{
TermRangeQuery query = new TermRangeQuery(f, l, h, il, ih);
- query.SetRewriteMethod(method);
+ query.QueryRewriteMethod = method;
return query;
}
@@ -142,7 +142,7 @@ namespace Lucene.Net.Search
public static Query Csrq(System.String f, System.String l, System.String h, bool il, bool ih, System.Globalization.CompareInfo c)
{
TermRangeQuery query = new TermRangeQuery(f, l, h, il, ih, c);
- query.SetRewriteMethod(MultiTermQuery.CONSTANT_SCORE_FILTER_REWRITE);
+ query.QueryRewriteMethod = MultiTermQuery.CONSTANT_SCORE_FILTER_REWRITE;
return query;
}
@@ -150,7 +150,7 @@ namespace Lucene.Net.Search
public static Query Cspq(Term prefix)
{
PrefixQuery query = new PrefixQuery(prefix);
- query.SetRewriteMethod(MultiTermQuery.CONSTANT_SCORE_FILTER_REWRITE);
+ query.QueryRewriteMethod = MultiTermQuery.CONSTANT_SCORE_FILTER_REWRITE;
return query;
}
@@ -158,7 +158,7 @@ namespace Lucene.Net.Search
public static Query Cswcq(Term wild)
{
WildcardQuery query = new WildcardQuery(wild);
- query.SetRewriteMethod(MultiTermQuery.CONSTANT_SCORE_FILTER_REWRITE);
+ query.QueryRewriteMethod = MultiTermQuery.CONSTANT_SCORE_FILTER_REWRITE;
return query;
}
@@ -200,10 +200,10 @@ namespace Lucene.Net.Search
result = search.Search(Csrq("data", "1", "6", T, T), null, 1000).ScoreDocs;
int numHits = result.Length;
AssertEquals("wrong number of results", 6, numHits);
- float score = result[0].score;
+ float score = result[0].Score;
for (int i = 1; i < numHits; i++)
{
- AssertEquals("score for " + i + " was not the same", score, result[i].score);
+ AssertEquals("score for " + i + " was not the same", score, result[i].Score);
}
result = search.Search(Csrq("data", "1", "6", T, T, MultiTermQuery.CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE), null, 1000).ScoreDocs;
@@ -211,7 +211,7 @@ namespace Lucene.Net.Search
AssertEquals("wrong number of results", 6, numHits);
for (int i = 0; i < numHits; i++)
{
- AssertEquals("score for " + i + " was not the same", score, result[i].score);
+ AssertEquals("score for " + i + " was not the same", score, result[i].Score);
}
}
@@ -226,7 +226,7 @@ namespace Lucene.Net.Search
// test for correct application of query normalization
// must use a non score normalizing method for this.
Query q = Csrq("data", "1", "6", T, T);
- q.SetBoost(100);
+ q.Boost = 100;
search.Search(q, null, new AnonymousClassCollector(this));
//
@@ -234,40 +234,40 @@ namespace Lucene.Net.Search
// than another.
//
Query q1 = Csrq("data", "A", "A", T, T); // matches document #0
- q1.SetBoost(.1f);
+ q1.Boost = .1f;
Query q2 = Csrq("data", "Z", "Z", T, T); // matches document #1
BooleanQuery bq = new BooleanQuery(true);
bq.Add(q1, BooleanClause.Occur.SHOULD);
bq.Add(q2, BooleanClause.Occur.SHOULD);
ScoreDoc[] hits = search.Search(bq, null, 1000).ScoreDocs;
- Assert.AreEqual(1, hits[0].doc);
- Assert.AreEqual(0, hits[1].doc);
- Assert.IsTrue(hits[0].score > hits[1].score);
+ Assert.AreEqual(1, hits[0].Doc);
+ Assert.AreEqual(0, hits[1].Doc);
+ Assert.IsTrue(hits[0].Score > hits[1].Score);
q1 = Csrq("data", "A", "A", T, T, MultiTermQuery.CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE); // matches document #0
- q1.SetBoost(.1f);
+ q1.Boost = .1f;
q2 = Csrq("data", "Z", "Z", T, T, MultiTermQuery.CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE); // matches document #1
bq = new BooleanQuery(true);
bq.Add(q1, BooleanClause.Occur.SHOULD);
bq.Add(q2, BooleanClause.Occur.SHOULD);
hits = search.Search(bq, null, 1000).ScoreDocs;
- Assert.AreEqual(1, hits[0].doc);
- Assert.AreEqual(0, hits[1].doc);
- Assert.IsTrue(hits[0].score > hits[1].score);
+ Assert.AreEqual(1, hits[0].Doc);
+ Assert.AreEqual(0, hits[1].Doc);
+ Assert.IsTrue(hits[0].Score > hits[1].Score);
q1 = Csrq("data", "A", "A", T, T); // matches document #0
- q1.SetBoost(10f);
+ q1.Boost = 10f;
q2 = Csrq("data", "Z", "Z", T, T); // matches document #1
bq = new BooleanQuery(true);
bq.Add(q1, BooleanClause.Occur.SHOULD);
bq.Add(q2, BooleanClause.Occur.SHOULD);
hits = search.Search(bq, null, 1000).ScoreDocs;
- Assert.AreEqual(0, hits[0].doc);
- Assert.AreEqual(1, hits[1].doc);
- Assert.IsTrue(hits[0].score > hits[1].score);
+ Assert.AreEqual(0, hits[0].Doc);
+ Assert.AreEqual(1, hits[1].Doc);
+ Assert.IsTrue(hits[0].Score > hits[1].Score);
}
[Test]
@@ -298,7 +298,7 @@ namespace Lucene.Net.Search
AssertEquals("wrong numebr of hits", numHits, actual.Length);
for (int i = 0; i < numHits; i++)
{
- AssertEquals("mismatch in docid for hit#" + i, expected[i].doc, actual[i].doc);
+ AssertEquals("mismatch in docid for hit#" + i, expected[i].Doc, actual[i].Doc);
}
}
@@ -316,7 +316,7 @@ namespace Lucene.Net.Search
System.String maxIP = Pad(maxId);
System.String medIP = Pad(medId);
- int numDocs = reader.NumDocs();
+ int numDocs = reader.NumDocs;
AssertEquals("num of docs", numDocs, 1 + maxId - minId);
@@ -445,7 +445,7 @@ namespace Lucene.Net.Search
System.String maxIP = Pad(maxId);
System.String medIP = Pad(medId);
- int numDocs = reader.NumDocs();
+ int numDocs = reader.NumDocs;
AssertEquals("num of docs", numDocs, 1 + maxId - minId);
@@ -527,7 +527,7 @@ namespace Lucene.Net.Search
System.String minRP = Pad(signedIndex.minR);
System.String maxRP = Pad(signedIndex.maxR);
- int numDocs = reader.NumDocs();
+ int numDocs = reader.NumDocs;
AssertEquals("num of docs", numDocs, 1 + maxId - minId);
@@ -591,7 +591,7 @@ namespace Lucene.Net.Search
System.String minRP = Pad(unsignedIndex.minR);
System.String maxRP = Pad(unsignedIndex.maxR);
- int numDocs = reader.NumDocs();
+ int numDocs = reader.NumDocs;
AssertEquals("num of docs", numDocs, 1 + maxId - minId);
Modified: incubator/lucene.net/trunk/test/core/Search/TestMultiThreadTermVectors.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/test/core/Search/TestMultiThreadTermVectors.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/test/core/Search/TestMultiThreadTermVectors.cs (original)
+++ incubator/lucene.net/trunk/test/core/Search/TestMultiThreadTermVectors.cs Mon Mar 12 22:29:26 2012
@@ -47,7 +47,7 @@ namespace Lucene.Net.Search
for (int i = 0; i < numDocs; i++)
{
Document doc = new Document();
- Fieldable fld = new Field("field", English.IntToEnglish(i), Field.Store.YES, Field.Index.NOT_ANALYZED, Field.TermVector.YES);
+ IFieldable fld = new Field("field", English.IntToEnglish(i), Field.Store.YES, Field.Index.NOT_ANALYZED, Field.TermVector.YES);
doc.Add(fld);
writer.AddDocument(doc);
}
@@ -171,7 +171,7 @@ namespace Lucene.Net.Search
private void TestTermVectors()
{
// check:
- int numDocs = reader.NumDocs();
+ int numDocs = reader.NumDocs;
long start = 0L;
for (int docId = 0; docId < numDocs; docId++)
{
Modified: incubator/lucene.net/trunk/test/core/Search/TestNumericRangeQuery32.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/test/core/Search/TestNumericRangeQuery32.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/test/core/Search/TestNumericRangeQuery32.cs (original)
+++ incubator/lucene.net/trunk/test/core/Search/TestNumericRangeQuery32.cs Mon Mar 12 22:29:26 2012
@@ -70,22 +70,22 @@ namespace Lucene.Net.Search
case 0:
type = " (constant score filter rewrite)";
- q.SetRewriteMethod(MultiTermQuery.CONSTANT_SCORE_FILTER_REWRITE);
+ q.QueryRewriteMethod = MultiTermQuery.CONSTANT_SCORE_FILTER_REWRITE;
topDocs = searcher.Search(q, null, noDocs, Sort.INDEXORDER);
- terms = q.GetTotalNumberOfTerms();
+ terms = q.TotalNumberOfTerms;
break;
case 1:
type = " (constant score boolean rewrite)";
- q.SetRewriteMethod(MultiTermQuery.CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE);
+ q.QueryRewriteMethod = MultiTermQuery.CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE;
topDocs = searcher.Search(q, null, noDocs, Sort.INDEXORDER);
- terms = q.GetTotalNumberOfTerms();
+ terms = q.TotalNumberOfTerms;
break;
case 2:
type = " (filter)";
topDocs = searcher.Search(new MatchAllDocsQuery(), f, noDocs, Sort.INDEXORDER);
- terms = f.GetTotalNumberOfTerms();
+ terms = f.TotalNumberOfTerms;
break;
default:
@@ -96,9 +96,9 @@ namespace Lucene.Net.Search
ScoreDoc[] sd = topDocs.ScoreDocs;
Assert.IsNotNull(sd);
Assert.AreEqual(count, sd.Length, "Score doc count" + type);
- Document doc = searcher.Doc(sd[0].doc);
+ Document doc = searcher.Doc(sd[0].Doc);
Assert.AreEqual(2 * distance + startOffset, System.Int32.Parse(doc.Get(field)), "First doc" + type);
- doc = searcher.Doc(sd[sd.Length - 1].doc);
+ doc = searcher.Doc(sd[sd.Length - 1].Doc);
Assert.AreEqual((1 + count) * distance + startOffset, System.Int32.Parse(doc.Get(field)), "Last doc" + type);
if (i > 0)
{
@@ -132,15 +132,15 @@ namespace Lucene.Net.Search
System.Int32 tempAux = 1000;
System.Int32 tempAux2 = - 1000;
NumericRangeFilter<int> f = NumericRangeFilter.NewIntRange("field8", 8, tempAux, tempAux2, true, true);
- Assert.AreSame(DocIdSet.EMPTY_DOCIDSET, f.GetDocIdSet(searcher.GetIndexReader()), "A inverse range should return the EMPTY_DOCIDSET instance");
+ Assert.AreSame(DocIdSet.EMPTY_DOCIDSET, f.GetDocIdSet(searcher.IndexReader), "A inverse range should return the EMPTY_DOCIDSET instance");
//UPGRADE_TODO: The 'System.Int32' structure does not have an equivalent to NULL. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1291'"
System.Int32 tempAux3 = (System.Int32) System.Int32.MaxValue;
f = NumericRangeFilter.NewIntRange("field8", 8, tempAux3, null, false, false);
- Assert.AreSame(DocIdSet.EMPTY_DOCIDSET, f.GetDocIdSet(searcher.GetIndexReader()), "A exclusive range starting with Integer.MAX_VALUE should return the EMPTY_DOCIDSET instance");
+ Assert.AreSame(DocIdSet.EMPTY_DOCIDSET, f.GetDocIdSet(searcher.IndexReader), "A exclusive range starting with Integer.MAX_VALUE should return the EMPTY_DOCIDSET instance");
//UPGRADE_TODO: The 'System.Int32' structure does not have an equivalent to NULL. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1291'"
System.Int32 tempAux4 = (System.Int32) System.Int32.MinValue;
f = NumericRangeFilter.NewIntRange("field8", 8, null, tempAux4, false, false);
- Assert.AreSame(DocIdSet.EMPTY_DOCIDSET, f.GetDocIdSet(searcher.GetIndexReader()), "A exclusive range ending with Integer.MIN_VALUE should return the EMPTY_DOCIDSET instance");
+ Assert.AreSame(DocIdSet.EMPTY_DOCIDSET, f.GetDocIdSet(searcher.IndexReader), "A exclusive range ending with Integer.MIN_VALUE should return the EMPTY_DOCIDSET instance");
}
[Test]
@@ -149,7 +149,7 @@ namespace Lucene.Net.Search
System.Int32 tempAux = 1000;
System.Int32 tempAux2 = 1000;
NumericRangeQuery<int> q = NumericRangeQuery.NewIntRange("ascfield8", 8, tempAux, tempAux2, true, true);
- Assert.AreSame(MultiTermQuery.CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE, q.GetRewriteMethod());
+ Assert.AreSame(MultiTermQuery.CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE, q.QueryRewriteMethod);
TopDocs topDocs = searcher.Search(q, noDocs);
ScoreDoc[] sd = topDocs.ScoreDocs;
Assert.IsNotNull(sd);
@@ -165,13 +165,13 @@ namespace Lucene.Net.Search
System.Int32 tempAux = (System.Int32) upper;
NumericRangeQuery<int> q = NumericRangeQuery.NewIntRange(field, precisionStep, null, tempAux, true, true);
TopDocs topDocs = searcher.Search(q, null, noDocs, Sort.INDEXORDER);
- System.Console.Out.WriteLine("Found " + q.GetTotalNumberOfTerms() + " distinct terms in left open range for field '" + field + "'.");
+ System.Console.Out.WriteLine("Found " + q.TotalNumberOfTerms + " distinct terms in left open range for field '" + field + "'.");
ScoreDoc[] sd = topDocs.ScoreDocs;
Assert.IsNotNull(sd);
Assert.AreEqual(count, sd.Length, "Score doc count");
- Document doc = searcher.Doc(sd[0].doc);
+ Document doc = searcher.Doc(sd[0].Doc);
Assert.AreEqual(startOffset, System.Int32.Parse(doc.Get(field)), "First doc");
- doc = searcher.Doc(sd[sd.Length - 1].doc);
+ doc = searcher.Doc(sd[sd.Length - 1].Doc);
Assert.AreEqual((count - 1) * distance + startOffset, System.Int32.Parse(doc.Get(field)), "Last doc");
}
@@ -200,13 +200,13 @@ namespace Lucene.Net.Search
int lower = (count - 1) * distance + (distance / 3) + startOffset;
NumericRangeQuery<int> q = NumericRangeQuery.NewIntRange(field, precisionStep, lower, null, true, true);
TopDocs topDocs = searcher.Search(q, null, noDocs, Sort.INDEXORDER);
- System.Console.Out.WriteLine("Found " + q.GetTotalNumberOfTerms() + " distinct terms in right open range for field '" + field + "'.");
+ System.Console.Out.WriteLine("Found " + q.TotalNumberOfTerms + " distinct terms in right open range for field '" + field + "'.");
ScoreDoc[] sd = topDocs.ScoreDocs;
Assert.IsNotNull(sd);
Assert.AreEqual(noDocs - count, sd.Length, "Score doc count");
- Document doc = searcher.Doc(sd[0].doc);
+ Document doc = searcher.Doc(sd[0].Doc);
Assert.AreEqual(count * distance + startOffset, System.Int32.Parse(doc.Get(field)), "First doc");
- doc = searcher.Doc(sd[sd.Length - 1].doc);
+ doc = searcher.Doc(sd[sd.Length - 1].Doc);
Assert.AreEqual((noDocs - 1) * distance + startOffset, System.Int32.Parse(doc.Get(field)), "Last doc");
}
@@ -249,8 +249,8 @@ namespace Lucene.Net.Search
TopDocs tTopDocs = searcher.Search(tq, 1);
TopDocs cTopDocs = searcher.Search(cq, 1);
Assert.AreEqual(cTopDocs.TotalHits, tTopDocs.TotalHits, "Returned count for NumericRangeQuery and TermRangeQuery must be equal");
- termCountT += tq.GetTotalNumberOfTerms();
- termCountC += cq.GetTotalNumberOfTerms();
+ termCountT += tq.TotalNumberOfTerms;
+ termCountC += cq.TotalNumberOfTerms;
// test exclusive range
System.Int32 tempAux3 = (System.Int32) lower;
System.Int32 tempAux4 = (System.Int32) upper;
@@ -259,8 +259,8 @@ namespace Lucene.Net.Search
tTopDocs = searcher.Search(tq, 1);
cTopDocs = searcher.Search(cq, 1);
Assert.AreEqual(cTopDocs.TotalHits, tTopDocs.TotalHits, "Returned count for NumericRangeQuery and TermRangeQuery must be equal");
- termCountT += tq.GetTotalNumberOfTerms();
- termCountC += cq.GetTotalNumberOfTerms();
+ termCountT += tq.TotalNumberOfTerms;
+ termCountC += cq.TotalNumberOfTerms;
// test left exclusive range
System.Int32 tempAux5 = (System.Int32) lower;
System.Int32 tempAux6 = (System.Int32) upper;
@@ -269,8 +269,8 @@ namespace Lucene.Net.Search
tTopDocs = searcher.Search(tq, 1);
cTopDocs = searcher.Search(cq, 1);
Assert.AreEqual(cTopDocs.TotalHits, tTopDocs.TotalHits, "Returned count for NumericRangeQuery and TermRangeQuery must be equal");
- termCountT += tq.GetTotalNumberOfTerms();
- termCountC += cq.GetTotalNumberOfTerms();
+ termCountT += tq.TotalNumberOfTerms;
+ termCountC += cq.TotalNumberOfTerms;
// test right exclusive range
System.Int32 tempAux7 = (System.Int32) lower;
System.Int32 tempAux8 = (System.Int32) upper;
@@ -279,8 +279,8 @@ namespace Lucene.Net.Search
tTopDocs = searcher.Search(tq, 1);
cTopDocs = searcher.Search(cq, 1);
Assert.AreEqual(cTopDocs.TotalHits, tTopDocs.TotalHits, "Returned count for NumericRangeQuery and TermRangeQuery must be equal");
- termCountT += tq.GetTotalNumberOfTerms();
- termCountC += cq.GetTotalNumberOfTerms();
+ termCountT += tq.TotalNumberOfTerms;
+ termCountC += cq.TotalNumberOfTerms;
}
if (precisionStep == System.Int32.MaxValue)
{
@@ -436,10 +436,10 @@ namespace Lucene.Net.Search
continue;
ScoreDoc[] sd = topDocs.ScoreDocs;
Assert.IsNotNull(sd);
- int last = System.Int32.Parse(searcher.Doc(sd[0].doc).Get(field));
+ int last = System.Int32.Parse(searcher.Doc(sd[0].Doc).Get(field));
for (int j = 1; j < sd.Length; j++)
{
- int act = System.Int32.Parse(searcher.Doc(sd[j].doc).Get(field));
+ int act = System.Int32.Parse(searcher.Doc(sd[j].Doc).Get(field));
Assert.IsTrue(last > act, "Docs should be sorted backwards");
last = act;
}
@@ -503,7 +503,7 @@ namespace Lucene.Net.Search
private void testEnum(int lower, int upper)
{
NumericRangeQuery<int> q = NumericRangeQuery.NewIntRange("field4", 4, lower, upper, true, true);
- FilteredTermEnum termEnum = q.GetEnum(searcher.GetIndexReader());
+ FilteredTermEnum termEnum = q.GetEnum(searcher.IndexReader);
try
{
int count = 0;
Modified: incubator/lucene.net/trunk/test/core/Search/TestNumericRangeQuery64.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/test/core/Search/TestNumericRangeQuery64.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/test/core/Search/TestNumericRangeQuery64.cs (original)
+++ incubator/lucene.net/trunk/test/core/Search/TestNumericRangeQuery64.cs Mon Mar 12 22:29:26 2012
@@ -70,22 +70,22 @@ namespace Lucene.Net.Search
case 0:
type = " (constant score filter rewrite)";
- q.SetRewriteMethod(MultiTermQuery.CONSTANT_SCORE_FILTER_REWRITE);
+ q.QueryRewriteMethod = MultiTermQuery.CONSTANT_SCORE_FILTER_REWRITE;
topDocs = searcher.Search(q, null, noDocs, Sort.INDEXORDER);
- terms = q.GetTotalNumberOfTerms();
+ terms = q.TotalNumberOfTerms;
break;
case 1:
type = " (constant score boolean rewrite)";
- q.SetRewriteMethod(MultiTermQuery.CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE);
+ q.QueryRewriteMethod = MultiTermQuery.CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE;
topDocs = searcher.Search(q, null, noDocs, Sort.INDEXORDER);
- terms = q.GetTotalNumberOfTerms();
+ terms = q.TotalNumberOfTerms;
break;
case 2:
type = " (filter)";
topDocs = searcher.Search(new MatchAllDocsQuery(), f, noDocs, Sort.INDEXORDER);
- terms = f.GetTotalNumberOfTerms();
+ terms = f.TotalNumberOfTerms;
break;
default:
@@ -96,9 +96,9 @@ namespace Lucene.Net.Search
ScoreDoc[] sd = topDocs.ScoreDocs;
Assert.IsNotNull(sd);
Assert.AreEqual(count, sd.Length, "Score doc count" + type);
- Document doc = searcher.Doc(sd[0].doc);
+ Document doc = searcher.Doc(sd[0].Doc);
Assert.AreEqual(2 * distance + startOffset, System.Int64.Parse(doc.Get(field)), "First doc" + type);
- doc = searcher.Doc(sd[sd.Length - 1].doc);
+ doc = searcher.Doc(sd[sd.Length - 1].Doc);
Assert.AreEqual((1 + count) * distance + startOffset, System.Int64.Parse(doc.Get(field)), "Last doc" + type);
if (i > 0)
{
@@ -138,15 +138,15 @@ namespace Lucene.Net.Search
System.Int64 tempAux = 1000L;
System.Int64 tempAux2 = - 1000L;
NumericRangeFilter<long> f = NumericRangeFilter.NewLongRange("field8", 8, tempAux, tempAux2, true, true);
- Assert.AreSame(DocIdSet.EMPTY_DOCIDSET, f.GetDocIdSet(searcher.GetIndexReader()), "A inverse range should return the EMPTY_DOCIDSET instance");
+ Assert.AreSame(DocIdSet.EMPTY_DOCIDSET, f.GetDocIdSet(searcher.IndexReader), "A inverse range should return the EMPTY_DOCIDSET instance");
//UPGRADE_TODO: The 'System.Int64' structure does not have an equivalent to NULL. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1291'"
System.Int64 tempAux3 = (long) System.Int64.MaxValue;
f = NumericRangeFilter.NewLongRange("field8", 8, tempAux3, null, false, false);
- Assert.AreSame(DocIdSet.EMPTY_DOCIDSET, f.GetDocIdSet(searcher.GetIndexReader()), "A exclusive range starting with Long.MAX_VALUE should return the EMPTY_DOCIDSET instance");
+ Assert.AreSame(DocIdSet.EMPTY_DOCIDSET, f.GetDocIdSet(searcher.IndexReader), "A exclusive range starting with Long.MAX_VALUE should return the EMPTY_DOCIDSET instance");
//UPGRADE_TODO: The 'System.Int64' structure does not have an equivalent to NULL. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1291'"
System.Int64 tempAux4 = (long) System.Int64.MinValue;
f = NumericRangeFilter.NewLongRange("field8", 8, null, tempAux4, false, false);
- Assert.AreSame(DocIdSet.EMPTY_DOCIDSET, f.GetDocIdSet(searcher.GetIndexReader()), "A exclusive range ending with Long.MIN_VALUE should return the EMPTY_DOCIDSET instance");
+ Assert.AreSame(DocIdSet.EMPTY_DOCIDSET, f.GetDocIdSet(searcher.IndexReader), "A exclusive range ending with Long.MIN_VALUE should return the EMPTY_DOCIDSET instance");
}
[Test]
@@ -156,7 +156,7 @@ namespace Lucene.Net.Search
//UPGRADE_NOTE: ref keyword was added to struct-type parameters. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1303'"
System.Int64 tempAux2 = 1000L;
NumericRangeQuery<long> q = NumericRangeQuery.NewLongRange("ascfield8", 8, tempAux, tempAux2, true, true);
- Assert.AreSame(MultiTermQuery.CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE, q.GetRewriteMethod());
+ Assert.AreSame(MultiTermQuery.CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE, q.QueryRewriteMethod);
TopDocs topDocs = searcher.Search(q, noDocs);
ScoreDoc[] sd = topDocs.ScoreDocs;
Assert.IsNotNull(sd);
@@ -172,13 +172,13 @@ namespace Lucene.Net.Search
System.Int64 tempAux = (long) upper;
NumericRangeQuery<long> q = NumericRangeQuery.NewLongRange(field, precisionStep, null, tempAux, true, true);
TopDocs topDocs = searcher.Search(q, null, noDocs, Sort.INDEXORDER);
- System.Console.Out.WriteLine("Found " + q.GetTotalNumberOfTerms() + " distinct terms in left open range for field '" + field + "'.");
+ System.Console.Out.WriteLine("Found " + q.TotalNumberOfTerms + " distinct terms in left open range for field '" + field + "'.");
ScoreDoc[] sd = topDocs.ScoreDocs;
Assert.IsNotNull(sd);
Assert.AreEqual(count, sd.Length, "Score doc count");
- Document doc = searcher.Doc(sd[0].doc);
+ Document doc = searcher.Doc(sd[0].Doc);
Assert.AreEqual(startOffset, System.Int64.Parse(doc.Get(field)), "First doc");
- doc = searcher.Doc(sd[sd.Length - 1].doc);
+ doc = searcher.Doc(sd[sd.Length - 1].Doc);
Assert.AreEqual((count - 1) * distance + startOffset, System.Int64.Parse(doc.Get(field)), "Last doc");
}
@@ -215,13 +215,13 @@ namespace Lucene.Net.Search
System.Int64 tempAux = (long) lower;
NumericRangeQuery<long> q = NumericRangeQuery.NewLongRange(field, precisionStep, tempAux, null, true, true);
TopDocs topDocs = searcher.Search(q, null, noDocs, Sort.INDEXORDER);
- System.Console.Out.WriteLine("Found " + q.GetTotalNumberOfTerms() + " distinct terms in right open range for field '" + field + "'.");
+ System.Console.Out.WriteLine("Found " + q.TotalNumberOfTerms + " distinct terms in right open range for field '" + field + "'.");
ScoreDoc[] sd = topDocs.ScoreDocs;
Assert.IsNotNull(sd);
Assert.AreEqual(noDocs - count, sd.Length, "Score doc count");
- Document doc = searcher.Doc(sd[0].doc);
+ Document doc = searcher.Doc(sd[0].Doc);
Assert.AreEqual(count * distance + startOffset, System.Int64.Parse(doc.Get(field)), "First doc");
- doc = searcher.Doc(sd[sd.Length - 1].doc);
+ doc = searcher.Doc(sd[sd.Length - 1].Doc);
Assert.AreEqual((noDocs - 1) * distance + startOffset, System.Int64.Parse(doc.Get(field)), "Last doc");
}
@@ -270,8 +270,8 @@ namespace Lucene.Net.Search
TopDocs tTopDocs = searcher.Search(tq, 1);
TopDocs cTopDocs = searcher.Search(cq, 1);
Assert.AreEqual(cTopDocs.TotalHits, tTopDocs.TotalHits, "Returned count for NumericRangeQuery and TermRangeQuery must be equal");
- termCountT += tq.GetTotalNumberOfTerms();
- termCountC += cq.GetTotalNumberOfTerms();
+ termCountT += tq.TotalNumberOfTerms;
+ termCountC += cq.TotalNumberOfTerms;
// test exclusive range
System.Int64 tempAux3 = (long) lower;
System.Int64 tempAux4 = (long) upper;
@@ -280,8 +280,8 @@ namespace Lucene.Net.Search
tTopDocs = searcher.Search(tq, 1);
cTopDocs = searcher.Search(cq, 1);
Assert.AreEqual(cTopDocs.TotalHits, tTopDocs.TotalHits, "Returned count for NumericRangeQuery and TermRangeQuery must be equal");
- termCountT += tq.GetTotalNumberOfTerms();
- termCountC += cq.GetTotalNumberOfTerms();
+ termCountT += tq.TotalNumberOfTerms;
+ termCountC += cq.TotalNumberOfTerms;
// test left exclusive range
System.Int64 tempAux5 = (long) lower;
System.Int64 tempAux6 = (long) upper;
@@ -290,8 +290,8 @@ namespace Lucene.Net.Search
tTopDocs = searcher.Search(tq, 1);
cTopDocs = searcher.Search(cq, 1);
Assert.AreEqual(cTopDocs.TotalHits, tTopDocs.TotalHits, "Returned count for NumericRangeQuery and TermRangeQuery must be equal");
- termCountT += tq.GetTotalNumberOfTerms();
- termCountC += cq.GetTotalNumberOfTerms();
+ termCountT += tq.TotalNumberOfTerms;
+ termCountC += cq.TotalNumberOfTerms;
// test right exclusive range
System.Int64 tempAux7 = (long) lower;
System.Int64 tempAux8 = (long) upper;
@@ -300,8 +300,8 @@ namespace Lucene.Net.Search
tTopDocs = searcher.Search(tq, 1);
cTopDocs = searcher.Search(cq, 1);
Assert.AreEqual(cTopDocs.TotalHits, tTopDocs.TotalHits, "Returned count for NumericRangeQuery and TermRangeQuery must be equal");
- termCountT += tq.GetTotalNumberOfTerms();
- termCountC += cq.GetTotalNumberOfTerms();
+ termCountT += tq.TotalNumberOfTerms;
+ termCountC += cq.TotalNumberOfTerms;
}
if (precisionStep == System.Int32.MaxValue)
{
@@ -475,10 +475,10 @@ namespace Lucene.Net.Search
continue;
ScoreDoc[] sd = topDocs.ScoreDocs;
Assert.IsNotNull(sd);
- long last = System.Int64.Parse(searcher.Doc(sd[0].doc).Get(field));
+ long last = System.Int64.Parse(searcher.Doc(sd[0].Doc).Get(field));
for (int j = 1; j < sd.Length; j++)
{
- long act = System.Int64.Parse(searcher.Doc(sd[j].doc).Get(field));
+ long act = System.Int64.Parse(searcher.Doc(sd[j].Doc).Get(field));
Assert.IsTrue(last > act, "Docs should be sorted backwards");
last = act;
}
Modified: incubator/lucene.net/trunk/test/core/Search/TestPhraseQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/test/core/Search/TestPhraseQuery.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/test/core/Search/TestPhraseQuery.cs (original)
+++ incubator/lucene.net/trunk/test/core/Search/TestPhraseQuery.cs Mon Mar 12 22:29:26 2012
@@ -87,7 +87,7 @@ namespace Lucene.Net.Search
Document doc = new Document();
doc.Add(new Field("field", "one two three four five", Field.Store.YES, Field.Index.ANALYZED));
doc.Add(new Field("repeated", "this is a repeated field - first part", Field.Store.YES, Field.Index.ANALYZED));
- Fieldable repeatedField = new Field("repeated", "second part of a repeated field", Field.Store.YES, Field.Index.ANALYZED);
+ IFieldable repeatedField = new Field("repeated", "second part of a repeated field", Field.Store.YES, Field.Index.ANALYZED);
doc.Add(repeatedField);
doc.Add(new Field("palindrome", "one two three two one", Field.Store.YES, Field.Index.ANALYZED));
writer.AddDocument(doc);
@@ -118,7 +118,7 @@ namespace Lucene.Net.Search
[Test]
public virtual void TestNotCloseEnough()
{
- query.SetSlop(2);
+ query.Slop = 2;
query.Add(new Term("field", "one"));
query.Add(new Term("field", "five"));
ScoreDoc[] hits = searcher.Search(query, null, 1000).ScoreDocs;
@@ -129,7 +129,7 @@ namespace Lucene.Net.Search
[Test]
public virtual void TestBarelyCloseEnough()
{
- query.SetSlop(3);
+ query.Slop = 3;
query.Add(new Term("field", "one"));
query.Add(new Term("field", "five"));
ScoreDoc[] hits = searcher.Search(query, null, 1000).ScoreDocs;
@@ -161,7 +161,7 @@ namespace Lucene.Net.Search
public virtual void TestSlop1()
{
// Ensures slop of 1 works with terms in order.
- query.SetSlop(1);
+ query.Slop = 1;
query.Add(new Term("field", "one"));
query.Add(new Term("field", "two"));
ScoreDoc[] hits = searcher.Search(query, null, 1000).ScoreDocs;
@@ -172,7 +172,7 @@ namespace Lucene.Net.Search
// Ensures slop of 1 does not work for phrases out of order;
// must be at least 2.
query = new PhraseQuery();
- query.SetSlop(1);
+ query.Slop = 1;
query.Add(new Term("field", "two"));
query.Add(new Term("field", "one"));
hits = searcher.Search(query, null, 1000).ScoreDocs;
@@ -184,7 +184,7 @@ namespace Lucene.Net.Search
[Test]
public virtual void TestOrderDoesntMatter()
{
- query.SetSlop(2); // must be at least two for reverse order match
+ query.Slop = 2; // must be at least two for reverse order match
query.Add(new Term("field", "two"));
query.Add(new Term("field", "one"));
ScoreDoc[] hits = searcher.Search(query, null, 1000).ScoreDocs;
@@ -193,7 +193,7 @@ namespace Lucene.Net.Search
query = new PhraseQuery();
- query.SetSlop(2);
+ query.Slop = 2;
query.Add(new Term("field", "three"));
query.Add(new Term("field", "one"));
hits = searcher.Search(query, null, 1000).ScoreDocs;
@@ -207,7 +207,7 @@ namespace Lucene.Net.Search
[Test]
public virtual void TestMulipleTerms()
{
- query.SetSlop(2);
+ query.Slop = 2;
query.Add(new Term("field", "one"));
query.Add(new Term("field", "three"));
query.Add(new Term("field", "five"));
@@ -217,7 +217,7 @@ namespace Lucene.Net.Search
query = new PhraseQuery();
- query.SetSlop(5); // it takes six moves to match this phrase
+ query.Slop = 5; // it takes six moves to match this phrase
query.Add(new Term("field", "five"));
query.Add(new Term("field", "three"));
query.Add(new Term("field", "one"));
@@ -226,7 +226,7 @@ namespace Lucene.Net.Search
QueryUtils.Check(query, searcher);
- query.SetSlop(6);
+ query.Slop = 6;
hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.AreEqual(1, hits.Length, "slop of 6 just right");
QueryUtils.Check(query, searcher);
@@ -377,17 +377,17 @@ namespace Lucene.Net.Search
PhraseQuery query = new PhraseQuery();
query.Add(new Term("field", "firstname"));
query.Add(new Term("field", "lastname"));
- query.SetSlop(System.Int32.MaxValue);
+ query.Slop = System.Int32.MaxValue;
ScoreDoc[] hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.AreEqual(3, hits.Length);
// Make sure that those matches where the terms appear closer to
// each other get a higher score:
- Assert.AreEqual(0.71, hits[0].score, 0.01);
- Assert.AreEqual(0, hits[0].doc);
- Assert.AreEqual(0.44, hits[1].score, 0.01);
- Assert.AreEqual(1, hits[1].doc);
- Assert.AreEqual(0.31, hits[2].score, 0.01);
- Assert.AreEqual(2, hits[2].doc);
+ Assert.AreEqual(0.71, hits[0].Score, 0.01);
+ Assert.AreEqual(0, hits[0].Doc);
+ Assert.AreEqual(0.44, hits[1].Score, 0.01);
+ Assert.AreEqual(1, hits[1].Doc);
+ Assert.AreEqual(0.31, hits[2].Score, 0.01);
+ Assert.AreEqual(2, hits[2].Doc);
QueryUtils.Check(query, searcher);
}
@@ -396,7 +396,7 @@ namespace Lucene.Net.Search
{
StopAnalyzer analyzer = new StopAnalyzer(Util.Version.LUCENE_CURRENT);
QueryParser qp = new QueryParser(Util.Version.LUCENE_CURRENT, "field", analyzer);
- qp.SetEnablePositionIncrements(true);
+ qp.SetEnablePositionIncrements(new QueryParser.SetEnablePositionIncrementsParams(true));
PhraseQuery q = (PhraseQuery) qp.Parse("\"this hi this is a test is\"");
Assert.AreEqual("field:\"? hi ? ? ? test\"", q.ToString());
q.Add(new Term("field", "hello"), 1);
@@ -410,13 +410,13 @@ namespace Lucene.Net.Search
query.Add(new Term("repeated", "part"));
query.Add(new Term("repeated", "second"));
query.Add(new Term("repeated", "part"));
- query.SetSlop(100);
+ query.Slop = 100;
ScoreDoc[] hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.AreEqual(1, hits.Length, "slop of 100 just right");
QueryUtils.Check(query, searcher);
- query.SetSlop(99);
+ query.Slop = 99;
hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.AreEqual(0, hits.Length, "slop of 99 not enough");
@@ -431,7 +431,7 @@ namespace Lucene.Net.Search
query.Add(new Term("nonexist", "phrase"));
query.Add(new Term("nonexist", "notexist"));
query.Add(new Term("nonexist", "found"));
- query.SetSlop(2); // would be found this way
+ query.Slop = 2; // would be found this way
ScoreDoc[] hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.AreEqual(2, hits.Length, "phrase without repetitions exists in 2 docs");
@@ -442,7 +442,7 @@ namespace Lucene.Net.Search
query.Add(new Term("nonexist", "phrase"));
query.Add(new Term("nonexist", "exist"));
query.Add(new Term("nonexist", "exist"));
- query.SetSlop(1); // would be found
+ query.Slop = 1; // would be found
hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.AreEqual(2, hits.Length, "phrase with repetitions exists in two docs");
@@ -453,7 +453,7 @@ namespace Lucene.Net.Search
query.Add(new Term("nonexist", "phrase"));
query.Add(new Term("nonexist", "notexist"));
query.Add(new Term("nonexist", "phrase"));
- query.SetSlop(1000); // would not be found no matter how high the slop is
+ query.Slop = 1000; // would not be found no matter how high the slop is
hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.AreEqual(0, hits.Length, "nonexisting phrase with repetitions does not exist in any doc");
@@ -465,7 +465,7 @@ namespace Lucene.Net.Search
query.Add(new Term("nonexist", "exist"));
query.Add(new Term("nonexist", "exist"));
query.Add(new Term("nonexist", "exist"));
- query.SetSlop(1000); // would not be found no matter how high the slop is
+ query.Slop = 1000; // would not be found no matter how high the slop is
hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.AreEqual(0, hits.Length, "nonexisting phrase with repetitions does not exist in any doc");
@@ -485,32 +485,32 @@ namespace Lucene.Net.Search
{
// search on non palyndrome, find phrase with no slop, using exact phrase scorer
- query.SetSlop(0); // to use exact phrase scorer
+ query.Slop = 0; // to use exact phrase scorer
query.Add(new Term("field", "two"));
query.Add(new Term("field", "three"));
ScoreDoc[] hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.AreEqual(1, hits.Length, "phrase found with exact phrase scorer");
- float score0 = hits[0].score;
+ float score0 = hits[0].Score;
//System.out.println("(exact) field: two three: "+score0);
QueryUtils.Check(query, searcher);
// search on non palyndrome, find phrase with slop 2, though no slop required here.
- query.SetSlop(2); // to use sloppy scorer
+ query.Slop = 2; // to use sloppy scorer
hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.AreEqual(1, hits.Length, "just sloppy enough");
- float score1 = hits[0].score;
+ float score1 = hits[0].Score;
//System.out.println("(sloppy) field: two three: "+score1);
Assert.AreEqual(score0, score1, SCORE_COMP_THRESH, "exact scorer and sloppy scorer score the same when slop does not matter");
QueryUtils.Check(query, searcher);
// search ordered in palyndrome, find it twice
query = new PhraseQuery();
- query.SetSlop(2); // must be at least two for both ordered and reversed to match
+ query.Slop = 2; // must be at least two for both ordered and reversed to match
query.Add(new Term("palindrome", "two"));
query.Add(new Term("palindrome", "three"));
hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.AreEqual(1, hits.Length, "just sloppy enough");
- float score2 = hits[0].score;
+ float score2 = hits[0].Score;
//System.out.println("palindrome: two three: "+score2);
QueryUtils.Check(query, searcher);
@@ -519,12 +519,12 @@ namespace Lucene.Net.Search
// search reveresed in palyndrome, find it twice
query = new PhraseQuery();
- query.SetSlop(2); // must be at least two for both ordered and reversed to match
+ query.Slop = 2; // must be at least two for both ordered and reversed to match
query.Add(new Term("palindrome", "three"));
query.Add(new Term("palindrome", "two"));
hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.AreEqual(1, hits.Length, "just sloppy enough");
- float score3 = hits[0].score;
+ float score3 = hits[0].Score;
//System.out.println("palindrome: three two: "+score3);
QueryUtils.Check(query, searcher);
@@ -546,34 +546,34 @@ namespace Lucene.Net.Search
{
// search on non palyndrome, find phrase with no slop, using exact phrase scorer
- query.SetSlop(0); // to use exact phrase scorer
+ query.Slop = 0; // to use exact phrase scorer
query.Add(new Term("field", "one"));
query.Add(new Term("field", "two"));
query.Add(new Term("field", "three"));
ScoreDoc[] hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.AreEqual(1, hits.Length, "phrase found with exact phrase scorer");
- float score0 = hits[0].score;
+ float score0 = hits[0].Score;
//System.out.println("(exact) field: one two three: "+score0);
QueryUtils.Check(query, searcher);
// search on non palyndrome, find phrase with slop 3, though no slop required here.
- query.SetSlop(4); // to use sloppy scorer
+ query.Slop = 4; // to use sloppy scorer
hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.AreEqual(1, hits.Length, "just sloppy enough");
- float score1 = hits[0].score;
+ float score1 = hits[0].Score;
//System.out.println("(sloppy) field: one two three: "+score1);
Assert.AreEqual(score0, score1, SCORE_COMP_THRESH, "exact scorer and sloppy scorer score the same when slop does not matter");
QueryUtils.Check(query, searcher);
// search ordered in palyndrome, find it twice
query = new PhraseQuery();
- query.SetSlop(4); // must be at least four for both ordered and reversed to match
+ query.Slop = 4; // must be at least four for both ordered and reversed to match
query.Add(new Term("palindrome", "one"));
query.Add(new Term("palindrome", "two"));
query.Add(new Term("palindrome", "three"));
hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.AreEqual(1, hits.Length, "just sloppy enough");
- float score2 = hits[0].score;
+ float score2 = hits[0].Score;
//System.out.println("palindrome: one two three: "+score2);
QueryUtils.Check(query, searcher);
@@ -582,13 +582,13 @@ namespace Lucene.Net.Search
// search reveresed in palyndrome, find it twice
query = new PhraseQuery();
- query.SetSlop(4); // must be at least four for both ordered and reversed to match
+ query.Slop = 4; // must be at least four for both ordered and reversed to match
query.Add(new Term("palindrome", "three"));
query.Add(new Term("palindrome", "two"));
query.Add(new Term("palindrome", "one"));
hits = searcher.Search(query, null, 1000).ScoreDocs;
Assert.AreEqual(1, hits.Length, "just sloppy enough");
- float score3 = hits[0].score;
+ float score3 = hits[0].Score;
//System.out.println("palindrome: three two one: "+score3);
QueryUtils.Check(query, searcher);
Modified: incubator/lucene.net/trunk/test/core/Search/TestPositionIncrement.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/test/core/Search/TestPositionIncrement.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/test/core/Search/TestPositionIncrement.cs (original)
+++ incubator/lucene.net/trunk/test/core/Search/TestPositionIncrement.cs Mon Mar 12 22:29:26 2012
@@ -101,7 +101,7 @@ namespace Lucene.Net.Search
ClearAttributes();
termAtt.SetTermBuffer(TOKENS[i]);
offsetAtt.SetOffset(i, i);
- posIncrAtt.SetPositionIncrement(INCREMENTS[i]);
+ posIncrAtt.PositionIncrement = INCREMENTS[i];
i++;
return true;
}
@@ -140,12 +140,12 @@ namespace Lucene.Net.Search
IndexSearcher searcher = new IndexSearcher(store, true);
- TermPositions pos = searcher.GetIndexReader().TermPositions(new Term("field", "1"));
+ TermPositions pos = searcher.IndexReader.TermPositions(new Term("field", "1"));
pos.Next();
// first token should be at position 0
Assert.AreEqual(0, pos.NextPosition());
- pos = searcher.GetIndexReader().TermPositions(new Term("field", "2"));
+ pos = searcher.IndexReader.TermPositions(new Term("field", "2"));
pos.Next();
// second token should be at position 2
Assert.AreEqual(2, pos.NextPosition());
@@ -243,20 +243,20 @@ namespace Lucene.Net.Search
Assert.AreEqual(0, hits.Length);
// query parser alone won't help, because stop filter swallows the increments.
- qp.SetEnablePositionIncrements(true);
+ qp.SetEnablePositionIncrements(new QueryParser.SetEnablePositionIncrementsParams(true));
q = (PhraseQuery) qp.Parse("\"1 stop 2\"");
hits = searcher.Search(q, null, 1000).ScoreDocs;
Assert.AreEqual(0, hits.Length);
// stop filter alone won't help, because query parser swallows the increments.
- qp.SetEnablePositionIncrements(false);
+ qp.SetEnablePositionIncrements(new QueryParser.SetEnablePositionIncrementsParams(false));
q = (PhraseQuery) qp.Parse("\"1 stop 2\"");
hits = searcher.Search(q, null, 1000).ScoreDocs;
Assert.AreEqual(0, hits.Length);
// when both qp qnd stopFilter propagate increments, we should find the doc.
qp = new QueryParser(Util.Version.LUCENE_CURRENT, "field", new StopWhitespaceAnalyzer(true));
- qp.SetEnablePositionIncrements(true);
+ qp.SetEnablePositionIncrements(new QueryParser.SetEnablePositionIncrementsParams(true));
q = (PhraseQuery) qp.Parse("\"1 stop 2\"");
hits = searcher.Search(q, null, 1000).ScoreDocs;
Assert.AreEqual(1, hits.Length);
@@ -319,11 +319,11 @@ namespace Lucene.Net.Search
count = 0;
bool sawZero = false;
//System.out.println("\ngetPayloadSpans test");
- Lucene.Net.Search.Spans.Spans pspans = snq.GetSpans(is_Renamed.GetIndexReader());
+ Lucene.Net.Search.Spans.Spans pspans = snq.GetSpans(is_Renamed.IndexReader);
while (pspans.Next())
{
//System.out.println(pspans.doc() + " - " + pspans.start() + " - "+ pspans.end());
- System.Collections.Generic.ICollection<byte[]> payloads = pspans.GetPayload();
+ System.Collections.Generic.ICollection<byte[]> payloads = pspans.Payload;
sawZero |= pspans.Start() == 0;
for (System.Collections.IEnumerator it = payloads.GetEnumerator(); it.MoveNext();)
{
@@ -336,7 +336,7 @@ namespace Lucene.Net.Search
Assert.IsTrue(sawZero);
//System.out.println("\ngetSpans test");
- Lucene.Net.Search.Spans.Spans spans = snq.GetSpans(is_Renamed.GetIndexReader());
+ Lucene.Net.Search.Spans.Spans spans = snq.GetSpans(is_Renamed.IndexReader);
count = 0;
sawZero = false;
while (spans.Next())
@@ -351,7 +351,7 @@ namespace Lucene.Net.Search
//System.out.println("\nPayloadSpanUtil test");
sawZero = false;
- PayloadSpanUtil psu = new PayloadSpanUtil(is_Renamed.GetIndexReader());
+ PayloadSpanUtil psu = new PayloadSpanUtil(is_Renamed.IndexReader);
System.Collections.Generic.ICollection<byte[]> pls = psu.GetPayloadsForQuery(snq);
count = pls.Count;
for (System.Collections.IEnumerator it = pls.GetEnumerator(); it.MoveNext();)
@@ -363,7 +363,7 @@ namespace Lucene.Net.Search
Assert.AreEqual(5, count);
Assert.IsTrue(sawZero);
writer.Close();
- is_Renamed.GetIndexReader().Close();
+ is_Renamed.IndexReader.Close();
dir.Close();
}
}
@@ -404,7 +404,7 @@ namespace Lucene.Net.Search
{
if (input.IncrementToken())
{
- payloadAttr.SetPayload(new Payload(System.Text.UTF8Encoding.UTF8.GetBytes("pos: " + pos)));
+ payloadAttr.Payload = new Payload(System.Text.UTF8Encoding.UTF8.GetBytes("pos: " + pos));
int posIncr;
if (i % 2 == 1)
{
@@ -414,7 +414,7 @@ namespace Lucene.Net.Search
{
posIncr = 0;
}
- posIncrAttr.SetPositionIncrement(posIncr);
+ posIncrAttr.PositionIncrement = posIncr;
pos += posIncr;
// System.out.println("term=" + termAttr.term() + " pos=" + pos);
i++;
Modified: incubator/lucene.net/trunk/test/core/Search/TestPositiveScoresOnlyCollector.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/test/core/Search/TestPositiveScoresOnlyCollector.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/test/core/Search/TestPositiveScoresOnlyCollector.cs (original)
+++ incubator/lucene.net/trunk/test/core/Search/TestPositiveScoresOnlyCollector.cs Mon Mar 12 22:29:26 2012
@@ -92,7 +92,7 @@ namespace Lucene.Net.Search
Assert.AreEqual(numPositiveScores, td.TotalHits);
for (int i = 0; i < sd.Length; i++)
{
- Assert.IsTrue(sd[i].score > 0, "only positive scores should return: " + sd[i].score);
+ Assert.IsTrue(sd[i].Score > 0, "only positive scores should return: " + sd[i].Score);
}
}
}
Modified: incubator/lucene.net/trunk/test/core/Search/TestScorerPerf.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/test/core/Search/TestScorerPerf.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/test/core/Search/TestScorerPerf.cs (original)
+++ incubator/lucene.net/trunk/test/core/Search/TestScorerPerf.cs Mon Mar 12 22:29:26 2012
@@ -364,7 +364,7 @@ namespace Lucene.Net.Search
int tnum = r.Next(termsInIndex);
q.Add(new Term("f", System.Convert.ToString((char) (tnum + 'A'))), j);
}
- q.SetSlop(termsInIndex); // this could be random too
+ q.Slop = termsInIndex; // this could be random too
CountingHitCollector hc = new CountingHitCollector();
s.Search(q, hc);
Modified: incubator/lucene.net/trunk/test/core/Search/TestSetNorm.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/test/core/Search/TestSetNorm.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/test/core/Search/TestSetNorm.cs (original)
+++ incubator/lucene.net/trunk/test/core/Search/TestSetNorm.cs Mon Mar 12 22:29:26 2012
@@ -83,7 +83,7 @@ namespace Lucene.Net.Search
IndexWriter writer = new IndexWriter(store, new SimpleAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
// add the same document four times
- Fieldable f1 = new Field("field", "word", Field.Store.YES, Field.Index.ANALYZED);
+ IFieldable f1 = new Field("field", "word", Field.Store.YES, Field.Index.ANALYZED);
Document d1 = new Document();
d1.Add(f1);
writer.AddDocument(d1);
Modified: incubator/lucene.net/trunk/test/core/Search/TestSimilarity.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/test/core/Search/TestSimilarity.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/test/core/Search/TestSimilarity.cs (original)
+++ incubator/lucene.net/trunk/test/core/Search/TestSimilarity.cs Mon Mar 12 22:29:26 2012
@@ -187,9 +187,9 @@ namespace Lucene.Net.Search
private class AnonymousIDFExplanation : Explanation.IDFExplanation
{
- public override float GetIdf()
+ public override float Idf
{
- return 1.0f;
+ get { return 1.0f; }
}
public override string Explain()
@@ -250,7 +250,7 @@ namespace Lucene.Net.Search
writer.Close();
Searcher searcher = new IndexSearcher(store, true);
- searcher.SetSimilarity(new SimpleSimilarity());
+ searcher.Similarity = new SimpleSimilarity();
Term a = new Term("field", "a");
Term b = new Term("field", "b");
@@ -270,7 +270,7 @@ namespace Lucene.Net.Search
//System.out.println(pq.toString("field"));
searcher.Search(pq, new AnonymousClassCollector2(this));
- pq.SetSlop(2);
+ pq.Slop = 2;
//System.out.println(pq.toString("field"));
searcher.Search(pq, new AnonymousClassCollector3(this));
}
Modified: incubator/lucene.net/trunk/test/core/Search/TestSimpleExplanations.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/test/core/Search/TestSimpleExplanations.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/test/core/Search/TestSimpleExplanations.cs (original)
+++ incubator/lucene.net/trunk/test/core/Search/TestSimpleExplanations.cs Mon Mar 12 22:29:26 2012
@@ -69,7 +69,7 @@ namespace Lucene.Net.Search
public virtual void TestMA2()
{
Query q = new MatchAllDocsQuery();
- q.SetBoost(1000);
+ q.Boost = 1000;
Qtest(q, new int[]{0, 1, 2, 3});
}
@@ -137,7 +137,7 @@ namespace Lucene.Net.Search
public virtual void TestFQ6()
{
Query q = new FilteredQuery(qp.Parse("xx"), new ItemizedFilter(new int[]{1, 3}));
- q.SetBoost(1000);
+ q.Boost = 1000;
Qtest(q, new int[]{3});
}
@@ -159,7 +159,7 @@ namespace Lucene.Net.Search
public virtual void TestCSQ3()
{
Query q = new ConstantScoreQuery(new ItemizedFilter(new int[]{0, 2}));
- q.SetBoost(1000);
+ q.Boost = 1000;
Qtest(q, new int[]{0, 2});
}
@@ -278,7 +278,7 @@ namespace Lucene.Net.Search
MultiPhraseQuery q = new MultiPhraseQuery();
q.Add(Ta(new System.String[]{"w1"}));
q.Add(Ta(new System.String[]{"w2"}));
- q.SetSlop(1);
+ q.Slop = 1;
Qtest(q, new int[]{0, 1, 2});
}
[Test]
@@ -287,7 +287,7 @@ namespace Lucene.Net.Search
MultiPhraseQuery q = new MultiPhraseQuery();
q.Add(Ta(new System.String[]{"w1", "w3"}));
q.Add(Ta(new System.String[]{"w2"}));
- q.SetSlop(1);
+ q.Slop = 1;
Qtest(q, new int[]{0, 1, 2, 3});
}
@@ -437,7 +437,7 @@ namespace Lucene.Net.Search
Assert.AreEqual(3, hits.Length);
- Explanation explain = mSearcher.Explain(query, hits[0].doc);
+ Explanation explain = mSearcher.Explain(query, hits[0].Doc);
System.String exp = explain.ToString(0);
Assert.IsTrue(exp.IndexOf("maxDocs=3") > - 1, exp);
Assert.IsTrue(exp.IndexOf("docFreq=3") > - 1, exp);
@@ -447,7 +447,7 @@ namespace Lucene.Net.Search
Assert.AreEqual(3, hits.Length);
- explain = mSearcher.Explain(query, hits[0].doc);
+ explain = mSearcher.Explain(query, hits[0].Doc);
exp = explain.ToString(0);
Assert.IsTrue(exp.IndexOf("1=3") > - 1, exp);
Assert.IsTrue(exp.IndexOf("2=3") > - 1, exp);
@@ -457,7 +457,7 @@ namespace Lucene.Net.Search
Assert.AreEqual(3, hits.Length);
- explain = mSearcher.Explain(query, hits[0].doc);
+ explain = mSearcher.Explain(query, hits[0].Doc);
exp = explain.ToString(0);
Assert.IsTrue(exp.IndexOf("1=3") > - 1, exp);
Assert.IsTrue(exp.IndexOf("2=3") > - 1, exp);
Modified: incubator/lucene.net/trunk/test/core/Search/TestSloppyPhraseQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/test/core/Search/TestSloppyPhraseQuery.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/test/core/Search/TestSloppyPhraseQuery.cs (original)
+++ incubator/lucene.net/trunk/test/core/Search/TestSloppyPhraseQuery.cs Mon Mar 12 22:29:26 2012
@@ -130,7 +130,7 @@ namespace Lucene.Net.Search
private float CheckPhraseQuery(Document doc, PhraseQuery query, int slop, int expectedNumResults)
{
- query.SetSlop(slop);
+ query.Slop = slop;
RAMDirectory ramDir = new RAMDirectory();
WhitespaceAnalyzer analyzer = new WhitespaceAnalyzer();
@@ -147,15 +147,15 @@ namespace Lucene.Net.Search
searcher.Close();
ramDir.Close();
-
- return td.GetMaxScore();
+
+ return td.MaxScore;
}
private static Document MakeDocument(System.String docText)
{
Document doc = new Document();
Field f = new Field("f", docText, Field.Store.NO, Field.Index.ANALYZED);
- f.SetOmitNorms(true);
+ f.OmitNorms = true;
doc.Add(f);
return doc;
}
Modified: incubator/lucene.net/trunk/test/core/Search/TestSort.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/test/core/Search/TestSort.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/test/core/Search/TestSort.cs (original)
+++ incubator/lucene.net/trunk/test/core/Search/TestSort.cs Mon Mar 12 22:29:26 2012
@@ -218,9 +218,9 @@ namespace Lucene.Net.Search
}
public override DocIdSet GetDocIdSet(IndexReader reader)
{
- System.Collections.BitArray bs = new System.Collections.BitArray((reader.MaxDoc() % 64 == 0?reader.MaxDoc() / 64:reader.MaxDoc() / 64 + 1) * 64);
- for (int i = 0; i < reader.MaxDoc(); i++) bs.Set(i, true);
- bs.Set(docs1.ScoreDocs[0].doc, true);
+ System.Collections.BitArray bs = new System.Collections.BitArray((reader.MaxDoc % 64 == 0?reader.MaxDoc / 64:reader.MaxDoc / 64 + 1) * 64);
+ for (int i = 0; i < reader.MaxDoc; i++) bs.Set(i, true);
+ bs.Set(docs1.ScoreDocs[0].Doc, true);
return new DocIdBitSet(bs);
}
}
@@ -484,7 +484,7 @@ namespace Lucene.Net.Search
bool fail = false;
for (int x = 0; x < n; ++x)
{
- Document doc2 = searcher.Doc(result[x].doc);
+ Document doc2 = searcher.Doc(result[x].Doc);
System.String[] v = doc2.GetValues("tracer");
System.String[] v2 = doc2.GetValues("tracer2");
for (int j = 0; j < v.Length; ++j)
@@ -510,18 +510,18 @@ namespace Lucene.Net.Search
else if (cmp == 0)
{
// ensure docid is in order
- if (result[x].doc < lastDocId)
+ if (result[x].Doc < lastDocId)
{
fail = true;
- System.Console.Out.WriteLine("doc fail:" + result[x].doc + " > " + lastDocId);
+ System.Console.Out.WriteLine("doc fail:" + result[x].Doc + " > " + lastDocId);
}
}
}
}
last = v[j];
lastSub = v2[j];
- lastDocId = result[x].doc;
- buff.Append(v[j] + "(" + v2[j] + ")(" + result[x].doc + ") ");
+ lastDocId = result[x].Doc;
+ buff.Append(v[j] + "(" + v2[j] + ")(" + result[x].Doc + ") ");
}
}
if (fail)
@@ -657,11 +657,11 @@ namespace Lucene.Net.Search
{
docValues = Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetInts(reader, "parser", new AnonymousClassIntParser1(this));
}
-
- public override System.IComparable Value(int slot)
- {
- return (System.Int32) slotValues[slot];
- }
+
+ public override IComparable this[int slot]
+ {
+ get { return (System.Int32) slotValues[slot]; }
+ }
}
[Serializable]
@@ -956,7 +956,7 @@ namespace Lucene.Net.Search
TopDocs docs2 = full.Search(queryE, filt, nDocs, sort);
- Assert.AreEqual(docs1.ScoreDocs[0].score, docs2.ScoreDocs[0].score, 1e-6);
+ Assert.AreEqual(docs1.ScoreDocs[0].Score, docs2.ScoreDocs[0].Score, 1e-6);
}
[Test]
@@ -979,7 +979,7 @@ namespace Lucene.Net.Search
ScoreDoc[] sd = tdc.TopDocs().ScoreDocs;
for (int j = 1; j < sd.Length; j++)
{
- Assert.IsTrue(sd[j].doc != sd[j - 1].doc);
+ Assert.IsTrue(sd[j].Doc != sd[j - 1].Doc);
}
}
}
@@ -1001,9 +1001,9 @@ namespace Lucene.Net.Search
ScoreDoc[] sd = td.ScoreDocs;
for (int j = 0; j < sd.Length; j++)
{
- Assert.IsTrue(System.Single.IsNaN(sd[j].score));
+ Assert.IsTrue(System.Single.IsNaN(sd[j].Score));
}
- Assert.IsTrue(System.Single.IsNaN(td.GetMaxScore()));
+ Assert.IsTrue(System.Single.IsNaN(td.MaxScore));
}
}
@@ -1024,9 +1024,9 @@ namespace Lucene.Net.Search
ScoreDoc[] sd = td.ScoreDocs;
for (int j = 0; j < sd.Length; j++)
{
- Assert.IsTrue(!System.Single.IsNaN(sd[j].score));
+ Assert.IsTrue(!System.Single.IsNaN(sd[j].Score));
}
- Assert.IsTrue(System.Single.IsNaN(td.GetMaxScore()));
+ Assert.IsTrue(System.Single.IsNaN(td.MaxScore));
}
}
@@ -1047,9 +1047,9 @@ namespace Lucene.Net.Search
ScoreDoc[] sd = td.ScoreDocs;
for (int j = 0; j < sd.Length; j++)
{
- Assert.IsTrue(!System.Single.IsNaN(sd[j].score));
+ Assert.IsTrue(!System.Single.IsNaN(sd[j].Score));
}
- Assert.IsTrue(!System.Single.IsNaN(td.GetMaxScore()));
+ Assert.IsTrue(!System.Single.IsNaN(td.MaxScore));
}
}
@@ -1109,7 +1109,7 @@ namespace Lucene.Net.Search
TopFieldCollector tdc = TopFieldCollector.create(sort[i], 10, true, true, true, true);
TopDocs td = tdc.TopDocs();
Assert.AreEqual(0, td.TotalHits);
- Assert.IsTrue(System.Single.IsNaN(td.GetMaxScore()));
+ Assert.IsTrue(System.Single.IsNaN(td.MaxScore));
}
}
@@ -1202,7 +1202,7 @@ namespace Lucene.Net.Search
int n = result.Length;
for (int i = 0; i < n; ++i)
{
- Document doc = searcher.Doc(result[i].doc);
+ Document doc = searcher.Doc(result[i].Doc);
System.String[] v = doc.GetValues("tracer");
for (int j = 0; j < v.Length; ++j)
{
@@ -1218,10 +1218,10 @@ namespace Lucene.Net.Search
int n = hits.Length;
for (int i = 0; i < n; ++i)
{
- Document doc = searcher.Doc(hits[i].doc);
+ Document doc = searcher.Doc(hits[i].Doc);
System.String[] v = doc.GetValues("tracer");
Assert.AreEqual(v.Length, 1);
- scoreMap[v[0]] = (float) hits[i].score;
+ scoreMap[v[0]] = (float) hits[i].Score;
}
return scoreMap;
}
Modified: incubator/lucene.net/trunk/test/core/Search/TestSpanQueryFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/test/core/Search/TestSpanQueryFilter.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/test/core/Search/TestSpanQueryFilter.cs (original)
+++ incubator/lucene.net/trunk/test/core/Search/TestSpanQueryFilter.cs Mon Mar 12 22:29:26 2012
@@ -55,10 +55,10 @@ namespace Lucene.Net.Search
SpanTermQuery query = new SpanTermQuery(new Term("field", English.IntToEnglish(10).Trim()));
SpanQueryFilter filter = new SpanQueryFilter(query);
SpanFilterResult result = filter.BitSpans(reader);
- DocIdSet docIdSet = result.GetDocIdSet();
+ DocIdSet docIdSet = result.DocIdSet;
Assert.IsTrue(docIdSet != null, "docIdSet is null and it shouldn't be");
AssertContainsDocId("docIdSet doesn't contain docId 10", docIdSet, 10);
- var spans = result.GetPositions();
+ var spans = result.Positions;
Assert.IsTrue(spans != null, "spans is null and it shouldn't be");
int size = GetDocIdSetSize(docIdSet);
Assert.IsTrue(spans.Count == size, "spans Size: " + spans.Count + " is not: " + size);
@@ -67,9 +67,9 @@ namespace Lucene.Net.Search
SpanFilterResult.PositionInfo info = (SpanFilterResult.PositionInfo) iterator.Current;
Assert.IsTrue(info != null, "info is null and it shouldn't be");
//The doc should indicate the bit is on
- AssertContainsDocId("docIdSet doesn't contain docId " + info.GetDoc(), docIdSet, info.GetDoc());
+ AssertContainsDocId("docIdSet doesn't contain docId " + info.Doc, docIdSet, info.Doc);
//There should be two positions in each
- Assert.IsTrue(info.GetPositions().Count == 2, "info.getPositions() Size: " + info.GetPositions().Count + " is not: " + 2);
+ Assert.IsTrue(info.Positions.Count == 2, "info.getPositions() Size: " + info.Positions.Count + " is not: " + 2);
}
reader.Close();
}
Modified: incubator/lucene.net/trunk/test/core/Search/TestTermRangeFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/test/core/Search/TestTermRangeFilter.cs?rev=1299911&r1=1299910&r2=1299911&view=diff
==============================================================================
--- incubator/lucene.net/trunk/test/core/Search/TestTermRangeFilter.cs (original)
+++ incubator/lucene.net/trunk/test/core/Search/TestTermRangeFilter.cs Mon Mar 12 22:29:26 2012
@@ -62,7 +62,7 @@ namespace Lucene.Net.Search
System.String maxIP = Pad(maxId);
System.String medIP = Pad(medId);
- int numDocs = reader.NumDocs();
+ int numDocs = reader.NumDocs;
Assert.AreEqual(numDocs, 1 + maxId - minId, "num of docs");
@@ -147,7 +147,7 @@ namespace Lucene.Net.Search
System.String maxIP = Pad(maxId);
System.String medIP = Pad(medId);
- int numDocs = reader.NumDocs();
+ int numDocs = reader.NumDocs;
Assert.AreEqual(numDocs, 1 + maxId - minId, "num of docs");
@@ -227,7 +227,7 @@ namespace Lucene.Net.Search
System.String minRP = Pad(signedIndex.minR);
System.String maxRP = Pad(signedIndex.maxR);
- int numDocs = reader.NumDocs();
+ int numDocs = reader.NumDocs;
Assert.AreEqual(numDocs, 1 + maxId - minId, "num of docs");
@@ -293,7 +293,7 @@ namespace Lucene.Net.Search
System.String minRP = Pad(unsignedIndex.minR);
System.String maxRP = Pad(unsignedIndex.maxR);
- int numDocs = reader.NumDocs();
+ int numDocs = reader.NumDocs;
Assert.AreEqual(numDocs, 1 + maxId - minId, "num of docs");