You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by do...@apache.org on 2009/07/29 20:04:24 UTC
svn commit: r798995 [34/35] - in /incubator/lucene.net/trunk/C#/src:
Lucene.Net/ Lucene.Net/Analysis/ Lucene.Net/Analysis/Standard/
Lucene.Net/Document/ Lucene.Net/Index/ Lucene.Net/QueryParser/
Lucene.Net/Search/ Lucene.Net/Search/Function/ Lucene.Net...
Modified: incubator/lucene.net/trunk/C#/src/Test/Search/TestSpanQueryFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/TestSpanQueryFilter.cs?rev=798995&r1=798994&r2=798995&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/TestSpanQueryFilter.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/TestSpanQueryFilter.cs Wed Jul 29 18:04:12 2009
@@ -42,11 +42,11 @@
public virtual void TestFilterWorks()
{
Directory dir = new RAMDirectory();
- IndexWriter writer = new IndexWriter(dir, new SimpleAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(dir, new SimpleAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
for (int i = 0; i < 500; i++)
{
Document document = new Document();
- document.Add(new Field("field", English.IntToEnglish(i) + " equals " + English.IntToEnglish(i), Field.Store.NO, Field.Index.TOKENIZED));
+ document.Add(new Field("field", English.IntToEnglish(i) + " equals " + English.IntToEnglish(i), Field.Store.NO, Field.Index.ANALYZED));
writer.AddDocument(document);
}
writer.Close();
@@ -56,27 +56,39 @@
SpanTermQuery query = new SpanTermQuery(new Term("field", English.IntToEnglish(10).Trim()));
SpanQueryFilter filter = new SpanQueryFilter(query);
SpanFilterResult result = filter.BitSpans(reader);
- System.Collections.BitArray bits = result.GetBits();
- Assert.IsTrue(bits != null, "bits is null and it shouldn't be");
- Assert.IsTrue(bits.Get(10), "tenth bit is not on");
+ DocIdSet docIdSet = result.GetDocIdSet();
+ Assert.IsTrue(docIdSet != null, "docIdSet is null and it shouldn't be");
+ AssertContainsDocId("docIdSet doesn't contain docId 10", docIdSet, 10);
System.Collections.IList spans = result.GetPositions();
Assert.IsTrue(spans != null, "spans is null and it shouldn't be");
- int cardinality = 0;
- for (int i = 0; i < bits.Count; i++)
- {
- if (bits.Get(i)) cardinality++;
- }
- Assert.IsTrue(spans.Count == cardinality, "spans Size: " + spans.Count + " is not: " + cardinality);
+ int size = GetDocIdSetSize(docIdSet);
+ Assert.IsTrue(spans.Count == size, "spans Size: " + spans.Count + " is not: " + size);
for (System.Collections.IEnumerator iterator = spans.GetEnumerator(); iterator.MoveNext(); )
{
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
- Assert.IsTrue(bits.Get(info.GetDoc()), "Bit is not on and it should be");
+ AssertContainsDocId("docIdSet doesn't contain docId " + info.GetDoc(), docIdSet, info.GetDoc());
//There should be two positions in each
Assert.IsTrue(info.GetPositions().Count == 2, "info.getPositions() Size: " + info.GetPositions().Count + " is not: " + 2);
}
reader.Close();
}
+
+ internal int GetDocIdSetSize(DocIdSet docIdSet)
+ {
+ int size = 0;
+ DocIdSetIterator it = docIdSet.Iterator();
+ while (it.Next())
+ size++;
+ return size;
+ }
+
+ public void AssertContainsDocId(string msg, DocIdSet docIdSet, int docId)
+ {
+ DocIdSetIterator it = docIdSet.Iterator();
+ Assert.IsTrue(it.SkipTo(docId), msg);
+ Assert.IsTrue(it.Doc() == docId, msg);
+ }
}
}
\ No newline at end of file
Modified: incubator/lucene.net/trunk/C#/src/Test/Search/TestTermScorer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/TestTermScorer.cs?rev=798995&r1=798994&r2=798995&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/TestTermScorer.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/TestTermScorer.cs Wed Jul 29 18:04:12 2009
@@ -81,11 +81,11 @@
directory = new RAMDirectory();
- IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(directory, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
for (int i = 0; i < values.Length; i++)
{
Document doc = new Document();
- doc.Add(new Field(FIELD, values[i], Field.Store.YES, Field.Index.TOKENIZED));
+ doc.Add(new Field(FIELD, values[i], Field.Store.YES, Field.Index.ANALYZED));
writer.AddDocument(doc);
}
writer.Close();
Modified: incubator/lucene.net/trunk/C#/src/Test/Search/TestTermVectors.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/TestTermVectors.cs?rev=798995&r1=798994&r2=798995&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/TestTermVectors.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/TestTermVectors.cs Wed Jul 29 18:04:12 2009
@@ -19,14 +19,14 @@
using NUnit.Framework;
+using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
+using SimpleAnalyzer = Lucene.Net.Analysis.SimpleAnalyzer;
using Document = Lucene.Net.Documents.Document;
using Field = Lucene.Net.Documents.Field;
using Lucene.Net.Index;
using Directory = Lucene.Net.Store.Directory;
-using RAMDirectory = Lucene.Net.Store.RAMDirectory;
-using SimpleAnalyzer = Lucene.Net.Analysis.SimpleAnalyzer;
+using MockRAMDirectory = Lucene.Net.Store.MockRAMDirectory;
using English = Lucene.Net.Util.English;
-using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
namespace Lucene.Net.Search
{
@@ -34,16 +34,13 @@
public class TestTermVectors : LuceneTestCase
{
private IndexSearcher searcher;
- private RAMDirectory directory = new RAMDirectory();
- //public TestTermVectors(System.String s) : base(s)
- //{
- //}
+ private Directory directory = new MockRAMDirectory();
[SetUp]
public override void SetUp()
{
base.SetUp();
- IndexWriter writer = new IndexWriter(directory, new SimpleAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(directory, new SimpleAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
//writer.setUseCompoundFile(true);
//writer.infoStream = System.out;
for (int i = 0; i < 1000; i++)
@@ -68,7 +65,7 @@
{
termVector = Field.TermVector.YES;
}
- doc.Add(new Field("field", English.IntToEnglish(i), Field.Store.YES, Field.Index.TOKENIZED, termVector));
+ doc.Add(new Field("field", English.IntToEnglish(i), Field.Store.YES, Field.Index.ANALYZED, termVector));
writer.AddDocument(doc);
}
writer.Close();
@@ -87,12 +84,12 @@
Query query = new TermQuery(new Term("field", "seventy"));
try
{
- Hits hits = searcher.Search(query);
- Assert.AreEqual(100, hits.Length());
+ ScoreDoc[] hits = searcher.Search(query, null, 1000).scoreDocs;
+ Assert.AreEqual(100, hits.Length);
- for (int i = 0; i < hits.Length(); i++)
+ for (int i = 0; i < hits.Length; i++)
{
- TermFreqVector[] vector = searcher.Reader.GetTermFreqVectors(hits.Id(i));
+ TermFreqVector[] vector = searcher.Reader.GetTermFreqVectors(hits[i].doc);
Assert.IsTrue(vector != null);
Assert.IsTrue(vector.Length == 1);
}
@@ -102,26 +99,61 @@
Assert.IsTrue(false);
}
}
-
+
+ [Test]
+ public void TestTermVectorsFieldOrder()
+ {
+ Directory dir = new MockRAMDirectory();
+ IndexWriter writer = new IndexWriter(dir, new SimpleAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
+ Document doc = new Document();
+ doc.Add(new Field("c", "some content here", Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
+ doc.Add(new Field("a", "some content here", Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
+ doc.Add(new Field("b", "some content here", Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
+ doc.Add(new Field("x", "some content here", Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
+ writer.AddDocument(doc);
+ writer.Close();
+ IndexReader reader = IndexReader.Open(dir);
+ TermFreqVector[] v = reader.GetTermFreqVectors(0);
+ Assert.AreEqual(4, v.Length);
+ String[] expectedFields = new String[] { "a", "b", "c", "x" };
+ int[] expectedPositions = new int[] { 1, 2, 0 };
+ for (int i = 0; i < v.Length; i++)
+ {
+ TermPositionVector posVec = (TermPositionVector)v[i];
+ Assert.AreEqual(expectedFields[i], posVec.GetField());
+ String[] terms = posVec.GetTerms();
+ Assert.AreEqual(3, terms.Length);
+ Assert.AreEqual("content", terms[0]);
+ Assert.AreEqual("here", terms[1]);
+ Assert.AreEqual("some", terms[2]);
+ for (int j = 0; j < 3; j++)
+ {
+ int[] positions = posVec.GetTermPositions(j);
+ Assert.AreEqual(1, positions.Length);
+ Assert.AreEqual(expectedPositions[j], positions[0]);
+ }
+ }
+ }
+
[Test]
public virtual void TestTermPositionVectors()
{
Query query = new TermQuery(new Term("field", "zero"));
try
{
- Hits hits = searcher.Search(query);
- Assert.AreEqual(1, hits.Length());
+ ScoreDoc[] hits = searcher.Search(query, null, 1000).scoreDocs;
+ Assert.AreEqual(1, hits.Length);
- for (int i = 0; i < hits.Length(); i++)
+ for (int i = 0; i < hits.Length; i++)
{
- TermFreqVector[] vector = searcher.Reader.GetTermFreqVectors(hits.Id(i));
+ TermFreqVector[] vector = searcher.Reader.GetTermFreqVectors(hits[i].doc);
Assert.IsTrue(vector != null);
Assert.IsTrue(vector.Length == 1);
-
- bool shouldBePosVector = (hits.Id(i) % 2 == 0)?true:false;
+
+ bool shouldBePosVector = (hits[i].doc % 2 == 0) ? true : false;
Assert.IsTrue((shouldBePosVector == false) || (shouldBePosVector == true && (vector[0] is TermPositionVector == true)));
-
- bool shouldBeOffVector = (hits.Id(i) % 3 == 0)?true:false;
+
+ bool shouldBeOffVector = (hits[i].doc % 3 == 0) ? true : false;
Assert.IsTrue((shouldBeOffVector == false) || (shouldBeOffVector == true && (vector[0] is TermPositionVector == true)));
if (shouldBePosVector || shouldBeOffVector)
@@ -180,12 +212,12 @@
Query query = new TermQuery(new Term("field", "fifty"));
try
{
- Hits hits = searcher.Search(query);
- Assert.AreEqual(100, hits.Length());
+ ScoreDoc[] hits = searcher.Search(query, null, 1000).scoreDocs;
+ Assert.AreEqual(100, hits.Length);
- for (int i = 0; i < hits.Length(); i++)
+ for (int i = 0; i < hits.Length; i++)
{
- TermFreqVector[] vector = searcher.Reader.GetTermFreqVectors(hits.Id(i));
+ TermFreqVector[] vector = searcher.Reader.GetTermFreqVectors(hits[i].doc);
Assert.IsTrue(vector != null);
Assert.IsTrue(vector.Length == 1);
@@ -227,11 +259,11 @@
Lucene.Net.Documents.Document testDoc4 = new Lucene.Net.Documents.Document();
SetupDoc(testDoc4, test4);
- Directory dir = new RAMDirectory();
+ Directory dir = new MockRAMDirectory();
try
{
- IndexWriter writer = new IndexWriter(dir, new SimpleAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(dir, new SimpleAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
Assert.IsTrue(writer != null);
writer.AddDocument(testDoc1);
writer.AddDocument(testDoc2);
@@ -276,20 +308,20 @@
//System.out.println("--------");
}
Query query = new TermQuery(new Term("field", "chocolate"));
- Hits hits = knownSearcher.Search(query);
+ ScoreDoc[] hits = knownSearcher.Search(query, null, 1000).scoreDocs;
//doc 3 should be the first hit b/c it is the shortest match
- Assert.IsTrue(hits.Length() == 3);
- float score = hits.Score(0);
+ Assert.IsTrue(hits.Length == 3);
+ float score = hits[0].score;
/*System.out.println("Hit 0: " + hits.id(0) + " Score: " + hits.score(0) + " String: " + hits.doc(0).toString());
System.out.println("Explain: " + knownSearcher.explain(query, hits.id(0)));
System.out.println("Hit 1: " + hits.id(1) + " Score: " + hits.score(1) + " String: " + hits.doc(1).toString());
System.out.println("Explain: " + knownSearcher.explain(query, hits.id(1)));
System.out.println("Hit 2: " + hits.id(2) + " Score: " + hits.score(2) + " String: " + hits.doc(2).toString());
System.out.println("Explain: " + knownSearcher.explain(query, hits.id(2)));*/
- Assert.IsTrue(hits.Id(0) == 2);
- Assert.IsTrue(hits.Id(1) == 3);
- Assert.IsTrue(hits.Id(2) == 0);
- TermFreqVector vector2 = knownSearcher.Reader.GetTermFreqVector(hits.Id(1), "field");
+ Assert.IsTrue(hits[0].doc == 2);
+ Assert.IsTrue(hits[1].doc == 3);
+ Assert.IsTrue(hits[2].doc == 0);
+ TermFreqVector vector2 = knownSearcher.Reader.GetTermFreqVector(hits[1].doc, "field");
Assert.IsTrue(vector2 != null);
//System.out.println("Vector: " + vector);
System.String[] terms = vector2.GetTerms();
@@ -313,7 +345,7 @@
Assert.IsTrue(freqInt == freq);
}
SortedTermVectorMapper mapper = new SortedTermVectorMapper(new TermVectorEntryFreqSortedComparator());
- knownSearcher.Reader.GetTermFreqVector(hits.Id(1), mapper);
+ knownSearcher.Reader.GetTermFreqVector(hits[1].doc, mapper);
System.Collections.Generic.SortedDictionary<Object,Object> vectorEntrySet = mapper.GetTermVectorEntrySet();
Assert.IsTrue(vectorEntrySet.Count == 10, "mapper.getTermVectorEntrySet() Size: " + vectorEntrySet.Count + " is not: " + 10);
TermVectorEntry last = null;
@@ -331,7 +363,7 @@
}
FieldSortedTermVectorMapper fieldMapper = new FieldSortedTermVectorMapper(new TermVectorEntryFreqSortedComparator());
- knownSearcher.Reader.GetTermFreqVector(hits.Id(1), fieldMapper);
+ knownSearcher.Reader.GetTermFreqVector(hits[1].doc, fieldMapper);
System.Collections.IDictionary map = fieldMapper.GetFieldToTerms();
Assert.IsTrue(map.Count == 2, "map Size: " + map.Count + " is not: " + 2);
vectorEntrySet = (System.Collections.Generic.SortedDictionary<Object,Object>) map["field"];
@@ -348,8 +380,8 @@
private void SetupDoc(Lucene.Net.Documents.Document doc, System.String text)
{
- doc.Add(new Field("field", text, Field.Store.YES, Field.Index.TOKENIZED, Field.TermVector.YES));
- doc.Add(new Field("field2", text, Field.Store.YES, Field.Index.TOKENIZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
+ doc.Add(new Field("field2", text, Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
+ doc.Add(new Field("field", text, Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.YES));
//System.out.println("Document: " + doc);
}
@@ -357,17 +389,17 @@
[Test]
public virtual void TestRareVectors()
{
- IndexWriter writer = new IndexWriter(directory, new SimpleAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(directory, new SimpleAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
for (int i = 0; i < 100; i++)
{
Document doc = new Document();
- doc.Add(new Field("field", English.IntToEnglish(i), Field.Store.YES, Field.Index.TOKENIZED, Field.TermVector.NO));
+ doc.Add(new Field("field", English.IntToEnglish(i), Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.NO));
writer.AddDocument(doc);
}
for (int i = 0; i < 10; i++)
{
Document doc = new Document();
- doc.Add(new Field("field", English.IntToEnglish(100 + i), Field.Store.YES, Field.Index.TOKENIZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
+ doc.Add(new Field("field", English.IntToEnglish(100 + i), Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
writer.AddDocument(doc);
}
@@ -375,39 +407,38 @@
searcher = new IndexSearcher(directory);
Query query = new TermQuery(new Term("field", "hundred"));
- Hits hits = searcher.Search(query);
- Assert.AreEqual(10, hits.Length());
- for (int i = 0; i < hits.Length(); i++)
+ ScoreDoc[] hits = searcher.Search(query, null, 1000).scoreDocs;
+ Assert.AreEqual(10, hits.Length);
+ for (int i = 0; i < hits.Length; i++)
{
- TermFreqVector[] vector = searcher.Reader.GetTermFreqVectors(hits.Id(i));
+ TermFreqVector[] vector = searcher.Reader.GetTermFreqVectors(hits[i].doc);
Assert.IsTrue(vector != null);
Assert.IsTrue(vector.Length == 1);
}
}
-
// In a single doc, for the same field, mix the term
// vectors up
[Test]
- public virtual void TestMixedVectrosVectors()
+ public virtual void TestMixedVectrosVectors() // nice name
{
- IndexWriter writer = new IndexWriter(directory, new SimpleAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(directory, new SimpleAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
Document doc = new Document();
- doc.Add(new Field("field", "one", Field.Store.YES, Field.Index.TOKENIZED, Field.TermVector.NO));
- doc.Add(new Field("field", "one", Field.Store.YES, Field.Index.TOKENIZED, Field.TermVector.YES));
- doc.Add(new Field("field", "one", Field.Store.YES, Field.Index.TOKENIZED, Field.TermVector.WITH_POSITIONS));
- doc.Add(new Field("field", "one", Field.Store.YES, Field.Index.TOKENIZED, Field.TermVector.WITH_OFFSETS));
- doc.Add(new Field("field", "one", Field.Store.YES, Field.Index.TOKENIZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
+ doc.Add(new Field("field", "one", Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.NO));
+ doc.Add(new Field("field", "one", Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.YES));
+ doc.Add(new Field("field", "one", Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS));
+ doc.Add(new Field("field", "one", Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_OFFSETS));
+ doc.Add(new Field("field", "one", Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS));
writer.AddDocument(doc);
writer.Close();
searcher = new IndexSearcher(directory);
Query query = new TermQuery(new Term("field", "one"));
- Hits hits = searcher.Search(query);
- Assert.AreEqual(1, hits.Length());
+ ScoreDoc[] hits = searcher.Search(query, null, 1000).scoreDocs;
+ Assert.AreEqual(1, hits.Length);
- TermFreqVector[] vector = searcher.Reader.GetTermFreqVectors(hits.Id(0));
+ TermFreqVector[] vector = searcher.Reader.GetTermFreqVectors(hits[0].doc);
Assert.IsTrue(vector != null);
Assert.IsTrue(vector.Length == 1);
TermPositionVector tfv = (TermPositionVector) vector[0];
Modified: incubator/lucene.net/trunk/C#/src/Test/Search/TestThreadSafe.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/TestThreadSafe.cs?rev=798995&r1=798994&r2=798995&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/TestThreadSafe.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/TestThreadSafe.cs Wed Jul 29 18:04:12 2009
@@ -159,7 +159,7 @@
internal virtual void BuildDir(Directory dir, int nDocs, int maxFields, int maxFieldLen)
{
- IndexWriter iw = new IndexWriter(dir, new WhitespaceAnalyzer(), true);
+ IndexWriter iw = new IndexWriter(dir, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
iw.SetMaxBufferedDocs(10);
for (int j = 0; j < nDocs; j++)
{
@@ -173,7 +173,7 @@
sb.Append(' ').Append(words[r.Next(words.Length)]);
sb.Append(" $");
Field.Store store = Field.Store.YES; // make random later
- Field.Index index = Field.Index.TOKENIZED; // make random later
+ Field.Index index = Field.Index.ANALYZED; // make random later
d.Add(new Field("f" + i, sb.ToString(), store, index));
}
iw.AddDocument(d);
Modified: incubator/lucene.net/trunk/C#/src/Test/Search/TestWildcard.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Search/TestWildcard.cs?rev=798995&r1=798994&r2=798995&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Search/TestWildcard.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Search/TestWildcard.cs Wed Jul 29 18:04:12 2009
@@ -141,11 +141,11 @@
private RAMDirectory GetIndexStore(System.String field, System.String[] contents)
{
RAMDirectory indexStore = new RAMDirectory();
- IndexWriter writer = new IndexWriter(indexStore, new SimpleAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(indexStore, new SimpleAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
for (int i = 0; i < contents.Length; ++i)
{
Lucene.Net.Documents.Document doc = new Lucene.Net.Documents.Document();
- doc.Add(new Field(field, contents[i], Field.Store.YES, Field.Index.TOKENIZED));
+ doc.Add(new Field(field, contents[i], Field.Store.YES, Field.Index.ANALYZED));
writer.AddDocument(doc);
}
writer.Optimize();
@@ -156,8 +156,8 @@
private void AssertMatches(IndexSearcher searcher, Query q, int expectedMatches)
{
- Hits result = searcher.Search(q);
- Assert.AreEqual(expectedMatches, result.Length());
+ ScoreDoc[] result = searcher.Search(q, null, 1000).scoreDocs;
+ Assert.AreEqual(expectedMatches, result.Length);
}
/// <summary> Test that wild card queries are parsed to the correct type and are searched correctly.
@@ -185,11 +185,11 @@
// prepare the index
RAMDirectory dir = new RAMDirectory();
- IndexWriter iw = new IndexWriter(dir, new WhitespaceAnalyzer());
+ IndexWriter iw = new IndexWriter(dir, new WhitespaceAnalyzer(), IndexWriter.MaxFieldLength.LIMITED);
for (int i = 0; i < docs.Length; i++)
{
Document doc = new Document();
- doc.Add(new Field(field, docs[i], Field.Store.NO, Field.Index.TOKENIZED));
+ doc.Add(new Field(field, docs[i], Field.Store.NO, Field.Index.ANALYZED));
iw.AddDocument(doc);
}
iw.Close();
@@ -205,8 +205,8 @@
{
System.Console.Out.WriteLine("matchAll: qtxt=" + qtxt + " q=" + q + " " + q.GetType().FullName);
}
- Hits hits = searcher.Search(q);
- Assert.AreEqual(docs.Length, hits.Length());
+ ScoreDoc[] hits = searcher.Search(q, null, 1000).scoreDocs;
+ Assert.AreEqual(docs.Length, hits.Length);
}
// test queries that must find none
@@ -218,8 +218,8 @@
{
System.Console.Out.WriteLine("matchNone: qtxt=" + qtxt + " q=" + q + " " + q.GetType().FullName);
}
- Hits hits = searcher.Search(q);
- Assert.AreEqual(0, hits.Length());
+ ScoreDoc[] hits = searcher.Search(q, null, 1000).scoreDocs;
+ Assert.AreEqual(0, hits.Length);
}
// test queries that must be prefix queries and must find only one doc
@@ -234,9 +234,9 @@
System.Console.Out.WriteLine("match 1 prefix: doc=" + docs[i] + " qtxt=" + qtxt + " q=" + q + " " + q.GetType().FullName);
}
Assert.AreEqual(typeof(PrefixQuery), q.GetType());
- Hits hits = searcher.Search(q);
- Assert.AreEqual(1, hits.Length());
- Assert.AreEqual(i, hits.Id(0));
+ ScoreDoc[] hits = searcher.Search(q, null, 1000).scoreDocs;
+ Assert.AreEqual(1, hits.Length);
+ Assert.AreEqual(i, hits[0].doc);
}
}
@@ -252,9 +252,9 @@
System.Console.Out.WriteLine("match 1 wild: doc=" + docs[i] + " qtxt=" + qtxt + " q=" + q + " " + q.GetType().FullName);
}
Assert.AreEqual(typeof(WildcardQuery), q.GetType());
- Hits hits = searcher.Search(q);
- Assert.AreEqual(1, hits.Length());
- Assert.AreEqual(i, hits.Id(0));
+ ScoreDoc[] hits = searcher.Search(q, null, 1000).scoreDocs;
+ Assert.AreEqual(1, hits.Length);
+ Assert.AreEqual(i, hits[0].doc);
}
}
Modified: incubator/lucene.net/trunk/C#/src/Test/SearchTest.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/SearchTest.cs?rev=798995&r1=798994&r2=798995&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/SearchTest.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/SearchTest.cs Wed Jul 29 18:04:12 2009
@@ -22,12 +22,10 @@
using Lucene.Net.Analysis;
using Lucene.Net.Index;
using Lucene.Net.Search;
-using Searchable = Lucene.Net.Search.Searchable;
using Lucene.Net.QueryParsers;
namespace Lucene.Net
{
-
class SearchTest
{
[STAThread]
@@ -37,13 +35,13 @@
{
Directory directory = new RAMDirectory();
Analyzer analyzer = new SimpleAnalyzer();
- IndexWriter writer = new IndexWriter(directory, analyzer, true);
+ IndexWriter writer = new IndexWriter(directory, analyzer, true, IndexWriter.MaxFieldLength.LIMITED);
System.String[] docs = new System.String[]{"a b c d e", "a b c d e a b c d e", "a b c d e f g h i j", "a c e", "e c a", "a c e a c e", "a c e a b c"};
for (int j = 0; j < docs.Length; j++)
{
Lucene.Net.Documents.Document d = new Lucene.Net.Documents.Document();
- d.Add(new Field("contents", docs[j], Field.Store.YES, Field.Index.TOKENIZED));
+ d.Add(new Field("contents", docs[j], Field.Store.YES, Field.Index.ANALYZED));
writer.AddDocument(d);
}
writer.Close();
@@ -51,7 +49,6 @@
Searcher searcher = new IndexSearcher(directory);
System.String[] queries = new System.String[]{"\"a c e\""};
- Hits hits = null;
Lucene.Net.QueryParsers.QueryParser parser = new Lucene.Net.QueryParsers.QueryParser("contents", analyzer);
parser.SetPhraseSlop(4);
@@ -65,13 +62,13 @@
//DateFilter filter = DateFilter.Before("modified", Time(1997,00,01));
//System.out.println(filter);
- hits = searcher.Search(query);
+ ScoreDoc[] hits = searcher.Search(query, null, docs.Length).scoreDocs;
- System.Console.Out.WriteLine(hits.Length() + " total results");
- for (int i = 0; i < hits.Length() && i < 10; i++)
+ System.Console.Out.WriteLine(hits.Length + " total results");
+ for (int i = 0; i < hits.Length && i < 10; i++)
{
- Lucene.Net.Documents.Document d = hits.Doc(i);
- System.Console.Out.WriteLine(i + " " + hits.Score(i) + " " + d.Get("contents"));
+ Lucene.Net.Documents.Document d = searcher.Doc(hits[i].doc);
+ System.Console.Out.WriteLine(i + " " + hits[i].score + " " + d.Get("contents"));
}
}
searcher.Close();
Modified: incubator/lucene.net/trunk/C#/src/Test/SearchTestForDuplicates.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/SearchTestForDuplicates.cs?rev=798995&r1=798994&r2=798995&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/SearchTestForDuplicates.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/SearchTestForDuplicates.cs Wed Jul 29 18:04:12 2009
@@ -17,20 +17,23 @@
using System;
-using Lucene.Net.Store;
-using Lucene.Net.Documents;
-using Lucene.Net.Analysis;
-using Lucene.Net.Index;
-using Lucene.Net.Search;
-using Searchable = Lucene.Net.Search.Searchable;
-using Lucene.Net.QueryParsers;
+using Analyzer = Lucene.Net.Analysis.Analyzer;
+using SimpleAnalyzer = Lucene.Net.Analysis.SimpleAnalyzer;
+using Document = Lucene.Net.Documents.Document;
+using Field = Lucene.Net.Documents.Field;
+using IndexWriter = Lucene.Net.Index.IndexWriter;
+using QueryParser = Lucene.Net.QueryParsers.QueryParser;
+using IndexSearcher = Lucene.Net.Search.IndexSearcher;
+using Query = Lucene.Net.Search.Query;
+using ScoreDoc = Lucene.Net.Search.ScoreDoc;
+using Searcher = Lucene.Net.Search.Searcher;
+using Directory = Lucene.Net.Store.Directory;
+using RAMDirectory = Lucene.Net.Store.RAMDirectory;
namespace Lucene.Net
{
-
class SearchTestForDuplicates
{
-
internal const System.String PRIORITY_FIELD = "priority";
internal const System.String ID_FIELD = "id";
internal const System.String HIGH_PRIORITY = "high";
@@ -44,30 +47,30 @@
{
Directory directory = new RAMDirectory();
Analyzer analyzer = new SimpleAnalyzer();
- IndexWriter writer = new IndexWriter(directory, analyzer, true);
+ IndexWriter writer = new IndexWriter(directory, analyzer, true, IndexWriter.MaxFieldLength.LIMITED);
int MAX_DOCS = 225;
for (int j = 0; j < MAX_DOCS; j++)
{
Lucene.Net.Documents.Document d = new Lucene.Net.Documents.Document();
- d.Add(new Field(PRIORITY_FIELD, HIGH_PRIORITY, Field.Store.YES, Field.Index.TOKENIZED));
- d.Add(new Field(ID_FIELD, System.Convert.ToString(j), Field.Store.YES, Field.Index.TOKENIZED));
+ d.Add(new Field(PRIORITY_FIELD, HIGH_PRIORITY, Field.Store.YES, Field.Index.ANALYZED));
+ d.Add(new Field(ID_FIELD, System.Convert.ToString(j), Field.Store.YES, Field.Index.ANALYZED));
writer.AddDocument(d);
}
writer.Close();
// try a search without OR
Searcher searcher = new IndexSearcher(directory);
- Hits hits = null;
+ ScoreDoc[] hits = null;
Lucene.Net.QueryParsers.QueryParser parser = new Lucene.Net.QueryParsers.QueryParser(PRIORITY_FIELD, analyzer);
Query query = parser.Parse(HIGH_PRIORITY);
System.Console.Out.WriteLine("Query: " + query.ToString(PRIORITY_FIELD));
- hits = searcher.Search(query);
- PrintHits(hits);
+ hits = searcher.Search(query, null, 1000).scoreDocs;
+ PrintHits(hits, searcher);
searcher.Close();
@@ -79,9 +82,9 @@
query = parser.Parse(HIGH_PRIORITY + " OR " + MED_PRIORITY);
System.Console.Out.WriteLine("Query: " + query.ToString(PRIORITY_FIELD));
-
- hits = searcher.Search(query);
- PrintHits(hits);
+
+ hits = searcher.Search(query, null, 1000).scoreDocs;
+ PrintHits(hits, searcher);
searcher.Close();
}
@@ -91,14 +94,14 @@
}
}
- private static void PrintHits(Hits hits)
+ private static void PrintHits(ScoreDoc[] hits, Searcher searcher)
{
- System.Console.Out.WriteLine(hits.Length() + " total results\n");
- for (int i = 0; i < hits.Length(); i++)
+ System.Console.Out.WriteLine(hits.Length + " total results\n");
+ for (int i = 0; i < hits.Length; i++)
{
if (i < 10 || (i > 94 && i < 105))
{
- Lucene.Net.Documents.Document d = hits.Doc(i);
+ Lucene.Net.Documents.Document d = searcher.Doc(hits[i].doc);
System.Console.Out.WriteLine(i + " " + d.Get(ID_FIELD));
}
}
Modified: incubator/lucene.net/trunk/C#/src/Test/Store/MockRAMDirectory.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Store/MockRAMDirectory.cs?rev=798995&r1=798994&r2=798995&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Store/MockRAMDirectory.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Store/MockRAMDirectory.cs Wed Jul 29 18:04:12 2009
@@ -21,7 +21,7 @@
{
/// <summary> This is a subclass of RAMDirectory that adds methods
- /// intented to be used only by unit tests.
+ /// intended to be used only by unit tests.
/// </summary>
/// <version> $Id: RAMDirectory.java 437897 2006-08-29 01:13:10Z yonik $
/// </version>
@@ -36,42 +36,111 @@
internal double randomIOExceptionRate;
internal System.Random randomState;
internal bool noDeleteOpenFile = true;
-
+ internal bool preventDoubleWrite = true;
+ private System.Collections.Generic.IDictionary<string, string> unSyncedFiles;
+ private System.Collections.Generic.IDictionary<string, string> createdFiles;
+ internal volatile bool crashed;
+
// NOTE: we cannot initialize the Map here due to the
// order in which our constructor actually does this
// member initialization vs when it calls super. It seems
// like super is called, then our members are initialized:
internal System.Collections.IDictionary openFiles;
-
+
+ private void Init()
+ {
+ if (openFiles == null)
+ openFiles = new System.Collections.Hashtable();
+ if (createdFiles == null)
+ createdFiles = new System.Collections.Generic.Dictionary<string, string>();
+ if (unSyncedFiles == null)
+ unSyncedFiles = new System.Collections.Generic.Dictionary<string, string>();
+
+ }
+
public MockRAMDirectory() : base()
{
- if (openFiles == null)
- {
- openFiles = new System.Collections.Hashtable();
- }
+ Init();
}
public MockRAMDirectory(System.String dir) : base(dir)
{
- if (openFiles == null)
- {
- openFiles = new System.Collections.Hashtable();
- }
- }
+ Init();
+ }
public MockRAMDirectory(Directory dir) : base(dir)
{
- if (openFiles == null)
- {
- openFiles = new System.Collections.Hashtable();
- }
- }
+ Init();
+ }
public MockRAMDirectory(System.IO.FileInfo dir) : base(dir)
{
- if (openFiles == null)
- {
- openFiles = new System.Collections.Hashtable();
- }
- }
-
+ Init();
+ }
+
+ /// <summary>
+ /// If set to true, we throw an IOException if the same file is opened by createOutput, ever.
+ /// </summary>
+ /// <param name="value"></param>
+ public void SetPreventDoubleWrite(bool value)
+ {
+ preventDoubleWrite = value;
+ }
+
+ override public void Sync(string name)
+ {
+ lock (this)
+ {
+ MaybeThrowDeterministicException();
+ if (crashed)
+ throw new System.IO.IOException("cannot sync after crash");
+ if (unSyncedFiles.ContainsKey(name))
+ unSyncedFiles.Remove(name);
+ }
+ }
+
+ /// <summary>
+ /// Simulates a crash of OS or machine by overwriting unsynced files.
+ /// </summary>
+ public void Crash()
+ {
+ lock (this)
+ {
+ crashed = true;
+ openFiles = new System.Collections.Hashtable();
+ }
+ System.Collections.Generic.IEnumerator<string> it = unSyncedFiles.Keys.GetEnumerator();
+ unSyncedFiles = new System.Collections.Generic.Dictionary<string, string>();
+ int count = 0;
+ while (it.MoveNext())
+ {
+ string name = it.Current;
+ RAMFile file = (RAMFile)fileMap_ForNUnitTest[name];
+ if (count % 3 == 0)
+ {
+ DeleteFile(name, true);
+ }
+ else if (count % 3 == 1)
+ {
+ // Zero out file entirely
+ int numBuffers = file.NumBuffers_ForNUnitTest();
+ for (int i = 0; i < numBuffers; i++)
+ {
+ byte[] buffer = file.GetBuffer_ForNUnitTest(i);
+ SupportClass.CollectionsSupport.ArrayFill(buffer, (byte)0);
+ }
+ }
+ else if (count % 3 == 2)
+ {
+ // truncate the file:
+ file.SetLength_ForNUnitTest(file.GetLength_ForNUnitTest() / 2);
+ }
+ count++;
+ }
+ }
+
+ public void ClearCrash()
+ {
+ lock (this) { crashed = false; }
+ }
+
public virtual void SetMaxSizeInBytes(long maxSize)
{
this.maxSize = maxSize;
@@ -137,32 +206,56 @@
{
lock (this)
{
- lock (openFiles.SyncRoot)
- {
- if (noDeleteOpenFile && openFiles.Contains(name))
- {
- throw new System.IO.IOException("MockRAMDirectory: file \"" + name + "\" is still open: cannot delete");
- }
- }
+ DeleteFile(name, false);
+ }
+ }
+
+ private void DeleteFile(string name, bool forced)
+ {
+ lock (this)
+ {
+ MaybeThrowDeterministicException();
+
+ if (crashed && !forced)
+ throw new System.IO.IOException("cannot delete after crash");
+
+ if (unSyncedFiles.ContainsKey(name))
+ unSyncedFiles.Remove(name);
+
+ if (!forced)
+ {
+ lock (openFiles.SyncRoot)
+ {
+ if (noDeleteOpenFile && openFiles.Contains(name))
+ {
+ throw new System.IO.IOException("MockRAMDirectory: file \"" + name + "\" is still open: cannot delete");
+ }
+ }
+ }
base.DeleteFile(name);
}
}
public override IndexOutput CreateOutput(System.String name)
{
- if (openFiles == null)
- {
- openFiles = new System.Collections.Hashtable();
- }
- lock (openFiles.SyncRoot)
- {
- if (noDeleteOpenFile && openFiles.Contains(name))
- throw new System.IO.IOException("MockRAMDirectory: file \"" + name + "\" is still open: cannot overwrite");
- }
+ if (crashed)
+ throw new System.IO.IOException("cannot create output after crash");
+ Init();
+ lock (openFiles.SyncRoot)
+ {
+ if (preventDoubleWrite && createdFiles.ContainsKey(name) && !name.Equals("segments.gen"))
+ throw new System.IO.IOException("file \"" + name + "\" is still open: cannot overwrite");
+ if (noDeleteOpenFile && openFiles.Contains(name))
+ throw new System.IO.IOException("MockRAMDirectory: file \"" + name + "\" is still open: cannot overwrite");
+ }
RAMFile file = new RAMFile(this);
lock (this)
{
- RAMFile existing = (RAMFile) fileMap_ForNUnitTest[name];
+ if (crashed)
+ throw new System.IO.IOException("cannot create output after crash");
+ unSyncedFiles[name] = name;
+ createdFiles[name] = name;
+ RAMFile existing = (RAMFile)fileMap_ForNUnitTest[name];
// Enforce write once:
if (existing != null && !name.Equals("segments.gen"))
throw new System.IO.IOException("file " + name + " already exists");
Modified: incubator/lucene.net/trunk/C#/src/Test/Store/MockRAMInputStream.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Store/MockRAMInputStream.cs?rev=798995&r1=798994&r2=798995&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Store/MockRAMInputStream.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Store/MockRAMInputStream.cs Wed Jul 29 18:04:12 2009
@@ -48,16 +48,20 @@
{
lock (dir.openFiles.SyncRoot)
{
- System.Int32 v = (System.Int32) dir.openFiles[name];
- if (v == 1)
- {
- dir.openFiles.Remove(name);
- }
- else
- {
- v = (System.Int32) (v - 1);
- dir.openFiles[name] = v;
- }
+ // could be null when MockRAMDIrectory.Crash() was called
+ if (dir.openFiles[name] != null)
+ {
+ System.Int32 v = (System.Int32)dir.openFiles[name];
+ if (v == 1)
+ {
+ dir.openFiles.Remove(name);
+ }
+ else
+ {
+ v = (System.Int32)(v - 1);
+ dir.openFiles[name] = v;
+ }
+ }
}
}
}
Modified: incubator/lucene.net/trunk/C#/src/Test/Store/MockRAMOutputStream.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Store/MockRAMOutputStream.cs?rev=798995&r1=798994&r2=798995&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Store/MockRAMOutputStream.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Store/MockRAMOutputStream.cs Wed Jul 29 18:04:12 2009
@@ -69,6 +69,11 @@
long freeSpace = dir.maxSize - dir.SizeInBytes();
long realUsage = 0;
+
+ // If MockRAMDirectory crashed since we were opened, then don't write anything
+ if (dir.crashed)
+ throw new System.IO.IOException("MockRAMDirectory was crashed");
+
// Enforce disk full:
if (dir.maxSize != 0 && freeSpace <= len)
{
Modified: incubator/lucene.net/trunk/C#/src/Test/Store/TestBufferedIndexInput.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Store/TestBufferedIndexInput.cs?rev=798995&r1=798994&r2=798995&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Store/TestBufferedIndexInput.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Store/TestBufferedIndexInput.cs Wed Jul 29 18:04:12 2009
@@ -19,14 +19,14 @@
using NUnit.Framework;
+using WhitespaceAnalyzer = Lucene.Net.Analysis.WhitespaceAnalyzer;
using Document = Lucene.Net.Documents.Document;
using Field = Lucene.Net.Documents.Field;
using IndexReader = Lucene.Net.Index.IndexReader;
using IndexWriter = Lucene.Net.Index.IndexWriter;
using Term = Lucene.Net.Index.Term;
-using WhitespaceAnalyzer = Lucene.Net.Analysis.WhitespaceAnalyzer;
-using Hits = Lucene.Net.Search.Hits;
using IndexSearcher = Lucene.Net.Search.IndexSearcher;
+using ScoreDoc = Lucene.Net.Search.ScoreDoc;
using TermQuery = Lucene.Net.Search.TermQuery;
using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
using _TestUtil = Lucene.Net.Util._TestUtil;
@@ -190,13 +190,13 @@
MockFSDirectory dir = new MockFSDirectory(indexDir);
try
{
- IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
writer.SetUseCompoundFile(false);
for (int i = 0; i < 37; i++)
{
Document doc = new Document();
- doc.Add(new Field("content", "aaa bbb ccc ddd" + i, Field.Store.YES, Field.Index.TOKENIZED));
- doc.Add(new Field("id", "" + i, Field.Store.YES, Field.Index.TOKENIZED));
+ doc.Add(new Field("content", "aaa bbb ccc ddd" + i, Field.Store.YES, Field.Index.ANALYZED));
+ doc.Add(new Field("id", "" + i, Field.Store.YES, Field.Index.ANALYZED));
writer.AddDocument(doc);
}
writer.Close();
@@ -207,25 +207,25 @@
Term aaa = new Term("content", "aaa");
Term bbb = new Term("content", "bbb");
Term ccc = new Term("content", "ccc");
- Assert.AreEqual(reader.DocFreq(ccc), 37);
+ Assert.AreEqual(37, reader.DocFreq(ccc));
reader.DeleteDocument(0);
- Assert.AreEqual(reader.DocFreq(aaa), 37);
+ Assert.AreEqual(37, reader.DocFreq(aaa));
dir.TweakBufferSizes();
reader.DeleteDocument(4);
Assert.AreEqual(reader.DocFreq(bbb), 37);
dir.TweakBufferSizes();
IndexSearcher searcher = new IndexSearcher(reader);
- Hits hits = searcher.Search(new TermQuery(bbb));
+ ScoreDoc[] hits = searcher.Search(new TermQuery(bbb), null, 1000).scoreDocs;
dir.TweakBufferSizes();
- Assert.AreEqual(35, hits.Length());
+ Assert.AreEqual(35, hits.Length);
dir.TweakBufferSizes();
- hits = searcher.Search(new TermQuery(new Term("id", "33")));
+ hits = searcher.Search(new TermQuery(new Term("id", "33")), null, 1000).scoreDocs;
dir.TweakBufferSizes();
- Assert.AreEqual(1, hits.Length());
- hits = searcher.Search(new TermQuery(aaa));
+ Assert.AreEqual(1, hits.Length);
+ hits = searcher.Search(new TermQuery(aaa), null, 1000).scoreDocs;
dir.TweakBufferSizes();
- Assert.AreEqual(35, hits.Length());
+ Assert.AreEqual(35, hits.Length);
searcher.Close();
reader.Close();
}
@@ -239,8 +239,8 @@
{
internal System.Collections.IList allIndexInputs = new System.Collections.ArrayList();
-
- internal System.Random rand = new System.Random();
+
+ internal System.Random rand = new System.Random(788);
private Directory dir;
@@ -258,13 +258,13 @@
public virtual void TweakBufferSizes()
{
System.Collections.IEnumerator it = allIndexInputs.GetEnumerator();
- int count = 0;
+ //int count = 0;
while (it.MoveNext())
{
BufferedIndexInput bii = (BufferedIndexInput) it.Current;
int bufferSize = 1024 + (int) System.Math.Abs(rand.Next() % 32768);
bii.SetBufferSize(bufferSize);
- count++;
+ //count++;
}
//System.out.println("tweak'd " + count + " buffer sizes");
}
Added: incubator/lucene.net/trunk/C#/src/Test/Store/TestDirectory.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Store/TestDirectory.cs?rev=798995&view=auto
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Store/TestDirectory.cs (added)
+++ incubator/lucene.net/trunk/C#/src/Test/Store/TestDirectory.cs Wed Jul 29 18:04:12 2009
@@ -0,0 +1,53 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using NUnit.Framework;
+
+using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
+
+namespace Lucene.Net.Store
+{
+ [TestFixture]
+ public class TestDirectory : LuceneTestCase
+ {
+ [Test]
+ public void TestDetectClose()
+ {
+ Directory dir = new RAMDirectory();
+ dir.Close();
+ try
+ {
+ dir.CreateOutput("test");
+ Assert.Fail("did not hit expected exception");
+ }
+ catch (AlreadyClosedException)
+ {
+ }
+
+ dir = FSDirectory.GetDirectory(SupportClass.AppSettings.Get("tempDir", ""));
+ dir.Close();
+ try
+ {
+ dir.CreateOutput("test");
+ Assert.Fail("did not hit expected exception");
+ }
+ catch (AlreadyClosedException)
+ {
+ }
+ }
+ }
+}
Modified: incubator/lucene.net/trunk/C#/src/Test/Store/TestHugeRamFile.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Store/TestHugeRamFile.cs?rev=798995&r1=798994&r2=798995&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Store/TestHugeRamFile.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Store/TestHugeRamFile.cs Wed Jul 29 18:04:12 2009
@@ -28,9 +28,10 @@
[TestFixture]
public class TestHugeRamFile : LuceneTestCase
{
+
+ //private static readonly long MAX_VALUE = (long)2 * (long)System.Int32.MaxValue; // around 4 GB of memory
+ private static readonly long MAX_VALUE = (long)System.Int32.MaxValue >> 1; // around 1 GB of mem
- //private static readonly long MAX_VALUE = (long) 2 * (long) System.Int32.MaxValue;
- private static readonly long MAX_VALUE = (long) 2 * (long) System.Int32.MaxValue/4; //{DIGY}Since everyone uses this setting to pass the test.
/// <summary>Fake a huge ram file by using the same byte buffer for all
/// buffers under maxint.
/// </summary>
Modified: incubator/lucene.net/trunk/C#/src/Test/Store/TestLockFactory.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Store/TestLockFactory.cs?rev=798995&r1=798994&r2=798995&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Store/TestLockFactory.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Store/TestLockFactory.cs Wed Jul 29 18:04:12 2009
@@ -19,15 +19,14 @@
using NUnit.Framework;
+using WhitespaceAnalyzer = Lucene.Net.Analysis.WhitespaceAnalyzer;
using Document = Lucene.Net.Documents.Document;
using Field = Lucene.Net.Documents.Field;
-using IndexReader = Lucene.Net.Index.IndexReader;
using IndexWriter = Lucene.Net.Index.IndexWriter;
using Term = Lucene.Net.Index.Term;
-using WhitespaceAnalyzer = Lucene.Net.Analysis.WhitespaceAnalyzer;
-using Hits = Lucene.Net.Search.Hits;
using IndexSearcher = Lucene.Net.Search.IndexSearcher;
using Query = Lucene.Net.Search.Query;
+using ScoreDoc = Lucene.Net.Search.ScoreDoc;
using TermQuery = Lucene.Net.Search.TermQuery;
using LuceneTestCase = Lucene.Net.Util.LuceneTestCase;
@@ -50,7 +49,7 @@
// Lock prefix should have been set:
Assert.IsTrue(lf.lockPrefixSet, "lock prefix was not set by the RAMDirectory");
- IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
// add 100 documents (so that commit lock is used)
for (int i = 0; i < 100; i++)
@@ -83,14 +82,14 @@
Assert.IsTrue(typeof(NoLockFactory).IsInstanceOfType(dir.GetLockFactory()), "RAMDirectory.setLockFactory did not take");
- IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
// Create a 2nd IndexWriter. This is normally not allowed but it should run through since we're not
// using any locks:
IndexWriter writer2 = null;
try
{
- writer2 = new IndexWriter(dir, new WhitespaceAnalyzer(), false);
+ writer2 = new IndexWriter(dir, new WhitespaceAnalyzer(), false, IndexWriter.MaxFieldLength.LIMITED);
}
catch (System.Exception e)
{
@@ -114,13 +113,13 @@
Assert.IsTrue(typeof(SingleInstanceLockFactory).IsInstanceOfType(dir.GetLockFactory()), "RAMDirectory did not use correct LockFactory: got " + dir.GetLockFactory());
- IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
// Create a 2nd IndexWriter. This should fail:
IndexWriter writer2 = null;
try
{
- writer2 = new IndexWriter(dir, new WhitespaceAnalyzer(), false);
+ writer2 = new IndexWriter(dir, new WhitespaceAnalyzer(), false, IndexWriter.MaxFieldLength.LIMITED);
Assert.Fail("Should have hit an IOException with two IndexWriters on default SingleInstanceLockFactory");
}
catch (System.IO.IOException)
@@ -141,7 +140,7 @@
{
System.String indexDirName = "index.TestLockFactory1";
- IndexWriter writer = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
Assert.IsTrue(typeof(SimpleFSLockFactory).IsInstanceOfType(writer.GetDirectory().GetLockFactory()) || typeof(NativeFSLockFactory).IsInstanceOfType(writer.GetDirectory().GetLockFactory()), "FSDirectory did not use correct LockFactory: got " + writer.GetDirectory().GetLockFactory());
@@ -150,7 +149,7 @@
// Create a 2nd IndexWriter. This should fail:
try
{
- writer2 = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), false);
+ writer2 = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), false, IndexWriter.MaxFieldLength.LIMITED);
Assert.Fail("Should have hit an IOException with two IndexWriters on default SimpleFSLockFactory");
}
catch (System.IO.IOException)
@@ -173,7 +172,7 @@
{
System.String indexDirName = "index.TestLockFactory2";
- IndexWriter writer = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
Assert.IsTrue(typeof(SimpleFSLockFactory).IsInstanceOfType(writer.GetDirectory().GetLockFactory()) || typeof(NativeFSLockFactory).IsInstanceOfType(writer.GetDirectory().GetLockFactory()), "FSDirectory did not use correct LockFactory: got " + writer.GetDirectory().GetLockFactory());
@@ -195,7 +194,7 @@
IndexWriter writer2 = null;
try
{
- writer2 = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true);
+ writer2 = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
}
catch (System.IO.IOException e)
{
@@ -237,25 +236,25 @@
// NoLockFactory:
SupportClass.AppSettings.Set(prpName, "Lucene.Net.Store.NoLockFactory");
- IndexWriter writer = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
Assert.IsTrue(typeof(NoLockFactory).IsInstanceOfType(writer.GetDirectory().GetLockFactory()), "FSDirectory did not use correct LockFactory: got " + writer.GetDirectory().GetLockFactory());
writer.Close();
// SingleInstanceLockFactory:
SupportClass.AppSettings.Set(prpName, "Lucene.Net.Store.SingleInstanceLockFactory");
- writer = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true);
+ writer = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
Assert.IsTrue(typeof(SingleInstanceLockFactory).IsInstanceOfType(writer.GetDirectory().GetLockFactory()), "FSDirectory did not use correct LockFactory: got " + writer.GetDirectory().GetLockFactory());
writer.Close();
// NativeFSLockFactory:
SupportClass.AppSettings.Set(prpName, "Lucene.Net.Store.NativeFSLockFactory");
- writer = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true);
+ writer = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
Assert.IsTrue(typeof(NativeFSLockFactory).IsInstanceOfType(writer.GetDirectory().GetLockFactory()), "FSDirectory did not use correct LockFactory: got " + writer.GetDirectory().GetLockFactory());
writer.Close();
// SimpleFSLockFactory:
SupportClass.AppSettings.Set(prpName, "Lucene.Net.Store.SimpleFSLockFactory");
- writer = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true);
+ writer = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
Assert.IsTrue(typeof(SimpleFSLockFactory).IsInstanceOfType(writer.GetDirectory().GetLockFactory()), "FSDirectory did not use correct LockFactory: got " + writer.GetDirectory().GetLockFactory());
writer.Close();
}
@@ -278,7 +277,7 @@
Assert.IsTrue(!FSDirectory.GetDisableLocks(), "Locks are already disabled");
FSDirectory.SetDisableLocks(true);
- IndexWriter writer = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true);
+ IndexWriter writer = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
Assert.IsTrue(typeof(NoLockFactory).IsInstanceOfType(writer.GetDirectory().GetLockFactory()), "FSDirectory did not use correct default LockFactory: got " + writer.GetDirectory().GetLockFactory());
@@ -286,7 +285,7 @@
IndexWriter writer2 = null;
try
{
- writer2 = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), false);
+ writer2 = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), false, IndexWriter.MaxFieldLength.LIMITED);
}
catch (System.IO.IOException e)
{
@@ -487,7 +486,7 @@
{
try
{
- writer = new IndexWriter(dir, analyzer, false);
+ writer = new IndexWriter(dir, analyzer, false, IndexWriter.MaxFieldLength.LIMITED);
}
catch (System.IO.IOException e)
{
@@ -586,10 +585,10 @@
}
if (searcher != null)
{
- Hits hits = null;
+ ScoreDoc[] hits = null;
try
{
- hits = searcher.Search(query);
+ hits = searcher.Search(query, null, 1000).scoreDocs;
}
catch (System.IO.IOException e)
{
@@ -701,7 +700,7 @@
private void AddDoc(IndexWriter writer)
{
Document doc = new Document();
- doc.Add(new Field("content", "aaa", Field.Store.NO, Field.Index.TOKENIZED));
+ doc.Add(new Field("content", "aaa", Field.Store.NO, Field.Index.ANALYZED));
writer.AddDocument(doc);
}
Modified: incubator/lucene.net/trunk/C#/src/Test/Store/TestWindowsMMap.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Store/TestWindowsMMap.cs?rev=798995&r1=798994&r2=798995&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Store/TestWindowsMMap.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Store/TestWindowsMMap.cs Wed Jul 29 18:04:12 2009
@@ -80,14 +80,14 @@
// interior filters.
StandardAnalyzer analyzer = new StandardAnalyzer(new System.Collections.Hashtable());
// TODO: something about lock timeouts and leftover locks.
- IndexWriter writer = new IndexWriter(storeDirectory, analyzer, true);
+ IndexWriter writer = new IndexWriter(storeDirectory, analyzer, true, IndexWriter.MaxFieldLength.LIMITED);
IndexSearcher searcher = new IndexSearcher(storePathname);
for (int dx = 0; dx < 1000; dx++)
{
System.String f = RandomField();
Document doc = new Document();
- doc.Add(new Field("data", f, Field.Store.YES, Field.Index.TOKENIZED));
+ doc.Add(new Field("data", f, Field.Store.YES, Field.Index.ANALYZED));
writer.AddDocument(doc);
}
Modified: incubator/lucene.net/trunk/C#/src/Test/Test-VS2005.csproj
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Test-VS2005.csproj?rev=798995&r1=798994&r2=798995&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Test-VS2005.csproj (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Test-VS2005.csproj Wed Jul 29 18:04:12 2009
@@ -82,16 +82,8 @@
<Name>Lucene.Net</Name>
<HintPath>..\Lucene.Net\bin\Debug\Lucene.Net.dll</HintPath>
</Reference>
- <Reference Include="nunit.core">
- <Name>nunit.core</Name>
- <HintPath>..\..\..\NUnit\bin\nunit.core.dll</HintPath>
- <AssemblyFolderKey>hklm\dn\nunit.framework</AssemblyFolderKey>
- </Reference>
- <Reference Include="nunit.framework">
- <Name>nunit.framework</Name>
- <HintPath>..\..\..\NUnit\bin\nunit.framework.dll</HintPath>
- <AssemblyFolderKey>hklm\dn\nunit.framework</AssemblyFolderKey>
- </Reference>
+ <Reference Include="nunit.core, Version=2.4.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL" />
+ <Reference Include="nunit.framework, Version=2.4.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL" />
<Reference Include="System">
<Name>System</Name>
</Reference>
@@ -155,8 +147,6 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="Index\MockInputStream.cs" />
- <Compile Include="Index\Store\FSDirectoryTestCase.cs" />
- <Compile Include="Index\Store\TestFSDirectory.cs" />
<Compile Include="Index\Store\TestRAMDirectory.cs">
<SubType>Code</SubType>
</Compile>
@@ -168,11 +158,14 @@
<Compile Include="Index\TestBackwardsCompatibility.cs">
<SubType>Code</SubType>
</Compile>
+ <Compile Include="Index\TestByteSlices.cs" />
<Compile Include="Index\TestCheckIndex.cs" />
+ <Compile Include="Index\TestCloseableThreadLocal.cs" />
<Compile Include="Index\TestCompoundFile.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Index\TestConcurrentMergeScheduler.cs" />
+ <Compile Include="Index\TestCrash.cs" />
<Compile Include="Index\TestDeletionPolicy.cs" />
<Compile Include="Index\TestDoc.cs">
<SubType>Code</SubType>
@@ -208,6 +201,7 @@
<Compile Include="Index\TestIndexWriterDelete.cs">
<SubType>Code</SubType>
</Compile>
+ <Compile Include="Index\TestIndexWriterExceptions.cs" />
<Compile Include="Index\TestIndexWriterLockRelease.cs">
<SubType>Code</SubType>
</Compile>
@@ -232,6 +226,7 @@
<Compile Include="Index\TestNorms.cs">
<SubType>Code</SubType>
</Compile>
+ <Compile Include="Index\TestOmitTf.cs" />
<Compile Include="Index\TestParallelReader.cs">
<SubType>Code</SubType>
</Compile>
@@ -267,6 +262,7 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="Index\TestThreadedOptimize.cs" />
+ <Compile Include="Index\TestTransactions.cs" />
<Compile Include="Index\TestWordlistLoader.cs">
<SubType>Code</SubType>
</Compile>
@@ -293,6 +289,7 @@
<Compile Include="Search\Function\TestFieldScoreQuery.cs" />
<Compile Include="Search\Function\TestOrdValues.cs" />
<Compile Include="Search\MockFilter.cs" />
+ <Compile Include="Search\Payloads\PayloadHelper.cs" />
<Compile Include="Search\Payloads\TestBoostingTermQuery.cs" />
<Compile Include="Search\QueryUtils.cs" />
<Compile Include="Search\RemoteCachingWrapperFilterHelper.cs" />
@@ -304,6 +301,7 @@
<Compile Include="Search\Spans\TestNearSpansOrdered.cs">
<SubType>Code</SubType>
</Compile>
+ <Compile Include="Search\Spans\TestPayloadSpans.cs" />
<Compile Include="Search\Spans\TestSpanExplanations.cs">
<SubType>Code</SubType>
</Compile>
@@ -337,6 +335,7 @@
<Compile Include="Search\TestExplanations.cs" />
<Compile Include="Search\TestExtendedFieldCache.cs" />
<Compile Include="Search\TestFilteredQuery.cs" />
+ <Compile Include="Search\TestFilteredSearch.cs" />
<Compile Include="Search\TestFuzzyQuery.cs" />
<Compile Include="Search\TestMatchAllDocsQuery.cs" />
<Compile Include="Search\TestMultiPhraseQuery.cs" />
@@ -361,6 +360,7 @@
<Compile Include="Search\TestSimilarity.cs" />
<Compile Include="Search\TestSimpleExplanations.cs" />
<Compile Include="Search\TestSimpleExplanationsOfNonMatches.cs" />
+ <Compile Include="Search\TestSloppyPhraseQuery.cs" />
<Compile Include="Search\TestSort.cs" />
<Compile Include="Search\TestSpanQueryFilter.cs" />
<Compile Include="Search\TestTermScorer.cs" />
@@ -380,6 +380,7 @@
<Compile Include="Store\TestBufferedIndexInput.cs">
<SubType>Code</SubType>
</Compile>
+ <Compile Include="Store\TestDirectory.cs" />
<Compile Include="Store\TestHugeRamFile.cs" />
<Compile Include="Store\TestLock.cs">
<SubType>Code</SubType>
@@ -400,6 +401,7 @@
<Compile Include="TestHitIterator.cs">
<SubType>Code</SubType>
</Compile>
+ <Compile Include="TestMergeSchedulerExternal.cs" />
<Compile Include="TestSearch.cs">
<SubType>Code</SubType>
</Compile>
@@ -410,6 +412,7 @@
<Compile Include="ThreadSafetyTest.cs">
<SubType>Code</SubType>
</Compile>
+ <Compile Include="Util\Cache\TestSimpleLRUCache.cs" />
<Compile Include="Util\English.cs">
<SubType>Code</SubType>
</Compile>
@@ -418,12 +421,14 @@
<Compile Include="Util\TestBitVector.cs">
<SubType>Code</SubType>
</Compile>
+ <Compile Include="Util\TestOpenBitSet.cs" />
<Compile Include="Util\TestPriorityQueue.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Util\TestSmallFloat.cs">
<SubType>Code</SubType>
</Compile>
+ <Compile Include="Util\TestSortedVIntList.cs" />
<Compile Include="Util\TestStringHelper.cs">
<SubType>Code</SubType>
</Compile>
@@ -431,10 +436,16 @@
<SubType>Code</SubType>
</Compile>
<None Include="App.config" />
- <None Include="Index\index.prelockless.cfs.zip" />
- <None Include="Index\index.prelockless.nocfs.zip" />
- <None Include="Index\index.presharedstores.cfs.zip" />
- <None Include="Index\index.presharedstores.nocfs.zip" />
+ <None Include="Index\index.19.cfs.zip" />
+ <None Include="Index\index.19.nocfs.zip" />
+ <None Include="Index\index.20.cfs.zip" />
+ <None Include="Index\index.20.nocfs.zip" />
+ <None Include="Index\index.21.cfs.zip" />
+ <None Include="Index\index.21.nocfs.zip" />
+ <None Include="Index\index.22.cfs.zip" />
+ <None Include="Index\index.22.nocfs.zip" />
+ <None Include="Index\index.23.cfs.zip" />
+ <None Include="Index\index.23.nocfs.zip" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
Modified: incubator/lucene.net/trunk/C#/src/Test/Test.csproj
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Test.csproj?rev=798995&r1=798994&r2=798995&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Test.csproj (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Test.csproj Wed Jul 29 18:04:12 2009
@@ -78,26 +78,15 @@
<Name>DemoLib</Name>
<HintPath>..\Demo\DemoLib\bin\Debug\DemoLib.dll</HintPath>
</Reference>
- <Reference Include="ICSharpCode.SharpZipLib, Version=0.85.4.369, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\..\..\ICSharpCode.SharpZipLib.dll</HintPath>
- </Reference>
<Reference Include="Lucene.Net">
<Name>Lucene.Net</Name>
<HintPath>..\Lucene.Net\bin\Debug\Lucene.Net.dll</HintPath>
</Reference>
- <Reference Include="nunit.core, Version=2.2.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\..\..\..\..\..\..\..\Program Files\Mailframe\TestRunner\nunit.core.dll</HintPath>
- </Reference>
- <Reference Include="nunit.framework, Version=2.2.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\..\..\..\..\..\..\..\Program Files\Mailframe\TestRunner\nunit.framework.dll</HintPath>
- </Reference>
+ <Reference Include="nunit.core, Version=2.4.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL" />
+ <Reference Include="nunit.framework, Version=2.4.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL" />
<Reference Include="System">
<Name>System</Name>
</Reference>
- <Reference Include="System.configuration" />
<Reference Include="System.Data">
<Name>System.Data</Name>
</Reference>
@@ -143,38 +132,40 @@
<Compile Include="AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="Document\TestBinaryDocument.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Document\TestDateTools.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Document\TestDocument.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Document\TestNumberTools.cs">
- <SubType>Code</SubType>
- </Compile>
+ <Compile Include="Document\TestBinaryDocument.cs" />
+ <Compile Include="Document\TestDateTools.cs" />
+ <Compile Include="Document\TestDocument.cs" />
+ <Compile Include="Document\TestNumberTools.cs" />
<Compile Include="IndexTest.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Index\DocHelper.cs">
<SubType>Code</SubType>
</Compile>
+ <Compile Include="Index\DocTest.cs" />
<Compile Include="Index\MockIndexInput.cs">
<SubType>Code</SubType>
</Compile>
+ <Compile Include="Index\MockInputStream.cs" />
<Compile Include="Index\Store\TestRAMDirectory.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="Index\TestAddIndexesNoOptimize.cs" />
+ <Compile Include="Index\TermInfosTest.cs" />
+ <Compile Include="Index\TestAddIndexesNoOptimize.cs">
+ <SubType>Code</SubType>
+ </Compile>
<Compile Include="Index\TestAtomicUpdate.cs" />
- <Compile Include="Index\TestBackwardsCompatibility.cs" />
+ <Compile Include="Index\TestBackwardsCompatibility.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Index\TestByteSlices.cs" />
<Compile Include="Index\TestCheckIndex.cs" />
+ <Compile Include="Index\TestCloseableThreadLocal.cs" />
<Compile Include="Index\TestCompoundFile.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Index\TestConcurrentMergeScheduler.cs" />
+ <Compile Include="Index\TestCrash.cs" />
<Compile Include="Index\TestDeletionPolicy.cs" />
<Compile Include="Index\TestDoc.cs">
<SubType>Code</SubType>
@@ -191,7 +182,9 @@
<Compile Include="Index\TestFilterIndexReader.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="Index\TestIndexFileDeleter.cs" />
+ <Compile Include="Index\TestIndexFileDeleter.cs">
+ <SubType>Code</SubType>
+ </Compile>
<Compile Include="Index\TestIndexInput.cs">
<SubType>Code</SubType>
</Compile>
@@ -205,24 +198,41 @@
<Compile Include="Index\TestIndexWriter.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="Index\TestIndexWriterDelete.cs" />
- <Compile Include="Index\TestIndexWriterLockRelease.cs" />
- <Compile Include="Index\TestIndexWriterMergePolicy.cs" />
+ <Compile Include="Index\TestIndexWriterDelete.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Index\TestIndexWriterExceptions.cs" />
+ <Compile Include="Index\TestIndexWriterLockRelease.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Index\TestIndexWriterMergePolicy.cs">
+ <SubType>Code</SubType>
+ </Compile>
<Compile Include="Index\TestIndexWriterMerging.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="Index\TestLazyBug.cs" />
- <Compile Include="Index\TestLazyProxSkipping.cs" />
+ <Compile Include="Index\TestInputStream.cs" />
+ <Compile Include="Index\TestLazyBug.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Index\TestLazyProxSkipping.cs">
+ <SubType>Code</SubType>
+ </Compile>
<Compile Include="Index\TestMultiLevelSkipList.cs" />
<Compile Include="Index\TestMultiReader.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Index\TestMultiSegmentReader.cs" />
- <Compile Include="Index\TestNorms.cs" />
+ <Compile Include="Index\TestNorms.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Index\TestOmitTf.cs" />
<Compile Include="Index\TestParallelReader.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="Index\TestParallelTermEnum.cs" />
+ <Compile Include="Index\TestParallelTermEnum.cs">
+ <SubType>Code</SubType>
+ </Compile>
<Compile Include="Index\TestPayloads.cs" />
<Compile Include="Index\TestPositionBasedTermVectorMapper.cs" />
<Compile Include="Index\TestSegmentMerger.cs">
@@ -237,14 +247,22 @@
<Compile Include="Index\TestSegmentTermEnum.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="Index\TestStressIndexing.cs" />
+ <Compile Include="Index\TestStressIndexing.cs">
+ <SubType>Code</SubType>
+ </Compile>
<Compile Include="Index\TestStressIndexing2.cs" />
<Compile Include="Index\TestTerm.cs" />
- <Compile Include="Index\TestTermdocPerf.cs" />
+ <Compile Include="Index\TestTermdocPerf.cs">
+ <SubType>Code</SubType>
+ </Compile>
<Compile Include="Index\TestTermVectorsReader.cs">
<SubType>Code</SubType>
</Compile>
+ <Compile Include="Index\TestTermVectorsWriter.cs">
+ <SubType>Code</SubType>
+ </Compile>
<Compile Include="Index\TestThreadedOptimize.cs" />
+ <Compile Include="Index\TestTransactions.cs" />
<Compile Include="Index\TestWordlistLoader.cs">
<SubType>Code</SubType>
</Compile>
@@ -263,37 +281,33 @@
<Compile Include="SearchTestForDuplicates.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="Search\BaseTestRangeFilter.cs">
- <SubType>Code</SubType>
- </Compile>
+ <Compile Include="Search\BaseTestRangeFilter.cs" />
<Compile Include="Search\CachingWrapperFilterHelper.cs" />
- <Compile Include="Search\CheckHits.cs">
- <SubType>Code</SubType>
- </Compile>
+ <Compile Include="Search\CheckHits.cs" />
<Compile Include="Search\Function\FunctionTestSetup.cs" />
<Compile Include="Search\Function\TestCustomScoreQuery.cs" />
<Compile Include="Search\Function\TestFieldScoreQuery.cs" />
<Compile Include="Search\Function\TestOrdValues.cs" />
- <Compile Include="Search\MockFilter.cs">
- <SubType>Code</SubType>
- </Compile>
+ <Compile Include="Search\MockFilter.cs" />
+ <Compile Include="Search\Payloads\PayloadHelper.cs" />
<Compile Include="Search\Payloads\TestBoostingTermQuery.cs" />
- <Compile Include="Search\QueryUtils.cs">
+ <Compile Include="Search\QueryUtils.cs" />
+ <Compile Include="Search\RemoteCachingWrapperFilterHelper.cs" />
+ <Compile Include="Search\SampleComparable.cs" />
+ <Compile Include="Search\SingleDocTestFilter.cs" />
+ <Compile Include="Search\Spans\TestBasics.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="Search\RemoteCachingWrapperFilterHelper.cs" />
- <Compile Include="Search\SampleComparable.cs">
+ <Compile Include="Search\Spans\TestNearSpansOrdered.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="Search\SingleDocTestFilter.cs">
+ <Compile Include="Search\Spans\TestPayloadSpans.cs" />
+ <Compile Include="Search\Spans\TestSpanExplanations.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="Search\Spans\TestBasics.cs">
+ <Compile Include="Search\Spans\TestSpanExplanationsOfNonMatches.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="Search\Spans\TestNearSpansOrdered.cs" />
- <Compile Include="Search\Spans\TestSpanExplanations.cs" />
- <Compile Include="Search\Spans\TestSpanExplanationsOfNonMatches.cs" />
<Compile Include="Search\Spans\TestSpans.cs">
<SubType>Code</SubType>
</Compile>
@@ -303,136 +317,81 @@
<Compile Include="Search\Spans\TestSpansAdvanced2.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="Search\TestBoolean2.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Search\TestBooleanMinShouldMatch.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Search\TestBooleanOr.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Search\TestBooleanPrefixQuery.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Search\TestBooleanQuery.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Search\TestBooleanScorer.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Search\TestCachingWrapperFilter.cs">
- <SubType>Code</SubType>
- </Compile>
+ <Compile Include="Search\TestBoolean2.cs" />
+ <Compile Include="Search\TestBooleanMinShouldMatch.cs" />
+ <Compile Include="Search\TestBooleanOr.cs" />
+ <Compile Include="Search\TestBooleanPrefixQuery.cs" />
+ <Compile Include="Search\TestBooleanQuery.cs" />
+ <Compile Include="Search\TestBooleanScorer.cs" />
+ <Compile Include="Search\TestCachingWrapperFilter.cs" />
<Compile Include="Search\TestComplexExplanations.cs" />
<Compile Include="Search\TestComplexExplanationsOfNonMatches.cs" />
- <Compile Include="Search\TestConstantScoreRangeQuery.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Search\TestCustomSearcherSort.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Search\TestDateFilter.cs">
- <SubType>Code</SubType>
- </Compile>
+ <Compile Include="Search\TestConstantScoreRangeQuery.cs" />
+ <Compile Include="Search\TestCustomSearcherSort.cs" />
+ <Compile Include="Search\TestDateFilter.cs" />
<Compile Include="Search\TestDateSort.cs" />
- <Compile Include="Search\TestDisjunctionMaxQuery.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Search\TestDocBoost.cs">
- <SubType>Code</SubType>
- </Compile>
+ <Compile Include="Search\TestDisjunctionMaxQuery.cs" />
+ <Compile Include="Search\TestDocBoost.cs" />
<Compile Include="Search\TestExplanations.cs" />
<Compile Include="Search\TestExtendedFieldCache.cs" />
- <Compile Include="Search\TestFilteredQuery.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Search\TestFuzzyQuery.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Search\TestMatchAllDocsQuery.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Search\TestMultiPhraseQuery.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Search\TestMultiSearcher.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Search\TestMultiSearcherRanking.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Search\TestMultiThreadTermVectors.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Search\TestNot.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Search\TestParallelMultiSearcher.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Search\TestPhrasePrefixQuery.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Search\TestPhraseQuery.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Search\TestPositionIncrement.cs">
- <SubType>Code</SubType>
- </Compile>
+ <Compile Include="Search\TestFilteredQuery.cs" />
+ <Compile Include="Search\TestFilteredSearch.cs" />
+ <Compile Include="Search\TestFuzzyQuery.cs" />
+ <Compile Include="Search\TestMatchAllDocsQuery.cs" />
+ <Compile Include="Search\TestMultiPhraseQuery.cs" />
+ <Compile Include="Search\TestMultiSearcher.cs" />
+ <Compile Include="Search\TestMultiSearcherRanking.cs" />
+ <Compile Include="Search\TestMultiThreadTermVectors.cs" />
+ <Compile Include="Search\TestNot.cs" />
+ <Compile Include="Search\TestParallelMultiSearcher.cs" />
+ <Compile Include="Search\TestPhrasePrefixQuery.cs" />
+ <Compile Include="Search\TestPhraseQuery.cs" />
+ <Compile Include="Search\TestPositionIncrement.cs" />
<Compile Include="Search\TestPrefixFilter.cs" />
- <Compile Include="Search\TestPrefixQuery.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Search\TestQueryTermVector.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Search\TestRangeFilter.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Search\TestRangeQuery.cs">
- <SubType>Code</SubType>
- </Compile>
+ <Compile Include="Search\TestPrefixQuery.cs" />
+ <Compile Include="Search\TestQueryTermVector.cs" />
+ <Compile Include="Search\TestRangeFilter.cs" />
+ <Compile Include="Search\TestRangeQuery.cs" />
<Compile Include="Search\TestRemoteCachingWrapperFilter.cs" />
- <Compile Include="Search\TestRemoteSearchable.cs">
- <SubType>Code</SubType>
- </Compile>
+ <Compile Include="Search\TestRemoteSearchable.cs" />
<Compile Include="Search\TestScorerPerf.cs" />
<Compile Include="Search\TestSearchHitsWithDeletions.cs" />
- <Compile Include="Search\TestSetNorm.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Search\TestSimilarity.cs">
- <SubType>Code</SubType>
- </Compile>
+ <Compile Include="Search\TestSetNorm.cs" />
+ <Compile Include="Search\TestSimilarity.cs" />
<Compile Include="Search\TestSimpleExplanations.cs" />
<Compile Include="Search\TestSimpleExplanationsOfNonMatches.cs" />
- <Compile Include="Search\TestSort.cs">
- <SubType>Code</SubType>
- </Compile>
+ <Compile Include="Search\TestSloppyPhraseQuery.cs" />
+ <Compile Include="Search\TestSort.cs" />
<Compile Include="Search\TestSpanQueryFilter.cs" />
<Compile Include="Search\TestTermScorer.cs" />
- <Compile Include="Search\TestTermVectors.cs">
- <SubType>Code</SubType>
- </Compile>
+ <Compile Include="Search\TestTermVectors.cs" />
<Compile Include="Search\TestThreadSafe.cs" />
- <Compile Include="Search\TestWildcard.cs">
+ <Compile Include="Search\TestWildcard.cs" />
+ <Compile Include="StoreTest.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="StoreTest.cs">
+ <Compile Include="Store\MockRAMDirectory.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="Store\MockRAMDirectory.cs" />
<Compile Include="Store\MockRAMInputStream.cs" />
- <Compile Include="Store\MockRAMOutputStream.cs" />
- <Compile Include="Store\TestBufferedIndexInput.cs" />
+ <Compile Include="Store\MockRAMOutputStream.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Store\TestBufferedIndexInput.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Store\TestDirectory.cs" />
<Compile Include="Store\TestHugeRamFile.cs" />
<Compile Include="Store\TestLock.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="Store\TestLockFactory.cs" />
+ <Compile Include="Store\TestLockFactory.cs">
+ <SubType>Code</SubType>
+ </Compile>
<Compile Include="Store\TestMMapDirectory.cs" />
- <Compile Include="Store\TestWindowsMMap.cs" />
+ <Compile Include="Store\TestWindowsMMap.cs">
+ <SubType>Code</SubType>
+ </Compile>
<Compile Include="Store\_TestHelper.cs">
<SubType>Code</SubType>
</Compile>
@@ -442,6 +401,7 @@
<Compile Include="TestHitIterator.cs">
<SubType>Code</SubType>
</Compile>
+ <Compile Include="TestMergeSchedulerExternal.cs" />
<Compile Include="TestSearch.cs">
<SubType>Code</SubType>
</Compile>
@@ -449,42 +409,43 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="TestSnapshotDeletionPolicy.cs" />
- <Compile Include="TestWeakHashTable.cs" />
<Compile Include="ThreadSafetyTest.cs">
<SubType>Code</SubType>
</Compile>
+ <Compile Include="Util\Cache\TestSimpleLRUCache.cs" />
<Compile Include="Util\English.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Util\LuceneTestCase.cs" />
+ <Compile Include="Util\StringHelperTest.cs" />
<Compile Include="Util\TestBitVector.cs">
<SubType>Code</SubType>
</Compile>
+ <Compile Include="Util\TestOpenBitSet.cs" />
<Compile Include="Util\TestPriorityQueue.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Util\TestSmallFloat.cs">
<SubType>Code</SubType>
</Compile>
+ <Compile Include="Util\TestSortedVIntList.cs" />
<Compile Include="Util\TestStringHelper.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="Util\_TestUtil.cs" />
- </ItemGroup>
- <ItemGroup>
+ <Compile Include="Util\_TestUtil.cs">
+ <SubType>Code</SubType>
+ </Compile>
<None Include="App.config" />
- <None Include="Index\index.prelockless.cfs.zip">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Index\index.prelockless.nocfs.zip">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Index\index.presharedstores.cfs.zip">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="Index\index.presharedstores.nocfs.zip">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
+ <None Include="Index\index.19.cfs.zip" />
+ <None Include="Index\index.19.nocfs.zip" />
+ <None Include="Index\index.20.cfs.zip" />
+ <None Include="Index\index.20.nocfs.zip" />
+ <None Include="Index\index.21.cfs.zip" />
+ <None Include="Index\index.21.nocfs.zip" />
+ <None Include="Index\index.22.cfs.zip" />
+ <None Include="Index\index.22.nocfs.zip" />
+ <None Include="Index\index.23.cfs.zip" />
+ <None Include="Index\index.23.nocfs.zip" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
Modified: incubator/lucene.net/trunk/C#/src/Test/Test.sln
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Test/Test.sln?rev=798995&r1=798994&r2=798995&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Test/Test.sln (original)
+++ incubator/lucene.net/trunk/C#/src/Test/Test.sln Wed Jul 29 18:04:12 2009
@@ -1,10 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test.csproj", "{AAF68BCF-F781-45FC-98B3-2B9CEE411E01}"
- ProjectSection(WebsiteProperties) = preProject
- Debug.AspNetCompiler.Debug = "True"
- Release.AspNetCompiler.Debug = "False"
- EndProjectSection
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test-VS2005", "Test-VS2005.csproj", "{AAF68BCF-F781-45FC-98B3-2B9CEE411E01}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution