You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ar...@apache.org on 2006/08/17 15:49:32 UTC
svn commit: r432239 [1/8] - in /incubator/lucene.net/trunk/C#/src: ./
Demo/DeleteFiles/ Demo/DemoLib/ Demo/DemoLib/HTML/ Demo/IndexFiles/
Demo/IndexHtml/ Demo/SearchFiles/ Lucene.Net/ Lucene.Net/Analysis/
Lucene.Net/Analysis/Standard/ Lucene.Net/Docume...
Author: aroush
Date: Thu Aug 17 06:49:26 2006
New Revision: 432239
URL: http://svn.apache.org/viewvc?rev=432239&view=rev
Log:
Lucene.Net 2.0 "Alpha"
Added:
incubator/lucene.net/trunk/C#/src/Lucene.Net/Lucene.Net-2.0.0.csproj
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/Regex/_delete_RegexQuery.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/Regex/_delete_RegexTermEnum.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/Regex/_delete_SpanRegexQuery.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/TopDocCollector.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/TopFieldDocCollector.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/_delete_.PhrasePrefixQuery.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/_delete_DateFilter.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/_delete_InputStream.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/_delete_OutputStream.cs
incubator/lucene.net/trunk/C#/src/Test/Index/Store/_delete_TestFSDirectory.cs
incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexWriterMerging.cs
incubator/lucene.net/trunk/C#/src/Test/Search/Regex/_delete_TestRegexQuery.cs
incubator/lucene.net/trunk/C#/src/Test/Search/Regex/_delete_TestSpanRegexQuery.cs
incubator/lucene.net/trunk/C#/src/Test/Search/SingleDocTestFilter.cs
incubator/lucene.net/trunk/C#/src/Test/Store/TestLock.cs
Modified:
incubator/lucene.net/trunk/C#/src/ABOUT.txt
incubator/lucene.net/trunk/C#/src/Demo/DeleteFiles/AssemblyInfo.cs
incubator/lucene.net/trunk/C#/src/Demo/DeleteFiles/DeleteFiles.cs
incubator/lucene.net/trunk/C#/src/Demo/DemoLib/AssemblyInfo.cs
incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTML/HTMLParser.cs
incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTML/SimpleCharStream.cs
incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTMLDocument.cs
incubator/lucene.net/trunk/C#/src/Demo/IndexFiles/AssemblyInfo.cs
incubator/lucene.net/trunk/C#/src/Demo/IndexHtml/AssemblyInfo.cs
incubator/lucene.net/trunk/C#/src/Demo/IndexHtml/IndexHtml.cs
incubator/lucene.net/trunk/C#/src/Demo/SearchFiles/AssemblyInfo.cs
incubator/lucene.net/trunk/C#/src/Demo/SearchFiles/SearchFiles.cs
incubator/lucene.net/trunk/C#/src/HISTORY.txt
incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/Analyzer.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/Standard/CharStream.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/Standard/ParseException.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/StopFilter.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/TokenFilter.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/WordlistLoader.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/AssemblyInfo.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/DateField.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/DateTools.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/Document.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/Field.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/NumberTools.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/DocumentWriter.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/FieldInfo.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/FieldInfos.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/FieldsReader.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/FieldsWriter.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/FilterIndexReader.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/IndexModifier.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/IndexReader.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/IndexWriter.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/MultiReader.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/ParallelReader.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/SegmentMerger.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/SegmentReader.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/Term.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/TermInfosWriter.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Lucene.Net.sln
incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/CharStream.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/MultiFieldQueryParser.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/QueryParser.JJ
incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/QueryParser.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/QueryParser/QueryParserTokenManager.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/BooleanClause.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/BooleanQuery.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/ConstantScoreQuery.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/ConstantScoreRangeQuery.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/DisjunctionMaxQuery.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/DisjunctionSumScorer.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/FieldCacheImpl.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/FieldSortedHitQueue.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/FilteredQuery.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/FilteredTermEnum.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/HitIterator.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/IndexSearcher.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/MatchAllDocsQuery.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/MultiPhraseQuery.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/MultiSearcher.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/MultiTermQuery.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/PrefixQuery.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/Query.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/RangeFilter.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/RangeQuery.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/RemoteSearchable.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/Searchable.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/Spans/SpanFirstQuery.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/Spans/SpanNearQuery.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/Spans/SpanNotQuery.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/Spans/SpanOrQuery.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/Spans/SpanQuery.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/Spans/SpanScorer.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/Spans/SpanTermQuery.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/Spans/SpanWeight.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Search/TopFieldDocs.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/BufferedIndexOutput.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/Directory.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/FSDirectory.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/Lock.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/MMapDirectory.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/RAMDirectory.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/RAMInputStream.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Store/RAMOutputStream.cs
incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/PriorityQueue.cs
incubator/lucene.net/trunk/C#/src/Test/Analysis/TestAnalyzers.cs
incubator/lucene.net/trunk/C#/src/Test/Analysis/TestStopAnalyzer.cs
incubator/lucene.net/trunk/C#/src/Test/AssemblyInfo.cs
incubator/lucene.net/trunk/C#/src/Test/Document/TestBinaryDocument.cs
incubator/lucene.net/trunk/C#/src/Test/Document/TestDateTools.cs
incubator/lucene.net/trunk/C#/src/Test/Document/TestDocument.cs
incubator/lucene.net/trunk/C#/src/Test/Index/DocHelper.cs
incubator/lucene.net/trunk/C#/src/Test/Index/Store/TestRAMDirectory.cs
incubator/lucene.net/trunk/C#/src/Test/Index/TestCompoundFile.cs
incubator/lucene.net/trunk/C#/src/Test/Index/TestDoc.cs
incubator/lucene.net/trunk/C#/src/Test/Index/TestDocumentWriter.cs
incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexModifier.cs
incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexReader.cs
incubator/lucene.net/trunk/C#/src/Test/Index/TestIndexWriter.cs
incubator/lucene.net/trunk/C#/src/Test/Index/TestMultiReader.cs
incubator/lucene.net/trunk/C#/src/Test/Index/TestSegmentReader.cs
incubator/lucene.net/trunk/C#/src/Test/Index/TestSegmentTermDocs.cs
incubator/lucene.net/trunk/C#/src/Test/Index/TestTermVectorsReader.cs
incubator/lucene.net/trunk/C#/src/Test/IndexTest.cs
incubator/lucene.net/trunk/C#/src/Test/QueryParser/TestMultiAnalyzer.cs
incubator/lucene.net/trunk/C#/src/Test/QueryParser/TestMultiFieldQueryParser.cs
incubator/lucene.net/trunk/C#/src/Test/QueryParser/TestQueryParser.cs
incubator/lucene.net/trunk/C#/src/Test/Search/SampleComparable.cs
incubator/lucene.net/trunk/C#/src/Test/Search/Spans/TestBasics.cs
incubator/lucene.net/trunk/C#/src/Test/Search/Spans/TestSpansAdvanced.cs
incubator/lucene.net/trunk/C#/src/Test/Search/Spans/TestSpansAdvanced2.cs
incubator/lucene.net/trunk/C#/src/Test/Search/TestBooleanMinShouldMatch.cs
incubator/lucene.net/trunk/C#/src/Test/Search/TestBooleanOr.cs
incubator/lucene.net/trunk/C#/src/Test/Search/TestConstantScoreRangeQuery.cs
incubator/lucene.net/trunk/C#/src/Test/Search/TestCustomSearcherSort.cs
incubator/lucene.net/trunk/C#/src/Test/Search/TestDateFilter.cs
incubator/lucene.net/trunk/C#/src/Test/Search/TestDisjunctionMaxQuery.cs
incubator/lucene.net/trunk/C#/src/Test/Search/TestMatchAllDocsQuery.cs
incubator/lucene.net/trunk/C#/src/Test/Search/TestMultiSearcher.cs
incubator/lucene.net/trunk/C#/src/Test/Search/TestMultiSearcherRanking.cs
incubator/lucene.net/trunk/C#/src/Test/Search/TestNot.cs
incubator/lucene.net/trunk/C#/src/Test/Search/TestPhrasePrefixQuery.cs
incubator/lucene.net/trunk/C#/src/Test/Search/TestPhraseQuery.cs
incubator/lucene.net/trunk/C#/src/Test/Search/TestRemoteSearchable.cs
incubator/lucene.net/trunk/C#/src/Test/Search/TestSort.cs
incubator/lucene.net/trunk/C#/src/Test/Test.csproj
incubator/lucene.net/trunk/C#/src/Test/TestDemo.cs
incubator/lucene.net/trunk/C#/src/Test/ThreadSafetyTest.cs
Modified: incubator/lucene.net/trunk/C#/src/ABOUT.txt
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/ABOUT.txt?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/ABOUT.txt (original)
+++ incubator/lucene.net/trunk/C#/src/ABOUT.txt Thu Aug 17 06:49:26 2006
@@ -1 +1 @@
-Lucene.Net is a port of Jakarta Lucene to C#. The port from Java to C# of version 1.4.0, 1.4.3 and 1.9 are done primary by George Aroush. To contact George Aroush please visit http://www.aroush.net/
+Lucene.Net is a port of Jakarta Lucene to C#. The port from Java to C# of version 1.4.0, 1.4.3, 1.9, 1.9.1 and 2.0 are done primary by George Aroush. To contact George Aroush please visit http://www.aroush.net/
Modified: incubator/lucene.net/trunk/C#/src/Demo/DeleteFiles/AssemblyInfo.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Demo/DeleteFiles/AssemblyInfo.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Demo/DeleteFiles/AssemblyInfo.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Demo/DeleteFiles/AssemblyInfo.cs Thu Aug 17 06:49:26 2006
@@ -26,7 +26,7 @@
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.9.1.001")]
+[assembly: AssemblyVersion("2.0.0.001")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
Modified: incubator/lucene.net/trunk/C#/src/Demo/DeleteFiles/DeleteFiles.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Demo/DeleteFiles/DeleteFiles.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Demo/DeleteFiles/DeleteFiles.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Demo/DeleteFiles/DeleteFiles.cs Thu Aug 17 06:49:26 2006
@@ -25,14 +25,15 @@
//import Lucene.Net.index.Term;
/// <summary>Deletes documents from an index that do not contain a term. </summary>
- class DeleteFiles
+ public class DeleteFiles
{
private DeleteFiles()
{
} // singleton
- [STAThread]
+ /// <summary>Deletes documents from an index that do not contain a term. </summary>
+ [STAThread]
public static void Main(System.String[] args)
{
System.String usage = typeof(DeleteFiles) + " <unique_term>";
@@ -47,7 +48,7 @@
IndexReader reader = IndexReader.Open(directory);
Term term = new Term("path", args[0]);
- int deleted = reader.Delete(term);
+ int deleted = reader.DeleteDocuments(term);
System.Console.Out.WriteLine("deleted " + deleted + " documents containing " + term);
Modified: incubator/lucene.net/trunk/C#/src/Demo/DemoLib/AssemblyInfo.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Demo/DemoLib/AssemblyInfo.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Demo/DemoLib/AssemblyInfo.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Demo/DemoLib/AssemblyInfo.cs Thu Aug 17 06:49:26 2006
@@ -26,7 +26,7 @@
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.9.1.001")]
+[assembly: AssemblyVersion("2.0.0.001")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
Modified: incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTML/HTMLParser.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Demo/DemoLib/HTML/HTMLParser.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTML/HTMLParser.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTML/HTMLParser.cs Thu Aug 17 06:49:26 2006
@@ -81,13 +81,6 @@
}
}
- /// <deprecated> Use HTMLParser(FileInputStream) instead
- /// </deprecated>
- public HTMLParser(System.IO.FileInfo file) :
- this(new System.IO.FileStream(file.FullName, System.IO.FileMode.Open, System.IO.FileAccess.Read))
- {
- }
-
public virtual System.String GetTitle()
{
if (pipeIn == null)
Modified: incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTML/SimpleCharStream.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Demo/DemoLib/HTML/SimpleCharStream.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTML/SimpleCharStream.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTML/SimpleCharStream.cs Thu Aug 17 06:49:26 2006
@@ -217,26 +217,6 @@
return (c);
}
- /// <deprecated>
- /// </deprecated>
- /// <seealso cref="getEndColumn">
- /// </seealso>
-
- public virtual int GetColumn()
- {
- return bufcolumn[bufpos];
- }
-
- /// <deprecated>
- /// </deprecated>
- /// <seealso cref="getEndLine">
- /// </seealso>
-
- public virtual int GetLine()
- {
- return bufline[bufpos];
- }
-
public virtual int GetEndColumn()
{
return bufcolumn[bufpos];
Modified: incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTMLDocument.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Demo/DemoLib/HTMLDocument.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTMLDocument.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Demo/DemoLib/HTMLDocument.cs Thu Aug 17 06:49:26 2006
@@ -39,7 +39,7 @@
public static System.String Uid2url(System.String uid)
{
System.String url = uid.Replace('\u0000', '/'); // replace nulls with slashes
- return url.Substring(0, (url.LastIndexOf('/')) - (0)); // remove date from end
+ return url.Substring(0, (url.LastIndexOf((System.Char) '/')) - (0)); // remove date from end
}
public static Document Document(System.IO.FileInfo f)
Modified: incubator/lucene.net/trunk/C#/src/Demo/IndexFiles/AssemblyInfo.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Demo/IndexFiles/AssemblyInfo.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Demo/IndexFiles/AssemblyInfo.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Demo/IndexFiles/AssemblyInfo.cs Thu Aug 17 06:49:26 2006
@@ -26,7 +26,7 @@
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.9.1.001")]
+[assembly: AssemblyVersion("2.0.0.001")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
Modified: incubator/lucene.net/trunk/C#/src/Demo/IndexHtml/AssemblyInfo.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Demo/IndexHtml/AssemblyInfo.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Demo/IndexHtml/AssemblyInfo.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Demo/IndexHtml/AssemblyInfo.cs Thu Aug 17 06:49:26 2006
@@ -26,7 +26,7 @@
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.9.1.001")]
+[assembly: AssemblyVersion("2.0.0.001")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
Modified: incubator/lucene.net/trunk/C#/src/Demo/IndexHtml/IndexHtml.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Demo/IndexHtml/IndexHtml.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Demo/IndexHtml/IndexHtml.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Demo/IndexHtml/IndexHtml.cs Thu Aug 17 06:49:26 2006
@@ -84,7 +84,6 @@
deleting = true;
IndexDocs(root, index, create);
}
-
writer = new IndexWriter(index, new StandardAnalyzer(), create);
writer.SetMaxFieldLength(1000000);
IndexDocs(root, index, create); // add new docs
@@ -127,7 +126,7 @@
while (uidIter.Term() != null && (System.Object) uidIter.Term().Field() == (System.Object) "uid")
{
System.Console.Out.WriteLine("deleting " + HTMLDocument.Uid2url(uidIter.Term().Text()));
- reader.Delete(uidIter.Term());
+ reader.DeleteDocuments(uidIter.Term());
uidIter.Next();
}
deleting = false;
@@ -166,7 +165,7 @@
{
// delete stale docs
System.Console.Out.WriteLine("deleting " + HTMLDocument.Uid2url(uidIter.Term().Text()));
- reader.Delete(uidIter.Term());
+ reader.DeleteDocuments(uidIter.Term());
}
uidIter.Next();
}
Modified: incubator/lucene.net/trunk/C#/src/Demo/SearchFiles/AssemblyInfo.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Demo/SearchFiles/AssemblyInfo.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Demo/SearchFiles/AssemblyInfo.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Demo/SearchFiles/AssemblyInfo.cs Thu Aug 17 06:49:26 2006
@@ -26,7 +26,7 @@
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.9.1.001")]
+[assembly: AssemblyVersion("2.0.0.001")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
Modified: incubator/lucene.net/trunk/C#/src/Demo/SearchFiles/SearchFiles.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Demo/SearchFiles/SearchFiles.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Demo/SearchFiles/SearchFiles.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Demo/SearchFiles/SearchFiles.cs Thu Aug 17 06:49:26 2006
@@ -18,13 +18,13 @@
using Analyzer = Lucene.Net.Analysis.Analyzer;
using StandardAnalyzer = Lucene.Net.Analysis.Standard.StandardAnalyzer;
using Document = Lucene.Net.Documents.Document;
-using IndexReader = Lucene.Net.Index.IndexReader;
using FilterIndexReader = Lucene.Net.Index.FilterIndexReader;
-using Searcher = Lucene.Net.Search.Searcher;
+using IndexReader = Lucene.Net.Index.IndexReader;
+using QueryParser = Lucene.Net.QueryParsers.QueryParser;
+using Hits = Lucene.Net.Search.Hits;
using IndexSearcher = Lucene.Net.Search.IndexSearcher;
using Query = Lucene.Net.Search.Query;
-using Hits = Lucene.Net.Search.Hits;
-using QueryParser = Lucene.Net.QueryParsers.QueryParser;
+using Searcher = Lucene.Net.Search.Searcher;
namespace Lucene.Net.Demo
{
@@ -39,7 +39,7 @@
/// memory. If all of the fields contain only a single token, then the norms
/// are all identical, then single norm vector may be shared.
/// </summary>
- private class OneNormsReader:FilterIndexReader
+ private class OneNormsReader : FilterIndexReader
{
private System.String field;
@@ -126,7 +126,7 @@
{
in_Renamed = new System.IO.StreamReader(new System.IO.StreamReader(System.Console.OpenStandardInput(), System.Text.Encoding.GetEncoding("UTF-8")).BaseStream, new System.IO.StreamReader(System.Console.OpenStandardInput(), System.Text.Encoding.GetEncoding("UTF-8")).CurrentEncoding);
}
-
+ QueryParser parser = new QueryParser(field, analyzer);
while (true)
{
if (queries == null)
@@ -135,10 +135,10 @@
System.String line = in_Renamed.ReadLine();
- if (line == null || line.Length == - 1)
+ if (line == null || line.Length == 0)
break;
- Query query = QueryParser.Parse(line, field, analyzer);
+ Query query = parser.Parse(line);
System.Console.Out.WriteLine("Searching for: " + query.ToString(field));
Hits hits = searcher.Search(query);
Modified: incubator/lucene.net/trunk/C#/src/HISTORY.txt
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/HISTORY.txt?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/HISTORY.txt (original)
+++ incubator/lucene.net/trunk/C#/src/HISTORY.txt Thu Aug 17 06:49:26 2006
@@ -2,6 +2,10 @@
------------------
+17Aug06:
+ - Release: Lucene.Net.2.0 build 001 "Alpha"
+
+
13Jul06:
- Release: Lucene.Net.1.9.1 build 001
- Port: Lucene.Net.Documents.TimeToString() -- re-based with the Java version
Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/Analyzer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Analysis/Analyzer.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/Analyzer.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/Analyzer.cs Thu Aug 17 06:49:26 2006
@@ -37,23 +37,8 @@
/// strategy based on document and/or field. Must be able to handle null
/// field name for backward compatibility.
/// </summary>
- public virtual TokenStream TokenStream(System.String fieldName, System.IO.TextReader reader)
- {
- // implemented for backward compatibility
- return TokenStream(reader);
- }
+ public abstract TokenStream TokenStream(System.String fieldName, System.IO.TextReader reader);
- /// <summary>Creates a TokenStream which tokenizes all the text in the provided
- /// Reader. Provided for backward compatibility only.
- /// </summary>
- /// <deprecated> use tokenStream(String, Reader) instead.
- /// </deprecated>
- /// <seealso cref="TokenStream(String, Reader)">
- /// </seealso>
- public virtual TokenStream TokenStream(System.IO.TextReader reader)
- {
- return TokenStream(null, reader);
- }
/// <summary> Invoked before indexing a Field instance if
/// terms have already been added to that field. This allows custom
Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/Standard/CharStream.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Analysis/Standard/CharStream.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/Standard/CharStream.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/Standard/CharStream.cs Thu Aug 17 06:49:26 2006
@@ -42,20 +42,6 @@
/// </summary>
char ReadChar();
- /// <summary> Returns the column position of the character last read.</summary>
- /// <deprecated>
- /// </deprecated>
- /// <seealso cref="getEndColumn">
- /// </seealso>
- int GetColumn();
-
- /// <summary> Returns the line number of the character last read.</summary>
- /// <deprecated>
- /// </deprecated>
- /// <seealso cref="getEndLine">
- /// </seealso>
- int GetLine();
-
/// <summary> Returns the column number of the last character for current token (being
/// matched after the last call to BeginTOken).
/// </summary>
Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/Standard/ParseException.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Analysis/Standard/ParseException.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/Standard/ParseException.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/Standard/ParseException.cs Thu Aug 17 06:49:26 2006
@@ -107,8 +107,6 @@
/// </summary>
public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, System.String[] tokenImageVal):base("")
{
- if (eol == null)
- eol = @"\n";
specialConstructor = true;
currentToken = currentTokenVal;
expectedTokenSequences = expectedTokenSequencesVal;
@@ -126,15 +124,11 @@
public ParseException() : base()
{
- if (eol == null)
- eol = @"\n";
specialConstructor = false;
}
public ParseException(System.String message) : base(message)
{
- if (eol == null)
- eol = @"\n";
specialConstructor = false;
}
Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/StopFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Analysis/StopFilter.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/StopFilter.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/StopFilter.cs Thu Aug 17 06:49:26 2006
@@ -41,27 +41,7 @@
this.stopWords = MakeStopSet(stopWords, ignoreCase);
}
- /// <summary> Constructs a filter which removes words from the input
- /// TokenStream that are named in the Hashtable.
- ///
- /// </summary>
- /// <deprecated> Use {@link #StopFilter(TokenStream, Set)} instead
- /// </deprecated>
- public StopFilter(TokenStream in_Renamed, System.Collections.Hashtable stopTable) : this(in_Renamed, stopTable, false)
- {
- }
- /// <summary> Constructs a filter which removes words from the input
- /// TokenStream that are named in the Hashtable.
- /// If ignoreCase is true, all keys in the stopTable should already
- /// be lowercased.
- /// </summary>
- /// <deprecated> Use {@link #StopFilter(TokenStream, Set)} instead
- /// </deprecated>
- public StopFilter(TokenStream in_Renamed, System.Collections.Hashtable stopTable, bool ignoreCase)
- : this(in_Renamed, new System.Collections.Hashtable(stopTable), ignoreCase, 0)
- {
- }
-
+
/// <summary> Construct a token stream filtering the given input.</summary>
/// <param name="input">
/// </param>
@@ -69,7 +49,7 @@
/// </param>
/// <param name="ignoreCase">-Ignore case when stopping. The stopWords set must be setup to contain only lower case words
/// </param>
- public StopFilter(TokenStream input, System.Collections.Hashtable stopWords, bool ignoreCase, int as_set_in_java) : base(input)
+ public StopFilter(TokenStream input, System.Collections.Hashtable stopWords, bool ignoreCase) : base(input)
{
this.ignoreCase = ignoreCase;
this.stopWords = stopWords;
@@ -81,40 +61,10 @@
/// for maximum performance.
///
/// </summary>
- /// <seealso cref="MakeStopSet(java.lang.String[])">
+ /// <seealso cref="MakeStopSet(String[])">
/// </seealso>
- public StopFilter(TokenStream in_Renamed, System.Collections.Hashtable stopWords, int as_set_in_java) : this(in_Renamed, stopWords, false)
- {
- }
- /// <summary> Builds a Hashtable from an array of stop words,
- /// appropriate for passing into the StopFilter constructor.
- /// This permits this table construction to be cached once when
- /// an Analyzer is constructed.
- ///
- /// </summary>
- /// <deprecated> Use {@link #MakeStopSet(String[])} instead.
- /// </deprecated>
- public static System.Collections.Hashtable MakeStopTable(System.String[] stopWords)
- {
- return makeStopTable(stopWords, false);
- }
-
- /// <summary> Builds a Hashtable from an array of stop words,
- /// appropriate for passing into the StopFilter constructor.
- /// This permits this table construction to be cached once when
- /// an Analyzer is constructed.
- /// </summary>
- /// <deprecated> Use {@link #MakeStopSet(java.lang.String[], boolean)} instead.
- /// </deprecated>
- public static System.Collections.Hashtable makeStopTable(System.String[] stopWords, bool ignoreCase)
+ public StopFilter(TokenStream in_Renamed, System.Collections.Hashtable stopWords) : this(in_Renamed, stopWords, false)
{
- System.Collections.Hashtable stopTable = System.Collections.Hashtable.Synchronized(new System.Collections.Hashtable(stopWords.Length));
- for (int i = 0; i < stopWords.Length; i++)
- {
- System.String stopWord = ignoreCase ? stopWords[i].ToLower() : stopWords[i];
- stopTable[stopWord] = stopWord;
- }
- return stopTable;
}
/// <summary> Builds a Set from an array of stop words,
@@ -123,7 +73,7 @@
/// an Analyzer is constructed.
///
/// </summary>
- /// <seealso cref="MakeStopSet(java.lang.String[], boolean) passing false to ignoreCase">
+ /// <seealso cref="MakeStopSet(String[], boolean) passing false to ignoreCase">
/// </seealso>
public static System.Collections.Hashtable MakeStopSet(System.String[] stopWords)
{
Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/TokenFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Analysis/TokenFilter.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/TokenFilter.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/TokenFilter.cs Thu Aug 17 06:49:26 2006
@@ -29,13 +29,6 @@
/// <summary>The source of tokens for this filter. </summary>
protected internal TokenStream input;
- /// <summary>Call TokenFilter(TokenStream) instead.</summary>
- /// <deprecated>
- /// </deprecated>
- protected internal TokenFilter()
- {
- }
-
/// <summary>Construct a token stream filtering the given input. </summary>
protected internal TokenFilter(TokenStream input)
{
Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/WordlistLoader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Analysis/WordlistLoader.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/WordlistLoader.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Analysis/WordlistLoader.cs Thu Aug 17 06:49:26 2006
@@ -88,39 +88,6 @@
return result;
}
- /// <param name="path"> Path to the wordlist
- /// </param>
- /// <param name="wordfile"> Name of the wordlist
- ///
- /// </param>
- /// <deprecated> Use {@link #GetWordSet(File)} instead
- /// </deprecated>
- public static System.Collections.Hashtable GetWordtable(System.String path, System.String wordfile)
- {
- return GetWordtable(new System.IO.FileInfo(System.IO.Path.Combine(path, wordfile)));
- }
-
- /// <param name="wordfile"> Complete path to the wordlist
- ///
- /// </param>
- /// <deprecated> Use {@link #GetWordSet(File)} instead
- /// </deprecated>
- public static System.Collections.Hashtable GetWordtable(System.String wordfile)
- {
- return GetWordtable(new System.IO.FileInfo(wordfile));
- }
-
- /// <param name="wordfile"> File object that points to the wordlist
- ///
- /// </param>
- /// <deprecated> Use {@link #GetWordSet(File)} instead
- /// </deprecated>
- public static System.Collections.Hashtable GetWordtable(System.IO.FileInfo wordfile)
- {
- System.Collections.Hashtable wordSet = (System.Collections.Hashtable) GetWordSet(wordfile);
- System.Collections.Hashtable result = MakeWordTable(wordSet);
- return result;
- }
/// <summary> Builds a wordlist table, using words as both keys and values
/// for backward compatibility.
Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/AssemblyInfo.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/AssemblyInfo.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/AssemblyInfo.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/AssemblyInfo.cs Thu Aug 17 06:49:26 2006
@@ -26,7 +26,7 @@
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.9.1.001")]
+[assembly: AssemblyVersion("2.0.0.001")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/DateField.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Document/DateField.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/DateField.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/DateField.cs Thu Aug 17 06:49:26 2006
@@ -15,19 +15,20 @@
*/
using System;
-using PrefixQuery = Lucene.Net.Search.PrefixQuery; // for javadoc
-using RangeQuery = Lucene.Net.Search.RangeQuery; // for javadoc
+using PrefixQuery = Lucene.Net.Search.PrefixQuery;
+using RangeQuery = Lucene.Net.Search.RangeQuery;
namespace Lucene.Net.Documents
{
-
+ // for javadoc
+
/// <summary> Provides support for converting dates to strings and vice-versa.
/// The strings are structured so that lexicographic sorting orders by date,
/// which makes them suitable for use as field values and search terms.
///
/// <P>Note that this class saves dates with millisecond granularity,
/// which is bad for {@link RangeQuery} and {@link PrefixQuery}, as those
- /// queries are expanded to a BooleanQuery with a potentially large number
+ /// queries are expanded to a BooleanQuery with a potentially large number
/// of terms when searching. Thus you might want to use
/// {@link DateTools} instead.
///
@@ -37,9 +38,8 @@
/// alternative without such a limitation.
///
/// </summary>
- /// <deprecated> If you build a new index, use {@link DateTools} instead. For
- /// existing indices you can continue using this class, as it will not be
- /// removed in the near future despite being deprecated.
+ /// <deprecated> If you build a new index, use {@link DateTools} instead. This class is included for use with existing
+ /// indices and will be removed in a future release.
/// </deprecated>
public class DateField
{
Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/DateTools.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Document/DateTools.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/DateTools.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/DateTools.cs Thu Aug 17 06:49:26 2006
@@ -64,7 +64,7 @@
/// {@link #Round(long, DateTools.Resolution)}
/// </param>
/// <returns> a string in format <code>yyyyMMddHHmmssSSS</code> or shorter,
- /// depeding on <code>resolution</code>
+ /// depeding on <code>resolution</code>; using UTC as timezone
/// </returns>
public static System.String TimeToString(long time, Resolution resolution)
{
@@ -309,7 +309,8 @@
return dt.Ticks;
}
- public class Resolution
+ /// <summary>Specifies the time granularity. </summary>
+ public class Resolution
{
public static readonly Resolution YEAR = new Resolution("year");
public static readonly Resolution MONTH = new Resolution("month");
Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/Document.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Document/Document.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/Document.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/Document.cs Thu Aug 17 06:49:26 2006
@@ -47,6 +47,12 @@
{
}
+ /// <summary>Returns the number of fields in this document</summary>
+ /// Added as a helper for Lucene.Net
+ public int GetFieldsCount()
+ {
+ return fields.Count;
+ }
/// <summary>Sets a boost factor for hits on any field of this document. This value
/// will be multiplied into the score of all hits on this document.
@@ -169,9 +175,9 @@
}
/// <summary>Returns an Enumeration of all the fields in a document. </summary>
- public System.Collections.IEnumerator Fields()
+ public System.Collections.IEnumerable Fields()
{
- return ((System.Collections.ArrayList) fields).GetEnumerator();
+ return fields;
}
/// <summary> Returns an array of {@link Field}s with the given name.
Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/Field.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Document/Field.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/Field.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/Field.cs Thu Aug 17 06:49:26 2006
@@ -50,7 +50,8 @@
private float boost = 1.0f;
- [Serializable]
+ /// <summary>Specifies whether and how a field should be stored. </summary>
+ [Serializable]
public sealed class Store : Parameter
{
@@ -74,7 +75,8 @@
public static readonly Store NO = new Store("NO");
}
- [Serializable]
+ /// <summary>Specifies whether and how a field should be indexed. </summary>
+ [Serializable]
public sealed class Index : Parameter
{
@@ -109,7 +111,8 @@
public static readonly Index NO_NORMS = new Index("NO_NORMS");
}
- [Serializable]
+ /// <summary>Specifies whether and how a field should have term vectors. </summary>
+ [Serializable]
public sealed class TermVector : Parameter
{
@@ -192,110 +195,6 @@
return boost;
}
- /// <summary>Constructs a String-valued Field that is not tokenized, but is indexed
- /// and stored. Useful for non-text fields, e.g. date or url.
- /// </summary>
- /// <deprecated> use {@link #Field(String, String, Field.Store, Field.Index)
- /// Field(name, value, Field.Store.YES, Field.Index.UN_TOKENIZED)} instead
- /// </deprecated>
- public static Field Keyword(System.String name, System.String value_Renamed)
- {
- return new Field(name, value_Renamed, true, true, false);
- }
-
- /// <summary>Constructs a String-valued Field that is not tokenized nor indexed,
- /// but is stored in the index, for return with hits.
- /// </summary>
- /// <deprecated> use {@link #Field(String, String, Field.Store, Field.Index)
- /// Field(name, value, Field.Store.YES, Field.Index.NO)} instead
- /// </deprecated>
- public static Field UnIndexed(System.String name, System.String value_Renamed)
- {
- return new Field(name, value_Renamed, true, false, false);
- }
-
- /// <summary>Constructs a String-valued Field that is tokenized and indexed,
- /// and is stored in the index, for return with hits. Useful for short text
- /// fields, like "title" or "subject". Term vector will not be stored for this field.
- /// </summary>
- /// <deprecated> use {@link #Field(String, String, Field.Store, Field.Index)
- /// Field(name, value, Field.Store.YES, Field.Index.TOKENIZED)} instead
- /// </deprecated>
- public static Field Text(System.String name, System.String value_Renamed)
- {
- return Text(name, value_Renamed, false);
- }
-
- /// <summary>Constructs a Date-valued Field that is not tokenized and is indexed,
- /// and stored in the index, for return with hits.
- /// </summary>
- /// <deprecated> use {@link #Field(String, String, Field.Store, Field.Index)
- /// Field(name, value, Field.Store.YES, Field.Index.UN_TOKENIZED)} instead
- /// </deprecated>
- public static Field Keyword(System.String name, System.DateTime value_Renamed)
- {
- return new Field(name, DateField.DateToString(value_Renamed), true, true, false);
- }
-
- /// <summary>Constructs a String-valued Field that is tokenized and indexed,
- /// and is stored in the index, for return with hits. Useful for short text
- /// fields, like "title" or "subject".
- /// </summary>
- /// <deprecated> use {@link #Field(String, String, Field.Store, Field.Index, Field.TermVector)
- /// Field(name, value, Field.Store.YES, Field.Index.TOKENIZED, storeTermVector)} instead
- /// </deprecated>
- public static Field Text(System.String name, System.String value_Renamed, bool storeTermVector)
- {
- return new Field(name, value_Renamed, true, true, true, storeTermVector);
- }
-
- /// <summary>Constructs a String-valued Field that is tokenized and indexed,
- /// but that is not stored in the index. Term vector will not be stored for this field.
- /// </summary>
- /// <deprecated> use {@link #Field(String, String, Field.Store, Field.Index)
- /// Field(name, value, Field.Store.NO, Field.Index.TOKENIZED)} instead
- /// </deprecated>
- public static Field UnStored(System.String name, System.String value_Renamed)
- {
- return UnStored(name, value_Renamed, false);
- }
-
- /// <summary>Constructs a String-valued Field that is tokenized and indexed,
- /// but that is not stored in the index.
- /// </summary>
- /// <deprecated> use {@link #Field(String, String, Field.Store, Field.Index, Field.TermVector)
- /// Field(name, value, Field.Store.NO, Field.Index.TOKENIZED, storeTermVector)} instead
- /// </deprecated>
- public static Field UnStored(System.String name, System.String value_Renamed, bool storeTermVector)
- {
- return new Field(name, value_Renamed, false, true, true, storeTermVector);
- }
-
- /// <summary>Constructs a Reader-valued Field that is tokenized and indexed, but is
- /// not stored in the index verbatim. Useful for longer text fields, like
- /// "body". Term vector will not be stored for this field.
- /// </summary>
- /// <deprecated> use {@link #Field(String, Reader) Field(name, value)} instead
- /// </deprecated>
- public static Field Text(System.String name, System.IO.TextReader value_Renamed)
- {
- return Text(name, value_Renamed, false);
- }
-
- /// <summary>Constructs a Reader-valued Field that is tokenized and indexed, but is
- /// not stored in the index verbatim. Useful for longer text fields, like
- /// "body".
- /// </summary>
- /// <deprecated> use {@link #Field(String, Reader, Field.TermVector)
- /// Field(name, value, storeTermVector)} instead
- /// </deprecated>
- public static Field Text(System.String name, System.IO.TextReader value_Renamed, bool storeTermVector)
- {
- Field f = new Field(name, value_Renamed);
- f.storeTermVector = storeTermVector;
- return f;
- }
-
/// <summary>Returns the name of the field as an interned string.
/// For example "date", "title", "body", ...
/// </summary>
@@ -378,7 +277,9 @@
throw new System.NullReferenceException("name cannot be null");
if (value_Renamed == null)
throw new System.NullReferenceException("value cannot be null");
- if (index == Index.NO && store == Store.NO)
+ if (name.Length == 0 && value_Renamed.Length == 0)
+ throw new System.ArgumentException("name and value cannot both be empty");
+ if (index == Index.NO && store == Store.NO)
throw new System.ArgumentException("it doesn't make sense to have a field that " + "is neither indexed nor stored");
if (index == Index.NO && termVector != TermVector.NO)
throw new System.ArgumentException("cannot store term vector information " + "for a field that is not indexed");
@@ -482,18 +383,9 @@
SetStoreTermVector(termVector);
}
- /// <summary>Create a field by specifying all parameters except for <code>storeTermVector</code>,
- /// which is set to <code>false</code>.
- ///
- /// </summary>
- /// <deprecated> use {@link #Field(String, String, Field.Store, Field.Index)} instead
- /// </deprecated>
- public Field(System.String name, System.String string_Renamed, bool store, bool index, bool token) : this(name, string_Renamed, store, index, token, false)
- {
- }
- /// <summary> Create a stored field with binary value. Optionally the value may be compressed.
+ /// <summary> Create a stored field with binary value. Optionally the value may be compressed.
///
/// </summary>
/// <param name="name">The name of the field
@@ -502,7 +394,8 @@
/// </param>
/// <param name="store">How <code>value</code> should be stored (compressed or not.)
/// </param>
- public Field(System.String name, byte[] value_Renamed, Store store)
+ /// <throws> IllegalArgumentException if store is <code>Store.NO</code> </throws>
+ public Field(System.String name, byte[] value_Renamed, Store store)
{
if (name == null)
throw new System.ArgumentException("name cannot be null");
@@ -535,39 +428,6 @@
this.isBinary = true;
SetStoreTermVector(TermVector.NO);
- }
-
- /// <summary> </summary>
- /// <param name="name">The name of the field
- /// </param>
- /// <param name="string">The string to process
- /// </param>
- /// <param name="store">true if the field should store the string
- /// </param>
- /// <param name="index">true if the field should be indexed
- /// </param>
- /// <param name="token">true if the field should be tokenized
- /// </param>
- /// <param name="storeTermVector">true if we should store the Term Vector info
- ///
- /// </param>
- /// <deprecated> use {@link #Field(String, String, Field.Store, Field.Index, Field.TermVector)} instead
- /// </deprecated>
- public Field(System.String name, System.String string_Renamed, bool store, bool index, bool token, bool storeTermVector)
- {
- if (name == null)
- throw new System.NullReferenceException("name cannot be null");
- if (string_Renamed == null)
- throw new System.NullReferenceException("value cannot be null");
- if (!index && storeTermVector)
- throw new System.ArgumentException("cannot store a term vector for fields that are not indexed");
-
- this.name = String.Intern(name); // field names are interned
- this.fieldsData = string_Renamed;
- this.isStored = store;
- this.isIndexed = index;
- this.isTokenized = token;
- this.storeTermVector = storeTermVector;
}
private void SetStoreTermVector(TermVector termVector)
Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/NumberTools.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Document/NumberTools.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/NumberTools.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Document/NumberTools.cs Thu Aug 17 06:49:26 2006
@@ -57,6 +57,7 @@
/// <summary> Converts a long to a String suitable for indexing.</summary>
public static System.String LongToString(long l)
{
+
if (l == System.Int64.MinValue)
{
// special case, because long is not symetric around zero
Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/DocumentWriter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Index/DocumentWriter.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/DocumentWriter.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/DocumentWriter.cs Thu Aug 17 06:49:26 2006
@@ -138,10 +138,8 @@
// Tokenizes the fields of a document into Postings.
private void InvertDocument(Document doc)
{
- System.Collections.IEnumerator fields = doc.Fields();
- while (fields.MoveNext())
+ foreach(Field field in doc.Fields())
{
- Field field = (Field) fields.Current;
System.String fieldName = field.Name();
int fieldNumber = fieldInfos.FieldNumber(fieldName);
Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/FieldInfo.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Index/FieldInfo.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/FieldInfo.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/FieldInfo.cs Thu Aug 17 06:49:26 2006
@@ -32,9 +32,9 @@
public /*internal*/ bool omitNorms; // omit norms associated with indexed fields
- public bool IsIndexed
+ public bool IsIndexed() // {{Aroush-2.0}} remove this function
{
- get { return isIndexed; }
+ return isIndexed;
}
internal FieldInfo(System.String na, bool tk, int nu, bool storeTermVector, bool storePositionWithTermVector, bool storeOffsetWithTermVector, bool omitNorms)
Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/FieldInfos.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Index/FieldInfos.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/FieldInfos.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/FieldInfos.cs Thu Aug 17 06:49:26 2006
@@ -70,10 +70,8 @@
/// <summary>Adds field info for a Document. </summary>
public void Add(Document doc)
{
- System.Collections.IEnumerator fields = doc.Fields();
- while (fields.MoveNext())
- {
- Field field = (Field) fields.Current;
+ foreach (Field field in doc.Fields())
+ {
Add(field.Name(), field.IsIndexed(), field.IsTermVectorStored(), field.IsStorePositionWithTermVector(), field.IsStoreOffsetWithTermVector(), field.GetOmitNorms());
}
}
Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/FieldsReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Index/FieldsReader.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/FieldsReader.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/FieldsReader.cs Thu Aug 17 06:49:26 2006
@@ -148,6 +148,7 @@
private byte[] Uncompress(byte[] input)
{
+ // {{Aroush-2.0}} For .NET 2.0, replace this call to use the built-in compression support
return SupportClass.CompressionSupport.Uncompress(input);
}
}
Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/FieldsWriter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Index/FieldsWriter.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/FieldsWriter.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/FieldsWriter.cs Thu Aug 17 06:49:26 2006
@@ -53,19 +53,15 @@
indexStream.WriteLong(fieldsStream.GetFilePointer());
int storedCount = 0;
- System.Collections.IEnumerator fields = doc.Fields();
- while (fields.MoveNext())
- {
- Field field = (Field) fields.Current;
+ foreach (Field field in doc.Fields())
+ {
if (field.IsStored())
storedCount++;
}
fieldsStream.WriteVInt(storedCount);
- fields = doc.Fields();
- while (fields.MoveNext())
+ foreach (Field field in doc.Fields())
{
- Field field = (Field) fields.Current;
if (field.IsStored())
{
fieldsStream.WriteVInt(fieldInfos.FieldNumber(field.Name()));
@@ -118,6 +114,7 @@
private byte[] Compress(byte[] input)
{
+ // {{Aroush-2.0}} For .NET 2.0, replace this call to use the built-in compression support
return SupportClass.CompressionSupport.Compress(input);
}
}
Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/FilterIndexReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Index/FilterIndexReader.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/FilterIndexReader.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/FilterIndexReader.cs Thu Aug 17 06:49:26 2006
@@ -16,7 +16,6 @@
using System;
using Document = Lucene.Net.Documents.Document;
-using Field = Lucene.Net.Documents.Field;
namespace Lucene.Net.Index
{
@@ -214,7 +213,7 @@
protected internal override void DoDelete(int n)
{
- in_Renamed.Delete(n);
+ in_Renamed.DeleteDocument(n);
}
protected internal override void DoCommit()
{
@@ -225,24 +224,20 @@
in_Renamed.Close();
}
- public override System.Collections.ICollection GetFieldNames()
- {
- return in_Renamed.GetFieldNames();
- }
-
- public override System.Collections.ICollection GetFieldNames(bool indexed)
- {
- return in_Renamed.GetFieldNames(indexed);
- }
- public override System.Collections.ICollection GetIndexedFieldNames(Field.TermVector tvSpec)
- {
- return in_Renamed.GetIndexedFieldNames(tvSpec);
- }
-
- public override System.Collections.ICollection GetFieldNames(IndexReader.FieldOption fieldNames)
- {
- return in_Renamed.GetFieldNames(fieldNames);
- }
- }
+ public override System.Collections.ICollection GetFieldNames(IndexReader.FieldOption fieldNames)
+ {
+ return in_Renamed.GetFieldNames(fieldNames);
+ }
+
+ public override long GetVersion()
+ {
+ return in_Renamed.GetVersion();
+ }
+
+ public override bool IsCurrent()
+ {
+ return in_Renamed.IsCurrent();
+ }
+ }
}
Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/IndexModifier.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Index/IndexModifier.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/IndexModifier.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/IndexModifier.cs Thu Aug 17 06:49:26 2006
@@ -287,24 +287,6 @@
}
}
- /// <summary> Deletes all documents containing <code>term</code>.
- /// This is useful if one uses a document field to hold a unique ID string for
- /// the document. Then to delete such a document, one merely constructs a
- /// term with the appropriate field and the unique ID string as its text and
- /// passes it to this method. Returns the number of documents deleted.
- /// </summary>
- /// <returns> the number of documents deleted
- /// </returns>
- /// <seealso cref="IndexReader.DeleteDocuments(Term)">
- /// </seealso>
- /// <throws> IllegalStateException if the index is closed </throws>
- /// <deprecated> Use {@link #DeleteDocuments(Term)} instead.
- /// </deprecated>
- public virtual int Delete(Term term)
- {
- return DeleteDocuments(term);
- }
-
/// <summary> Deletes the document numbered <code>docNum</code>.</summary>
/// <seealso cref="IndexReader.DeleteDocument(int)">
/// </seealso>
@@ -319,18 +301,8 @@
}
}
- /// <summary> Deletes the document numbered <code>docNum</code>.</summary>
- /// <seealso cref="IndexReader.DeleteDocument(int)">
- /// </seealso>
- /// <throws> IllegalStateException if the index is closed </throws>
- /// <deprecated> Use {@link #DeleteDocument(int)} instead.
- /// </deprecated>
- public virtual void Delete(int docNum)
- {
- DeleteDocument(docNum);
- }
- /// <summary> Returns the number of documents currently in this index.</summary>
+ /// <summary> Returns the number of documents currently in this index.</summary>
/// <seealso cref="IndexWriter.DocCount()">
/// </seealso>
/// <seealso cref="IndexReader.NumDocs()">
Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/IndexReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Index/IndexReader.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/IndexReader.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/IndexReader.cs Thu Aug 17 06:49:26 2006
@@ -288,8 +288,28 @@
/// <throws> IOException if segments file cannot be read. </throws>
public static long GetCurrentVersion(Directory directory)
{
- return SegmentInfos.ReadCurrentVersion(directory);
- }
+ lock (directory)
+ {
+ // in- & inter-process sync
+ Lock commitLock = directory.MakeLock(IndexWriter.COMMIT_LOCK_NAME);
+
+ bool locked = false;
+
+ try
+ {
+ locked = commitLock.Obtain(IndexWriter.COMMIT_LOCK_TIMEOUT);
+
+ return SegmentInfos.ReadCurrentVersion(directory);
+ }
+ finally
+ {
+ if (locked)
+ {
+ commitLock.Release();
+ }
+ }
+ }
+ }
/// <summary> Version number when this IndexReader was opened.</summary>
public virtual long GetVersion()
@@ -305,12 +325,28 @@
/// <throws> IOException </throws>
public virtual bool IsCurrent()
{
- if (SegmentInfos.ReadCurrentVersion(directory) != segmentInfos.GetVersion())
- {
- return false;
- }
- return true;
- }
+ lock (directory)
+ {
+ // in- & inter-process sync
+ Lock commitLock = directory.MakeLock(IndexWriter.COMMIT_LOCK_NAME);
+
+ bool locked = false;
+
+ try
+ {
+ locked = commitLock.Obtain(IndexWriter.COMMIT_LOCK_TIMEOUT);
+
+ return SegmentInfos.ReadCurrentVersion(directory) == segmentInfos.GetVersion();
+ }
+ finally
+ {
+ if (locked)
+ {
+ commitLock.Release();
+ }
+ }
+ }
+ }
/// <summary> Return an array of term frequency vectors for the specified document.
/// The array contains a vector for each vectorized field in the document.
@@ -573,25 +609,8 @@
}
}
- /// <summary>Deletes the document numbered <code>docNum</code>. Once a document is
- /// deleted it will not appear in TermDocs or TermPostitions enumerations.
- /// Attempts to read its field with the {@link #document}
- /// method will result in an error. The presence of this document may still be
- /// reflected in the {@link #docFreq} statistic, though
- /// this will be corrected eventually as the index is further modified.
- ///
- /// </summary>
- /// <deprecated> Use {@link #DeleteDocument(int docNum)} instead.
- /// </deprecated>
- public void Delete(int docNum)
- {
- lock (this)
- {
- DeleteDocument(docNum);
- }
- }
- /// <summary>Deletes the document numbered <code>docNum</code>. Once a document is
+ /// <summary>Deletes the document numbered <code>docNum</code>. Once a document is
/// deleted it will not appear in TermDocs or TermPostitions enumerations.
/// Attempts to read its field with the {@link #document}
/// method will result in an error. The presence of this document may still be
@@ -611,29 +630,12 @@
/// <summary>Implements deletion of the document numbered <code>docNum</code>.
- /// Applications should call {@link #Delete(int)} or {@link #Delete(Term)}.
+ /// Applications should call {@link #DeleteDocument(int)} or {@link #DeleteDocuments(Term)}.
/// </summary>
protected internal abstract void DoDelete(int docNum);
- /// <summary>Deletes all documents containing <code>term</code>.
- /// This is useful if one uses a document field to hold a unique ID string for
- /// the document. Then to delete such a document, one merely constructs a
- /// term with the appropriate field and the unique ID string as its text and
- /// passes it to this method.
- /// See {@link #Delete(int)} for information about when this deletion will
- /// become effective.
- /// </summary>
- /// <returns> the number of documents deleted
- ///
- /// </returns>
- /// <deprecated> Use {@link #DeleteDocuments(Term term)} instead.
- /// </deprecated>
- public int Delete(Term term)
- {
- return DeleteDocuments(term);
- }
- /// <summary>Deletes all documents containing <code>term</code>.
+ /// <summary>Deletes all documents containing <code>term</code>.
/// This is useful if one uses a document field to hold a unique ID string for
/// the document. Then to delete such a document, one merely constructs a
/// term with the appropriate field and the unique ID string as its text and
@@ -741,96 +743,8 @@
}
}
- /// <summary> Returns a list of all unique field names that exist in the index pointed
- /// to by this IndexReader.
- /// </summary>
- /// <returns> Collection of Strings indicating the names of the fields
- /// </returns>
- /// <throws> IOException if there is a problem with accessing the index </throws>
- /// <summary>
- /// </summary>
- /// <deprecated> Replaced by {@link #GetFieldNames(IndexReader.FieldOption)}
- /// </deprecated>
- public abstract System.Collections.ICollection GetFieldNames();
-
- /// <summary> Returns a list of all unique field names that exist in the index pointed
- /// to by this IndexReader. The boolean argument specifies whether the fields
- /// returned are indexed or not.
- /// </summary>
- /// <param name="indexed"><code>true</code> if only indexed fields should be returned;
- /// <code>false</code> if only unindexed fields should be returned.
- /// </param>
- /// <returns> Collection of Strings indicating the names of the fields
- /// </returns>
- /// <throws> IOException if there is a problem with accessing the index </throws>
- /// <summary>
- /// </summary>
- /// <deprecated> Replaced by {@link #GetFieldNames(IndexReader.FieldOption)}
- /// </deprecated>
- public abstract System.Collections.ICollection GetFieldNames(bool indexed);
-
- /// <summary> </summary>
- /// <param name="storedTermVector">if true, returns only Indexed fields that have term vector info,
- /// else only indexed fields without term vector info
- /// </param>
- /// <returns> Collection of Strings indicating the names of the fields
- ///
- /// </returns>
- /// <deprecated> Replaced by {@link #GetFieldNames(IndexReader.FieldOption)}
- /// </deprecated>
- public virtual System.Collections.ICollection GetIndexedFieldNames(bool storedTermVector)
- {
- if (storedTermVector)
- {
- System.Collections.Hashtable fieldSet = new System.Collections.Hashtable();
- foreach (object item in GetIndexedFieldNames(Field.TermVector.YES))
- {
- if (fieldSet.ContainsKey(item) == false)
- {
- fieldSet.Add(item, item);
- }
- }
- foreach (object item in GetIndexedFieldNames(Field.TermVector.WITH_POSITIONS))
- {
- if (fieldSet.ContainsKey(item) == false)
- {
- fieldSet.Add(item, item);
- }
- }
- foreach (object item in GetIndexedFieldNames(Field.TermVector.WITH_OFFSETS))
- {
- if (fieldSet.ContainsKey(item) == false)
- {
- fieldSet.Add(item, item);
- }
- }
- foreach (object item in GetIndexedFieldNames(Field.TermVector.WITH_POSITIONS_OFFSETS))
- {
- if (fieldSet.ContainsKey(item) == false)
- {
- fieldSet.Add(item, item);
- }
- }
- return fieldSet;
- }
- else
- return GetIndexedFieldNames(Field.TermVector.NO);
- }
-
- /// <summary> Get a list of unique field names that exist in this index, are indexed, and have
- /// the specified term vector information.
- ///
- /// </summary>
- /// <param name="tvSpec">specifies which term vector information should be available for the fields
- /// </param>
- /// <returns> Collection of Strings indicating the names of the fields
- ///
- /// </returns>
- /// <deprecated> Replaced by {@link #GetFieldNames(IndexReader.FieldOption)}
- /// </deprecated>
- public abstract System.Collections.ICollection GetIndexedFieldNames(Field.TermVector tvSpec);
- /// <summary> Get a list of unique field names that exist in this index and have the specified
+ /// <summary> Get a list of unique field names that exist in this index and have the specified
/// field option information.
/// </summary>
/// <param name="fldOption">specifies which field option should be available for the returned fields
Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/IndexWriter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Index/IndexWriter.cs?rev=432239&r1=432238&r2=432239&view=diff
==============================================================================
--- incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/IndexWriter.cs (original)
+++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Index/IndexWriter.cs Thu Aug 17 06:49:26 2006
@@ -68,8 +68,8 @@
}
}
- internal AnonymousClassWith(bool create, IndexWriter enclosingInstance, Lucene.Net.Store.Lock Param1, long Param2) : base(Param1, Param2)
- {
+ internal AnonymousClassWith(bool create, IndexWriter enclosingInstance, Lucene.Net.Store.Lock Param1, long Param2):base(Param1, Param2)
+ {
InitBlock(create, enclosingInstance);
}
public override System.Object DoBody()
@@ -83,12 +83,10 @@
}
private class AnonymousClassWith1 : Lock.With
{
- private void InitBlock(System.Collections.ArrayList segmentsToDelete, IndexWriter enclosingInstance)
- {
- this.segmentsToDelete = segmentsToDelete;
+ private void InitBlock(IndexWriter enclosingInstance)
+ {
this.enclosingInstance = enclosingInstance;
}
- private System.Collections.ArrayList segmentsToDelete;
private IndexWriter enclosingInstance;
public IndexWriter Enclosing_Instance
{
@@ -98,27 +96,24 @@
}
}
- internal AnonymousClassWith1(System.Collections.ArrayList segmentsToDelete, IndexWriter enclosingInstance, Lucene.Net.Store.Lock Param1, long Param2):base(Param1, Param2)
- {
- InitBlock(segmentsToDelete, enclosingInstance);
- }
+ internal AnonymousClassWith1(IndexWriter enclosingInstance, Lucene.Net.Store.Lock Param1, long Param2):base(Param1, Param2)
+ {
+ InitBlock(enclosingInstance);
+ }
public override System.Object DoBody()
{
Enclosing_Instance.segmentInfos.Write(Enclosing_Instance.directory); // commit changes
- Enclosing_Instance.DeleteSegments(segmentsToDelete); // delete now-unused segments
return null;
}
}
private class AnonymousClassWith2 : Lock.With
{
- private void InitBlock(System.String mergedName, System.Collections.ArrayList filesToDelete, IndexWriter enclosingInstance)
- {
+ private void InitBlock(System.String mergedName, IndexWriter enclosingInstance)
+ {
this.mergedName = mergedName;
- this.filesToDelete = filesToDelete;
this.enclosingInstance = enclosingInstance;
}
private System.String mergedName;
- private System.Collections.ArrayList filesToDelete;
private IndexWriter enclosingInstance;
public IndexWriter Enclosing_Instance
{
@@ -128,27 +123,23 @@
}
}
- internal AnonymousClassWith2(System.String mergedName, System.Collections.ArrayList filesToDelete, IndexWriter enclosingInstance, Lucene.Net.Store.Lock Param1, long Param2):base(Param1, Param2)
- {
- InitBlock(mergedName, filesToDelete, enclosingInstance);
- }
+ internal AnonymousClassWith2(System.String mergedName, IndexWriter enclosingInstance, Lucene.Net.Store.Lock Param1, long Param2):base(Param1, Param2)
+ {
+ InitBlock(mergedName, enclosingInstance);
+ }
public override System.Object DoBody()
{
// make compound file visible for SegmentReaders
Enclosing_Instance.directory.RenameFile(mergedName + ".tmp", mergedName + ".cfs");
- // delete now unused files of segment
- Enclosing_Instance.DeleteFiles(filesToDelete);
return null;
}
}
private class AnonymousClassWith3 : Lock.With
{
- private void InitBlock(System.Collections.ArrayList segmentsToDelete, IndexWriter enclosingInstance)
- {
- this.segmentsToDelete = segmentsToDelete;
+ private void InitBlock(IndexWriter enclosingInstance)
+ {
this.enclosingInstance = enclosingInstance;
}
- private System.Collections.ArrayList segmentsToDelete;
private IndexWriter enclosingInstance;
public IndexWriter Enclosing_Instance
{
@@ -158,27 +149,24 @@
}
}
- internal AnonymousClassWith3(System.Collections.ArrayList segmentsToDelete, IndexWriter enclosingInstance, Lucene.Net.Store.Lock Param1, long Param2):base(Param1, Param2)
+ internal AnonymousClassWith3(IndexWriter enclosingInstance, Lucene.Net.Store.Lock Param1, long Param2):base(Param1, Param2)
{
- InitBlock(segmentsToDelete, enclosingInstance);
+ InitBlock(enclosingInstance);
}
public override System.Object DoBody()
{
Enclosing_Instance.segmentInfos.Write(Enclosing_Instance.directory); // commit before deleting
- Enclosing_Instance.DeleteSegments(segmentsToDelete); // delete now-unused segments
return null;
}
}
private class AnonymousClassWith4 : Lock.With
{
- private void InitBlock(System.String mergedName, System.Collections.ArrayList filesToDelete, IndexWriter enclosingInstance)
- {
+ private void InitBlock(System.String mergedName, IndexWriter enclosingInstance)
+ {
this.mergedName = mergedName;
- this.filesToDelete = filesToDelete;
this.enclosingInstance = enclosingInstance;
}
private System.String mergedName;
- private System.Collections.ArrayList filesToDelete;
private IndexWriter enclosingInstance;
public IndexWriter Enclosing_Instance
{
@@ -188,16 +176,14 @@
}
}
- internal AnonymousClassWith4(System.String mergedName, System.Collections.ArrayList filesToDelete, IndexWriter enclosingInstance, Lucene.Net.Store.Lock Param1, long Param2):base(Param1, Param2)
- {
- InitBlock(mergedName, filesToDelete, enclosingInstance);
- }
+ internal AnonymousClassWith4(System.String mergedName, IndexWriter enclosingInstance, Lucene.Net.Store.Lock Param1, long Param2) : base(Param1, Param2)
+ {
+ InitBlock(mergedName, enclosingInstance);
+ }
public override System.Object DoBody()
{
// make compound file visible for SegmentReaders
Enclosing_Instance.directory.RenameFile(mergedName + ".tmp", mergedName + ".cfs");
- // delete now unused files of segment
- Enclosing_Instance.DeleteFiles(filesToDelete);
return null;
}
}
@@ -206,13 +192,17 @@
similarity = Similarity.GetDefault();
}
- /// <summary> Default value is 1,000.</summary>
- public const long WRITE_LOCK_TIMEOUT = 1000;
+ /// <summary> Default value for the write lock timeout (1,000).</summary>
+ public const long WRITE_LOCK_TIMEOUT = 1000;
+
+ private long writeLockTimeout = WRITE_LOCK_TIMEOUT;
- /// <summary> Default value is 10,000.</summary>
- public const long COMMIT_LOCK_TIMEOUT = 10000;
+ /// <summary> Default value for the commit lock timeout (10,000).</summary>
+ public const long COMMIT_LOCK_TIMEOUT = 10000;
- public const System.String WRITE_LOCK_NAME = "write.lock";
+ private long commitLockTimeout = COMMIT_LOCK_TIMEOUT;
+
+ public const System.String WRITE_LOCK_NAME = "write.lock";
public const System.String COMMIT_LOCK_NAME = "commit.lock";
/// <summary> Default value is 10. Change using {@link #SetMergeFactor(int)}.</summary>
@@ -221,10 +211,6 @@
/// <summary> Default value is 10. Change using {@link #SetMaxBufferedDocs(int)}.</summary>
public const int DEFAULT_MAX_BUFFERED_DOCS = 10;
- /// <deprecated> use {@link #DEFAULT_MAX_BUFFERED_DOCS} instead
- /// </deprecated>
- public static readonly int DEFAULT_MIN_MERGE_DOCS = DEFAULT_MAX_BUFFERED_DOCS;
-
/// <summary> Default value is {@link Integer#MAX_VALUE}. Change using {@link #SetMaxMergeDocs(int)}.</summary>
public static readonly int DEFAULT_MAX_MERGE_DOCS = System.Int32.MaxValue;
@@ -404,7 +390,7 @@
analyzer = a;
Lock writeLock = directory.MakeLock(IndexWriter.WRITE_LOCK_NAME);
- if (!writeLock.Obtain(WRITE_LOCK_TIMEOUT))
+ if (!writeLock.Obtain(writeLockTimeout))
// obtain write lock
{
throw new System.IO.IOException("Index locked for write: " + writeLock);
@@ -414,7 +400,7 @@
lock (directory)
{
// in- & inter-process sync
- new AnonymousClassWith(create, this, directory.MakeLock(IndexWriter.COMMIT_LOCK_NAME), COMMIT_LOCK_TIMEOUT).Run();
+ new AnonymousClassWith(create, this, directory.MakeLock(IndexWriter.COMMIT_LOCK_NAME), commitLockTimeout).Run();
}
}
@@ -522,8 +508,34 @@
{
return infoStream;
}
+
+ /// <summary> Sets the maximum time to wait for a commit lock (in milliseconds).</summary>
+ public virtual void SetCommitLockTimeout(long commitLockTimeout)
+ {
+ this.commitLockTimeout = commitLockTimeout;
+ }
+
+ /// <seealso cref="setCommitLockTimeout">
+ /// </seealso>
+ public virtual long GetCommitLockTimeout()
+ {
+ return commitLockTimeout;
+ }
+
+ /// <summary> Sets the maximum time to wait for a write lock (in milliseconds).</summary>
+ public virtual void SetWriteLockTimeout(long writeLockTimeout)
+ {
+ this.writeLockTimeout = writeLockTimeout;
+ }
+
+ /// <seealso cref="#setWriteLockTimeout">
+ /// </seealso>
+ public virtual long GetWriteLockTimeout()
+ {
+ return writeLockTimeout;
+ }
- /// <summary>Flushes all changes to an index and closes all associated files. </summary>
+ /// <summary>Flushes all changes to an index and closes all associated files. </summary>
public virtual void Close()
{
lock (this)
@@ -562,9 +574,7 @@
{
return analyzer;
}
-
-
- /// <summary>Returns the number of documents currently in this index. </summary>
+ /// <summary>Returns the number of documents currently in this index. </summary>
public virtual int DocCount()
{
lock (this)
@@ -591,9 +601,7 @@
/// By default, no more than 10,000 terms will be indexed for a field.
///
/// </summary>
- /// <deprecated> use {@link #setMaxFieldLength} instead
- /// </deprecated>
- public int maxFieldLength = DEFAULT_MAX_FIELD_LENGTH;
+ private int maxFieldLength = DEFAULT_MAX_FIELD_LENGTH;
/// <summary> Adds a document to this index. If the document contains more than
/// {@link #SetMaxFieldLength(int)} terms for a given field, the remainder are
@@ -643,40 +651,32 @@
/// for batch index creation, and smaller values (< 10) for indices that are
/// interactively maintained.
///
- /// <p>This must never be less than 2. The default value is 10.
- /// </summary>
- /// <deprecated> use {@link #setMergeFactor} instead
- /// </deprecated>
- public int mergeFactor = DEFAULT_MERGE_FACTOR;
+ /// <p>This must never be less than 2. The default value is {@link #DEFAULT_MERGE_FACTOR}.
+ /// </summary>
+ private int mergeFactor = DEFAULT_MERGE_FACTOR;
/// <summary>Determines the minimal number of documents required before the buffered
/// in-memory documents are merging and a new Segment is created.
/// Since Documents are merged in a {@link Lucene.Net.store.RAMDirectory},
/// large value gives faster indexing. At the same time, mergeFactor limits
/// the number of files open in a FSDirectory.
- ///
- /// <p> The default value is 10.
- /// </summary>
- /// <deprecated> use {@link #setMaxBufferedDocs} instead
- /// </deprecated>
- public int minMergeDocs = DEFAULT_MIN_MERGE_DOCS;
+ ///
+ /// <p> The default value is {@link #DEFAULT_MAX_BUFFERED_DOCS}.
+ /// </summary>
+ private int minMergeDocs = DEFAULT_MAX_BUFFERED_DOCS;
/// <summary>Determines the largest number of documents ever merged by addDocument().
/// Small values (e.g., less than 10,000) are best for interactive indexing,
/// as this limits the length of pauses while indexing to a few seconds.
/// Larger values are best for batched indexing and speedier searches.
- ///
- /// <p>The default value is {@link Integer#MAX_VALUE}.
- /// </summary>
- /// <deprecated> use {@link #setMaxMergeDocs} instead
- /// </deprecated>
- public int maxMergeDocs = DEFAULT_MAX_MERGE_DOCS;
-
- /// <summary>If non-null, information about merges will be printed to this.</summary>
- /// <deprecated> use {@link #setInfoStream} instead
- /// </deprecated>
- public System.IO.TextWriter infoStream = null;
+ ///
+ /// <p>The default value is {@link #DEFAULT_MAX_MERGE_DOCS}.
+ /// </summary>
+ private int maxMergeDocs = DEFAULT_MAX_MERGE_DOCS;
+
+ /// <summary>If non-null, information about merges will be printed to this.</summary>
+ private System.IO.TextWriter infoStream = null;
/// <summary>Merges all segments together into a single segment, optimizing an index
/// for search.
@@ -725,7 +725,7 @@
// merge newly added segments in log(n) passes
while (segmentInfos.Count > start + mergeFactor)
{
- for (int base_Renamed = start + 1; base_Renamed < segmentInfos.Count; base_Renamed++)
+ for (int base_Renamed = start; base_Renamed < segmentInfos.Count; base_Renamed++)
{
int end = System.Math.Min(segmentInfos.Count, base_Renamed + mergeFactor);
if (end - base_Renamed > 1)
@@ -767,7 +767,7 @@
int docCount = merger.Merge(); // merge 'em
- segmentInfos.RemoveRange(0, segmentInfos.Count - 0); // pop old infos & add new
+ segmentInfos.RemoveRange(0, segmentInfos.Count); // pop old infos & add new
segmentInfos.Add(new SegmentInfo(mergedName, docCount, directory));
if (sReader != null)
@@ -776,18 +776,23 @@
lock (directory)
{
// in- & inter-process sync
- new AnonymousClassWith1(segmentsToDelete, this, directory.MakeLock(COMMIT_LOCK_NAME), COMMIT_LOCK_TIMEOUT).Run();
- }
+ new AnonymousClassWith1(this, directory.MakeLock(COMMIT_LOCK_NAME), commitLockTimeout).Run();
+ }
+
+ DeleteSegments(segmentsToDelete); // delete now-unused segments
- if (useCompoundFile)
+ if (useCompoundFile)
{
System.Collections.ArrayList filesToDelete = merger.CreateCompoundFile(mergedName + ".tmp");
lock (directory)
{
// in- & inter-process sync
- new AnonymousClassWith2(mergedName, filesToDelete, this, directory.MakeLock(COMMIT_LOCK_NAME), COMMIT_LOCK_TIMEOUT).Run();
- }
- }
+ new AnonymousClassWith2(mergedName, this, directory.MakeLock(COMMIT_LOCK_NAME), commitLockTimeout).Run();
+ }
+
+ // delete now unused files of segment
+ DeleteFiles(filesToDelete);
+ }
}
}
@@ -872,10 +877,10 @@
infoStream.WriteLine(" into " + mergedName + " (" + mergedDocCount + " docs)");
}
- for (int i = end - 1; i >= minSegment; i--)
+ for (int i = end - 1; i > minSegment; i--)
// remove old infos & add new
segmentInfos.RemoveAt(i);
- segmentInfos.Add(new SegmentInfo(mergedName, mergedDocCount, directory));
+ segmentInfos[minSegment] = new SegmentInfo(mergedName, mergedDocCount, directory);
// close readers before we attempt to delete now-obsolete segments
merger.CloseReaders();
@@ -883,18 +888,23 @@
lock (directory)
{
// in- & inter-process sync
- new AnonymousClassWith3(segmentsToDelete, this, directory.MakeLock(COMMIT_LOCK_NAME), COMMIT_LOCK_TIMEOUT).Run();
- }
+ new AnonymousClassWith3(this, directory.MakeLock(COMMIT_LOCK_NAME), commitLockTimeout).Run();
+ }
+
+ DeleteSegments(segmentsToDelete); // delete now-unused segments
- if (useCompoundFile)
+ if (useCompoundFile)
{
System.Collections.ArrayList filesToDelete = merger.CreateCompoundFile(mergedName + ".tmp");
lock (directory)
{
// in- & inter-process sync
- new AnonymousClassWith4(mergedName, filesToDelete, this, directory.MakeLock(COMMIT_LOCK_NAME), COMMIT_LOCK_TIMEOUT).Run();
- }
- }
+ new AnonymousClassWith4(mergedName, this, directory.MakeLock(COMMIT_LOCK_NAME), commitLockTimeout).Run();
+ }
+
+ // delete now unused files of segment
+ DeleteFiles(filesToDelete);
+ }
}
/*