You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by cc...@apache.org on 2011/11/18 18:54:16 UTC
[Lucene.Net] svn commit: r1203769 [1/4] - in
/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk: src/core/
src/core/Analysis/ src/core/Document/ src/core/Messages/
src/core/QueryParser/ src/core/Search/ src/core/Search/Function/
src/core/Search/Payloads/ src/cor...
Author: ccurrens
Date: Fri Nov 18 17:54:13 2011
New Revision: 1203769
URL: http://svn.apache.org/viewvc?rev=1203769&view=rev
Log:
ported changes to document, message, and search
Added:
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Support/
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Support/BigObject.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Support/CollisionTester.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Support/SmallObject.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Support/TestCase.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Support/TestCloseableThreadLocal.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Support/TestEquatableList.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Support/TestHashMap.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Support/TestIDisposable.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Support/TestLRUCache.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Support/TestOSClass.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Support/TestOldPatches.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Support/TestSerialization.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Support/TestSupportClass.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Support/TestThreadClass.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Support/TestWeakHashTable.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Support/TestWeakHashTableBehavior.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Support/TestWeakHashTableMultiThreadAccess.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Support/TestWeakHashTablePerformance.cs
Removed:
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/QueryFilter.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/RangeFilter.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/RangeQuery.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/SortComparator.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/SortComparatorSource.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/TestSupportClass.cs
Modified:
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Analysis/NumericTokenStream.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/ChangeNotes.txt
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Document/DateField.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Document/DateTools.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Document/FieldSelectorResult.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Document/MapFieldSelector.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Document/NumberTools.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Document/NumericField.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/FileDiffs.txt
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Lucene.Net.csproj
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Messages/MessageImpl.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Messages/NLS.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/QueryParser/CharStream.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/QueryParser/ParseException.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/QueryParser/QueryParser.JJ
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/QueryParser/Token.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/QueryParser/TokenMgrError.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Collector.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/ConstantScoreRangeQuery.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/DefaultSimilarity.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/DocIdSetIterator.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FieldCache.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FieldCacheImpl.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FieldCacheRangeFilter.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FieldComparator.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FieldDoc.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Filter.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FilterManager.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Function/FieldCacheSource.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Function/OrdFieldSource.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Function/ReverseOrdFieldSource.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/MultiTermQuery.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/MultiTermQueryWrapperFilter.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/NumericRangeFilter.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/NumericRangeQuery.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Payloads/PayloadNearQuery.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Payloads/PayloadTermQuery.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/PrefixFilter.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/PrefixQuery.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Query.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/QueryWrapperFilter.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Spans/NearSpansUnordered.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TermRangeFilter.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TermRangeQuery.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Support/HashMap.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Util/NumericUtils.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Index/TestPositionBasedTermVectorMapper.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Lucene.Net.Test.csproj
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Messages/MessagesTestBundle.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestMultiValuedNumericRangeQuery.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestNumericRangeQuery32.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestNumericRangeQuery64.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Store/TestMultiMMap.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/UpdatedTests.txt
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Analysis/NumericTokenStream.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Analysis/NumericTokenStream.cs?rev=1203769&r1=1203768&r2=1203769&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Analysis/NumericTokenStream.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Analysis/NumericTokenStream.cs Fri Nov 18 17:54:13 2011
@@ -16,15 +16,10 @@
*/
using System;
-
+using Lucene.Net.Search;
using AttributeSource = Lucene.Net.Util.AttributeSource;
using NumericUtils = Lucene.Net.Util.NumericUtils;
using NumericField = Lucene.Net.Documents.NumericField;
-// for javadocs
-using NumericRangeQuery = Lucene.Net.Search.NumericRangeQuery;
-using NumericRangeFilter = Lucene.Net.Search.NumericRangeFilter;
-using SortField = Lucene.Net.Search.SortField;
-using FieldCache = Lucene.Net.Search.FieldCache;
// javadocs
using TermAttribute = Lucene.Net.Analysis.Tokenattributes.TermAttribute;
using TypeAttribute = Lucene.Net.Analysis.Tokenattributes.TypeAttribute;
@@ -34,8 +29,8 @@ namespace Lucene.Net.Analysis
{
/// <summary> <b>Expert:</b> This class provides a <see cref="TokenStream" />
- /// for indexing numeric values that can be used by <see cref="NumericRangeQuery" />
- /// or <see cref="NumericRangeFilter" />.
+ /// for indexing numeric values that can be used by <see cref="NumericRangeQuery{T}" />
+ /// or <see cref="NumericRangeFilter{T}" />.
///
/// <p/>Note that for simple usage, <see cref="NumericField" /> is
/// recommended. <see cref="NumericField" /> disables norms and
@@ -81,7 +76,7 @@ namespace Lucene.Net.Analysis
/// than one numeric field, use a separate <c>NumericTokenStream</c>
/// instance for each.<p/>
///
- /// <p/>See <see cref="NumericRangeQuery" /> for more details on the
+ /// <p/>See <see cref="NumericRangeQuery{T}" /> for more details on the
/// <a href="../search/NumericRangeQuery.html#precisionStepDesc"><c>precisionStep</c></a>
/// parameter as well as how numeric fields work under the hood.<p/>
///
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/ChangeNotes.txt
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/ChangeNotes.txt?rev=1203769&r1=1203768&r2=1203769&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/ChangeNotes.txt (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/ChangeNotes.txt Fri Nov 18 17:54:13 2011
@@ -43,18 +43,17 @@ TODO: MMapDirectory.java -> ThreadInterr
TODO: NIOFSDirectory.java
TODO: RAMDirectory.java
-Util, Store (All files touched - Any that are present in 3.0.3 still need to be added)
-TODO: BooleanClause.java - Can't override tostring on Enum. Leave type-safe or override with extension method?
+TODO: BooleanClause.java - Can't override ToString on Enum or replace with Extension Method. Leave type-safe, override with extension method, or create static class?
TODO: FieldValueHitQueue.Entry had to be made public for accessibility. Look further into that.
TODO: FuzzyQuery - uses java.util.PriorityQueue<T>, which .net does not have. Revisit later.
-TODO: ParallelReader - extra data types, TreeMap<Tk,Tv>
+TODO: ParallelReader - extra data types, using SortedDictionary in place of TreeMap. Confirm compatibility.
-TODO: SegmentInfos inherites from Vector<E>, which is threadsafe. Closest equivelant is SynchronizedCollection<T> in .NET, but it's in a System.ServiceModel, and I can't be sure it's worth a dependency on that entire assembly for the one class. Thread safety can probably be achieved in a different way.
+TODO: SegmentInfos inherites from java.util.Vector<E>, which is threadsafe. Closest equivelant is SynchronizedCollection<T> in .NET, but it's in a System.ServiceModel, and I can't be sure it's worth a dependency on that entire assembly for the one class. Thread safety can probably be achieved in a different way.
TODO: ThreadInterruptedException.java - This shouldn't be necessary. Lucene is using it because it is unchecked. C# has no checked expcetions
TODO: FSDirectory.java - ThreadInterruptedException
TODO: ConcurrentMergeScheduler - ThreadInterruptedException
CHANGED: FieldCacheRangeFilter - Expects nullable primitives for the anonymous range filters<T> -> replaced with Nulable<T>
-CONFIRM: IndexWriter.java - ReaderPool.Close/Commit/Get lock/sync changes - may be wrong - ThreadInterruptedException(ie)
+CONFIRM: IndexWriter.java - ReaderPool.Close/Commit/Get lock/sync changes - may be wrong, probably are ok - ThreadInterruptedException(ie)
CONFIRM: Java LinkedList behavior compared to C#. Used extensively in Attributes, filters and the like
\ No newline at end of file
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Document/DateField.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Document/DateField.cs?rev=1203769&r1=1203768&r2=1203769&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Document/DateField.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Document/DateField.cs Fri Nov 18 17:54:13 2011
@@ -16,9 +16,9 @@
*/
using System;
+using Lucene.Net.Search;
using Lucene.Net.Support;
using NumericUtils = Lucene.Net.Util.NumericUtils;
-using NumericRangeQuery = Lucene.Net.Search.NumericRangeQuery;
using PrefixQuery = Lucene.Net.Search.PrefixQuery;
using TermRangeQuery = Lucene.Net.Search.TermRangeQuery;
// for javadoc
@@ -51,7 +51,7 @@ namespace Lucene.Net.Documents
/// For indexing a <see cref="DateTime" />, convert it to unix timestamp as
/// <c>long</c> and
/// index this as a numeric value with <see cref="NumericField" />
- /// and use <see cref="NumericRangeQuery" /> to query it.
+ /// and use <see cref="NumericRangeQuery{T}" /> to query it.
///
/// </summary>
/// <deprecated> If you build a new index, use <see cref="DateTools" /> or
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Document/DateTools.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Document/DateTools.cs?rev=1203769&r1=1203768&r2=1203769&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Document/DateTools.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Document/DateTools.cs Fri Nov 18 17:54:13 2011
@@ -16,9 +16,8 @@
*/
using System;
-
+using Lucene.Net.Search;
using NumericUtils = Lucene.Net.Util.NumericUtils;
-using NumericRangeQuery = Lucene.Net.Search.NumericRangeQuery;
namespace Lucene.Net.Documents
{
@@ -43,7 +42,7 @@ namespace Lucene.Net.Documents
/// For indexing a <see cref="DateTime" />, convert it to unix timestamp as
/// <c>long</c> and
/// index this as a numeric value with <see cref="NumericField" />
- /// and use <see cref="NumericRangeQuery" /> to query it.
+ /// and use <see cref="NumericRangeQuery{T}" /> to query it.
/// </summary>
public class DateTools
{
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Document/FieldSelectorResult.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Document/FieldSelectorResult.cs?rev=1203769&r1=1203768&r2=1203769&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Document/FieldSelectorResult.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Document/FieldSelectorResult.cs Fri Nov 18 17:54:13 2011
@@ -24,6 +24,10 @@ namespace Lucene.Net.Documents
/// <summary>Provides information about what should be done with this Field</summary>
public enum FieldSelectorResult
{
+ /// <summary>
+ ///
+ /// </summary>
+ INVALID, // TODO: This is kinda a kludgy workaround for the fact enums can't be null
/// <summary> Load this <see cref="Field" /> every time the <see cref="Document" /> is loaded, reading in the data as it is encountered.
/// <see cref="Document.GetField(String)" /> and <see cref="Document.GetFieldable(String)" /> should not return null.
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Document/MapFieldSelector.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Document/MapFieldSelector.cs?rev=1203769&r1=1203768&r2=1203769&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Document/MapFieldSelector.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Document/MapFieldSelector.cs Fri Nov 18 17:54:13 2011
@@ -61,8 +61,8 @@ namespace Lucene.Net.Documents
/// </returns>
public virtual FieldSelectorResult Accept(System.String field)
{
- FieldSelectorResult selection = fieldSelections[field];
- return selection != null?selection:FieldSelectorResult.NO_LOAD;
+ FieldSelectorResult selection = fieldSelections[field];
+ return selection != FieldSelectorResult.INVALID ? selection : FieldSelectorResult.NO_LOAD; // TODO: See FieldSelectorResult
}
}
}
\ No newline at end of file
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Document/NumberTools.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Document/NumberTools.cs?rev=1203769&r1=1203768&r2=1203769&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Document/NumberTools.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Document/NumberTools.cs Fri Nov 18 17:54:13 2011
@@ -16,9 +16,8 @@
*/
using System;
-
+using Lucene.Net.Search;
using NumericUtils = Lucene.Net.Util.NumericUtils;
-using NumericRangeQuery = Lucene.Net.Search.NumericRangeQuery;
namespace Lucene.Net.Documents
{
@@ -42,7 +41,7 @@ namespace Lucene.Net.Documents
/// provides a sortable binary representation (prefix encoded) of numeric
/// values.
/// To index and efficiently query numeric values use <see cref="NumericField" />
- /// and <see cref="NumericRangeQuery" />.
+ /// and <see cref="NumericRangeQuery{T}" />.
/// This class is included for use with existing
/// indices and will be removed in a future release (possibly Lucene 4.0).
/// </deprecated>
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Document/NumericField.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Document/NumericField.cs?rev=1203769&r1=1203768&r2=1203769&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Document/NumericField.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Document/NumericField.cs Fri Nov 18 17:54:13 2011
@@ -16,13 +16,11 @@
*/
using System;
-
+using Lucene.Net.Search;
using NumericTokenStream = Lucene.Net.Analysis.NumericTokenStream;
using TokenStream = Lucene.Net.Analysis.TokenStream;
using NumericUtils = Lucene.Net.Util.NumericUtils;
using FieldCache = Lucene.Net.Search.FieldCache;
-using NumericRangeFilter = Lucene.Net.Search.NumericRangeFilter;
-using NumericRangeQuery = Lucene.Net.Search.NumericRangeQuery;
using SortField = Lucene.Net.Search.SortField;
namespace Lucene.Net.Documents
@@ -67,7 +65,7 @@ namespace Lucene.Net.Documents
/// <c>long</c> value.<p/>
///
/// <p/>To perform range querying or filtering against a
- /// <c>NumericField</c>, use <see cref="NumericRangeQuery" /> or <see cref="NumericRangeFilter" />
+ /// <c>NumericField</c>, use <see cref="NumericRangeQuery{T}" /> or <see cref="NumericRangeFilter{T}" />
///. To sort according to a
/// <c>NumericField</c>, use the normal numeric sort types, eg
/// <see cref="SortField.INT" /> <c>NumericField</c> values
@@ -105,8 +103,8 @@ namespace Lucene.Net.Documents
/// use the expert constructor <see cref="NumericField(String,int,Field.Store,bool)" />
/// if you'd
/// like to change the value. Note that you must also
- /// specify a congruent value when creating <see cref="NumericRangeQuery" />
- /// or <see cref="NumericRangeFilter" />.
+ /// specify a congruent value when creating <see cref="NumericRangeQuery{T}" />
+ /// or <see cref="NumericRangeFilter{T}" />.
/// For low cardinality fields larger precision steps are good.
/// If the cardinality is < 100, it is fair
/// to use <see cref="int.MaxValue" />, which produces one
@@ -115,7 +113,7 @@ namespace Lucene.Net.Documents
/// <p/>For more information on the internals of numeric trie
/// indexing, including the <a
/// href="../search/NumericRangeQuery.html#precisionStepDesc"><c>precisionStep</c></a>
- /// configuration, see <see cref="NumericRangeQuery" />. The format of
+ /// configuration, see <see cref="NumericRangeQuery{T}" />. The format of
/// indexed values is described in <see cref="NumericUtils" />.
///
/// <p/>If you only need to sort by numeric value, and never
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/FileDiffs.txt
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/FileDiffs.txt?rev=1203769&r1=1203768&r2=1203769&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/FileDiffs.txt (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/FileDiffs.txt Fri Nov 18 17:54:13 2011
@@ -215,106 +215,106 @@ index\
messages\
messages\Message.java - IDENTICAL
- messages\MessageImpl.java - Text files are different
- messages\NLS.java - Text files are different
+ messages\MessageImpl.java - PORTED
+ messages\NLS.java - PORTED
messages\NLSException.java - IDENTICAL
messages\package.html - IDENTICAL
queryParser\
- queryParser\CharStream.java - Text files are different
+ queryParser\CharStream.java - PORTED
queryParser\FastCharStream.java - IDENTICAL
queryParser\MultiFieldQueryParser.java - PORTED
queryParser\package.html - IDENTICAL
- queryParser\ParseException.java - Text files are different
+ queryParser\ParseException.java - PORTED
queryParser\QueryParser.java - PORTED
- queryParser\QueryParser.jj - Text files are different
+ queryParser\QueryParser.jj - PORTED
queryParser\QueryParserConstants.java - IDENTICAL
- queryParser\QueryParserTokenManager.java - Text files are different
- queryParser\Token.java - Text files are different
- queryParser\TokenMgrError.java - Text files are different
+ queryParser\QueryParserTokenManager.java - PORTED
+ queryParser\Token.java - PORTED
+ queryParser\TokenMgrError.java - PORTED
search\function\
- search\function\ByteFieldSource.java - Text files are different
+ search\function\ByteFieldSource.java - PORTED
search\function\CustomScoreProvider.java - IDENTICAL
search\function\CustomScoreQuery.java - PORTED
search\function\DocValues.java - IDENTICAL
- search\function\FieldCacheSource.java - Text files are different
- search\function\FieldScoreQuery.java - Text files are different
- search\function\FloatFieldSource.java - Text files are different
- search\function\IntFieldSource.java - Text files are different
+ search\function\FieldCacheSource.java - PORTED
+ search\function\FieldScoreQuery.java - PORTED
+ search\function\FloatFieldSource.java - PORTED
+ search\function\IntFieldSource.java - PORTED
search\function\MultiValueSource.java - Removed in 3.x
- search\function\OrdFieldSource.java - Text files are different
+ search\function\OrdFieldSource.java - PORTED
search\function\package.html - IDENTICAL
- search\function\ReverseOrdFieldSource.java - Text files are different
- search\function\ShortFieldSource.java - Text files are different
- search\function\ValueSource.java - Text files are different
+ search\function\ReverseOrdFieldSource.java - PORTED
+ search\function\ShortFieldSource.java - PORTED
+ search\function\ValueSource.java - PORTED
search\function\ValueSourceQuery.java - PORTED
search\payloads\
- search\payloads\AveragePayloadFunction.java - Text files are different
+ search\payloads\AveragePayloadFunction.java - PORTED
search\payloads\BoostingTermQuery.java - Removed in 3.x
- search\payloads\MaxPayloadFunction.java - Text files are different
- search\payloads\MinPayloadFunction.java - Text files are different
+ search\payloads\MaxPayloadFunction.java - PORTED
+ search\payloads\MinPayloadFunction.java - PORTED
search\payloads\package.html - IDENTICAL
- search\payloads\PayloadFunction.java - Text files are different
- search\payloads\PayloadNearQuery.java - Text files are different
+ search\payloads\PayloadFunction.java - PORTED
+ search\payloads\PayloadNearQuery.java - PORTED
search\payloads\PayloadSpanUtil.java - PORTED
- search\payloads\PayloadTermQuery.java - Text files are different
+ search\payloads\PayloadTermQuery.java - PORTED
search\spans\
search\spans\FieldMaskingSpanQuery.java - PORTED
search\spans\NearSpansOrdered.java - PORTED
- search\spans\NearSpansUnordered.java - Text files are different
+ search\spans\NearSpansUnordered.java - PORTED
search\spans\package.html - IDENTICAL
search\spans\SpanFirstQuery.java - PORTED
search\spans\SpanNearQuery.java - PORTED
search\spans\SpanNotQuery.java - PORTED
search\spans\SpanOrQuery.java - PORTED
search\spans\SpanQuery.java - PORTED
- search\spans\Spans.java - Text files are different
+ search\spans\Spans.java - PORTED
search\spans\SpanScorer.java - PORTED
search\spans\SpanTermQuery.java - PORTED
- search\spans\SpanWeight.java - Text files are different
- search\spans\TermSpans.java - Text files are different
+ search\spans\SpanWeight.java - PORTED
+ search\spans\TermSpans.java - PORTED
search
- BooleanClause.java - Text files are different
+ BooleanClause.java - Text files are different - Java Enum overrides ToString() -> illegal in .NET
BooleanQuery.java - PORTED
- BooleanScorer.java - Text files are different
+ BooleanScorer.java - PORTED
BooleanScorer2.java - PORTED
CachingSpanFilter.java - PORTED
CachingWrapperFilter.java - PORTED
- Collector.java - Text files are different
- ComplexExplanation.java - Text files are different
+ Collector.java - PORTED
+ ComplexExplanation.java - PORTED
ConjunctionScorer.java - PORTED
ConstantScoreQuery.java - PORTED
ConstantScoreRangeQuery.java - Removed in 3.x
- DefaultSimilarity.java - Text files are different
+ DefaultSimilarity.java - PORTED
DisjunctionMaxQuery.java - PORTED
DisjunctionMaxScorer.java - PORTED
DisjunctionSumScorer.java - PORTED
- DocIdSet.java - Text files are different
- DocIdSetIterator.java - Text files are different
+ DocIdSet.java - PORTED
+ DocIdSetIterator.java - PORTED
ExactPhraseScorer.java - PORTED
Explanation.java - PORTED
ExtendedFieldCache.java - Removed in 3.x
- FieldCache.java - Text files are different
- FieldCacheImpl.java - Text files are different
+ FieldCache.java - PORTED
+ FieldCacheImpl.java - PORTED
FieldCacheRangeFilter.java - PORTED
FieldCacheTermsFilter.java - PORTED
- FieldComparator.java - Text files are different
+ FieldComparator.java - PORTED
FieldComparatorSource.java - IDENTICAL
- FieldDoc.java - Text files are different
+ FieldDoc.java - PORTED
FieldDocSortedHitQueue.java - PORTED
FieldSortedHitQueue.java - Removed in 3.x
FieldValueHitQueue.java - PORTED
- Filter.java - Text files are different
- FilteredDocIdSet.java - Text files are different
+ Filter.java - PORTED
+ FilteredDocIdSet.java - PORTED
FilteredDocIdSetIterator.java - PORTED
FilteredQuery.java - PORTED
FilteredTermEnum.java - PORTED
- FilterManager.java - Text files are different
- FuzzyQuery.java - Text files are different
+ FilterManager.java - PORTED
+ FuzzyQuery.java - Text files are different -> Uses java.util.PriorityQueue. Is there a .NET equivalant?
FuzzyTermEnum.java - Text files are different
Hit.java - Removed in 3.x
HitCollector.java - Removed in 3.x
@@ -326,10 +326,10 @@ search
MatchAllDocsQuery.java - PORTED
MultiPhraseQuery.java - PORTED
MultiSearcher.java - PORTED * Double check on MultiSearcherCallableNoSort/Sort, use of new Object() rather than dummy lock. Shouldn't make a difference, seems to be used because ParallelMultiSearcher uses a ReEntrantLock instead of synchronized
- MultiTermQuery.java - Text files are different
- MultiTermQueryWrapperFilter.java - Text files are different
- NumericRangeFilter.java - Text files are different
- NumericRangeQuery.java - Text files are different
+ MultiTermQuery.java - PORTED
+ MultiTermQueryWrapperFilter.java - PORTED
+ NumericRangeFilter.java - PORTED
+ NumericRangeQuery.java - PORTED
package.html - Text files are different
ParallelMultiSearcher.java - PORTED
PhrasePositions.java - IDENTICAL
@@ -337,13 +337,13 @@ search
PhraseQueue.java - PORTED
PhraseScorer.java - PORTED
PositiveScoresOnlyCollector.java - Text files are different
- PrefixFilter.java - Text files are different
- PrefixQuery.java - Text files are different
+ PrefixFilter.java - PORTED
+ PrefixQuery.java - PORTED
PrefixTermEnum.java - Text files are different
Query.java - PORTED
QueryFilter.java - Removed in 3.x
QueryTermVector.java - Text files are different
- QueryWrapperFilter.java - Text files are different
+ QueryWrapperFilter.java - PORTED
RangeFilter.java - Removed in 3.x
RangeQuery.java - Removed in 3.x
ReqExclScorer.java - PORTED
@@ -366,7 +366,7 @@ search
SpanFilterResult.java - Text files are different
SpanQueryFilter.java - Text files are different
TermQuery.java - PORTED
- TermRangeFilter.java - Text files are different
+ TermRangeFilter.java - PORTED
TermRangeQuery.java - Text files are different
TermRangeTermEnum.java - Text files are different
TermScorer.java - PORTED
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Lucene.Net.csproj
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Lucene.Net.csproj?rev=1203769&r1=1203768&r2=1203769&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Lucene.Net.csproj (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Lucene.Net.csproj Fri Nov 18 17:54:13 2011
@@ -678,12 +678,6 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="Search\QueryWrapperFilter.cs" />
- <Compile Include="Search\RangeFilter.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Search\RangeQuery.cs">
- <SubType>Code</SubType>
- </Compile>
<Compile Include="Search\ReqExclScorer.cs">
<SubType>Code</SubType>
</Compile>
@@ -719,12 +713,6 @@
<Compile Include="Search\Sort.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="Search\SortComparator.cs">
- <SubType>Code</SubType>
- </Compile>
- <Compile Include="Search\SortComparatorSource.cs">
- <SubType>Code</SubType>
- </Compile>
<Compile Include="Search\SortField.cs">
<SubType>Code</SubType>
</Compile>
@@ -970,7 +958,6 @@
<None Include="Lucene.Net.Search.RemoteSearchable.config" />
<None Include="Lucene.Net.Search.TestSort.config" />
<None Include="Lucene.Net.snk" />
- <None Include="QueryParser\QueryParser.jj" />
<Content Include="Analysis\Package.html" />
<Content Include="Analysis\Standard\Package.html" />
<Content Include="Analysis\Standard\READ_BEFORE_REGENERATING.txt" />
@@ -988,6 +975,7 @@
<Content Include="Search\Spans\Package.html" />
<Content Include="Store\Package.html" />
<Content Include="Util\Package.html" />
+ <None Include="QueryParser\QueryParser.jj" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0">
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Messages/MessageImpl.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Messages/MessageImpl.cs?rev=1203769&r1=1203768&r2=1203769&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Messages/MessageImpl.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Messages/MessageImpl.cs Fri Nov 18 17:54:13 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Text;
namespace Lucene.Net.Messages
{
@@ -38,7 +39,7 @@ namespace Lucene.Net.Messages
this.key = key;
}
- public MessageImpl(System.String key, System.Object[] args):this(key)
+ public MessageImpl(System.String key, params System.Object[] args):this(key)
{
this.arguments = args;
}
@@ -66,15 +67,15 @@ namespace Lucene.Net.Messages
public override System.String ToString()
{
System.Object[] args = GetArguments();
- System.String argsString = "";
+ StringBuilder argsString = new StringBuilder();
if (args != null)
{
for (int i = 0; i < args.Length; i++)
{
- argsString += (args[i] + (i < args.Length?"":", "));
+ argsString.Append(i == 0 ? " " : ", ").Append(args[i]);
}
}
- return GetKey() + " " + argsString;
+ return argsString.ToString();
}
}
}
\ No newline at end of file
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Messages/NLS.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Messages/NLS.cs?rev=1203769&r1=1203768&r2=1203769&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Messages/NLS.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Messages/NLS.cs Fri Nov 18 17:54:13 2011
@@ -16,6 +16,8 @@
*/
using System;
+using System.Collections.Generic;
+using Lucene.Net.Support;
namespace Lucene.Net.Messages
{
@@ -62,7 +64,7 @@ namespace Lucene.Net.Messages
}
}
- private static System.Collections.IDictionary bundles = new System.Collections.Hashtable(0);
+ private static IDictionary<string, Type> bundles = new HashMap<string, Type>(0);
protected internal NLS()
{
@@ -84,7 +86,7 @@ namespace Lucene.Net.Messages
return message.ToString();
}
- public static System.String GetLocalizedMessage(System.String key, System.Globalization.CultureInfo locale, System.Object[] args)
+ public static System.String GetLocalizedMessage(System.String key, System.Globalization.CultureInfo locale, params System.Object[] args)
{
System.String str = GetLocalizedMessage(key, locale);
@@ -110,13 +112,13 @@ namespace Lucene.Net.Messages
/// <param name="clazz">where constants will reside
/// </param>
//@SuppressWarnings("unchecked")
- protected internal static void InitializeMessages(System.String bundleName, System.Type clazz)
+ protected internal static void InitializeMessages<T>(System.String bundleName)
{
try
{
- Load(clazz);
- if (!bundles.Contains(bundleName))
- bundles[bundleName] = clazz;
+ Load<T>();
+ if (!bundles.ContainsKey(bundleName))
+ bundles[bundleName] = typeof(T);
}
catch (System.Exception e)
{
@@ -130,9 +132,9 @@ namespace Lucene.Net.Messages
// slow resource checking
// need to loop thru all registered resource bundles
- for (System.Collections.IEnumerator it = bundles.Keys.GetEnumerator(); it.MoveNext(); )
+ for (var it = bundles.Keys.GetEnumerator(); it.MoveNext(); )
{
- System.Type clazz = (System.Type) bundles[(System.String) it.Current];
+ System.Type clazz = bundles[it.Current];
System.Threading.Thread.CurrentThread.CurrentUICulture = locale;
System.Resources.ResourceManager resourceBundle = System.Resources.ResourceManager.CreateFileBasedResourceManager(clazz.Name, "Messages", null); //{{Lucene.Net-2.9.1}} Can we make resourceDir "Messages" more general?
if (resourceBundle != null)
@@ -153,31 +155,28 @@ namespace Lucene.Net.Messages
return null;
}
- /// <param name="clazz">
- /// </param>
- private static void Load(System.Type clazz)
+ private static void Load<T>()
{
- System.Reflection.FieldInfo[] fieldArray = clazz.GetFields(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.DeclaredOnly | System.Reflection.BindingFlags.Static);
+ var clazz = typeof (T);
+ System.Reflection.FieldInfo[] fieldArray = clazz.GetFields(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.DeclaredOnly | System.Reflection.BindingFlags.Static);
bool isFieldAccessible = clazz.IsPublic;
// build a map of field names to Field objects
int len = fieldArray.Length;
- System.Collections.IDictionary fields = new System.Collections.Hashtable(len * 2);
+ var fields = new HashMap<string, System.Reflection.FieldInfo>(len * 2);
for (int i = 0; i < len; i++)
{
fields[fieldArray[i].Name] = fieldArray[i];
- LoadfieldValue(fieldArray[i], isFieldAccessible, clazz);
+ LoadfieldValue<T>(fieldArray[i], isFieldAccessible);
}
}
- /// <param name="field">
- /// </param>
- /// <param name="isFieldAccessible">
- /// </param>
- /// <param name="clazz"></param>
- private static void LoadfieldValue(System.Reflection.FieldInfo field, bool isFieldAccessible, System.Type clazz)
- {
+ /// <param name="field"></param>
+ /// <param name="isFieldAccessible"></param>
+ private static void LoadfieldValue<T>(System.Reflection.FieldInfo field, bool isFieldAccessible)
+ {
+ var clazz = typeof (T);
/*
int MOD_EXPECTED = Modifier.PUBLIC | Modifier.STATIC;
int MOD_MASK = MOD_EXPECTED | Modifier.FINAL;
@@ -193,7 +192,7 @@ namespace Lucene.Net.Messages
try
{
field.SetValue(null, field.Name);
- ValidateMessage(field.Name, clazz);
+ ValidateMessage<T>(field.Name);
}
catch (System.ArgumentException e)
{
@@ -207,9 +206,10 @@ namespace Lucene.Net.Messages
/// <param name="key">- Message Key
/// </param>
- private static void ValidateMessage(System.String key, System.Type clazz)
+ private static void ValidateMessage<T>(System.String key)
{
// Test if the message is present in the resource bundle
+ var clazz = typeof (T);
try
{
System.Threading.Thread.CurrentThread.CurrentUICulture = System.Threading.Thread.CurrentThread.CurrentCulture;
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/QueryParser/CharStream.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/QueryParser/CharStream.cs?rev=1203769&r1=1203768&r2=1203769&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/QueryParser/CharStream.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/QueryParser/CharStream.cs Fri Nov 18 17:54:13 2011
@@ -121,5 +121,5 @@ namespace Lucene.Net.QueryParsers
/// </summary>
void Done();
}
- /* JavaCC - OriginalChecksum=a83909a2403f969f94d18375f9f143e4 (do not edit this line) */
+ /* JavaCC - OriginalChecksum=32a89423891f765dde472f7ef0e3ef7b (do not edit this line) */
}
\ No newline at end of file
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/QueryParser/ParseException.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/QueryParser/ParseException.cs?rev=1203769&r1=1203768&r2=1203769&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/QueryParser/ParseException.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/QueryParser/ParseException.cs Fri Nov 18 17:54:13 2011
@@ -240,5 +240,5 @@ namespace Lucene.Net.QueryParsers
return retval.ToString();
}
}
- /* JavaCC - OriginalChecksum=c63b396885c4ff44d7aa48d3feae60cd (do not edit this line) */
+ /* JavaCC - OriginalChecksum=c7631a240f7446940695eac31d9483ca (do not edit this line) */
}
\ No newline at end of file
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/QueryParser/QueryParser.JJ
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/QueryParser/QueryParser.JJ?rev=1203769&r1=1203768&r2=1203769&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/QueryParser/QueryParser.JJ (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/QueryParser/QueryParser.JJ Fri Nov 18 17:54:13 2011
@@ -36,7 +36,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
-import java.util.Vector;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.CachingTokenFilter;
@@ -58,7 +57,6 @@ import org.apache.lucene.search.Query;
import org.apache.lucene.search.TermRangeQuery;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.search.WildcardQuery;
-import org.apache.lucene.util.Parameter;
import org.apache.lucene.util.Version;
/**
@@ -170,7 +168,7 @@ public class QueryParser {
// the default date resolution
DateTools.Resolution dateResolution = null;
// maps field names to date resolutions
- Map fieldToDateResolution = null;
+ Map<String,DateTools.Resolution> fieldToDateResolution = null;
// The collator to use when determining range inclusion,
// for use when constructing RangeQuerys.
@@ -179,23 +177,7 @@ public class QueryParser {
/** The default operator for parsing queries.
* Use {@link QueryParser#setDefaultOperator} to change it.
*/
- static public final class Operator extends Parameter {
- private Operator(String name) {
- super(name);
- }
- static public final Operator OR = new Operator("OR");
- static public final Operator AND = new Operator("AND");
- }
-
-
- /** Constructs a query parser.
- * @param f the default field for query terms.
- * @param a used to find terms in the query text.
- * @deprecated Use {@link #QueryParser(Version, String, Analyzer)} instead
- */
- public QueryParser(String f, Analyzer a) {
- this(Version.LUCENE_24, f, a);
- }
+ static public enum Operator { OR, AND }
/** Constructs a query parser.
* @param matchVersion Lucene version to match. See {@link <a href="#version">above</a>)
@@ -384,29 +366,6 @@ public class QueryParser {
}
/**
- * @deprecated Please use {@link #setMultiTermRewriteMethod} instead.
- */
- public void setUseOldRangeQuery(boolean useOldRangeQuery) {
- if (useOldRangeQuery) {
- setMultiTermRewriteMethod(MultiTermQuery.SCORING_BOOLEAN_QUERY_REWRITE);
- } else {
- setMultiTermRewriteMethod(MultiTermQuery.CONSTANT_SCORE_AUTO_REWRITE_DEFAULT);
- }
- }
-
-
- /**
- * @deprecated Please use {@link #getMultiTermRewriteMethod} instead.
- */
- public boolean getUseOldRangeQuery() {
- if (getMultiTermRewriteMethod() == MultiTermQuery.SCORING_BOOLEAN_QUERY_REWRITE) {
- return true;
- } else {
- return false;
- }
- }
-
- /**
* By default QueryParser uses {@link MultiTermQuery#CONSTANT_SCORE_AUTO_REWRITE_DEFAULT}
* when creating a PrefixQuery, WildcardQuery or RangeQuery. This implementation is generally preferable because it
* a) Runs faster b) Does not have the scarcity of terms unduly influence score
@@ -466,7 +425,7 @@ public class QueryParser {
if (fieldToDateResolution == null) {
// lazily initialize HashMap
- fieldToDateResolution = new HashMap();
+ fieldToDateResolution = new HashMap<String,DateTools.Resolution>();
}
fieldToDateResolution.put(fieldName, dateResolution);
@@ -488,7 +447,7 @@ public class QueryParser {
return this.dateResolution;
}
- DateTools.Resolution resolution = (DateTools.Resolution) fieldToDateResolution.get(fieldName);
+ DateTools.Resolution resolution = fieldToDateResolution.get(fieldName);
if (resolution == null) {
// no date resolutions set for the given field; return default date resolution instead
resolution = this.dateResolution;
@@ -521,20 +480,13 @@ public class QueryParser {
return rangeCollator;
}
- /**
- * @deprecated use {@link #addClause(List, int, int, Query)} instead.
- */
- protected void addClause(Vector clauses, int conj, int mods, Query q) {
- addClause((List) clauses, conj, mods, q);
- }
-
- protected void addClause(List clauses, int conj, int mods, Query q) {
+ protected void addClause(List<BooleanClause> clauses, int conj, int mods, Query q) {
boolean required, prohibited;
// If this term is introduced by AND, make the preceding term required,
// unless it's already prohibited
if (clauses.size() > 0 && conj == CONJ_AND) {
- BooleanClause c = (BooleanClause) clauses.get(clauses.size()-1);
+ BooleanClause c = clauses.get(clauses.size()-1);
if (!c.isProhibited())
c.setOccur(BooleanClause.Occur.MUST);
}
@@ -544,7 +496,7 @@ public class QueryParser {
// unless it's prohibited (that means we leave -a OR b but +a OR b-->a OR b)
// notice if the input is a OR b, first term is parsed as required; without
// this modification a OR b would parsed as +a OR b
- BooleanClause c = (BooleanClause) clauses.get(clauses.size()-1);
+ BooleanClause c = clauses.get(clauses.size()-1);
if (!c.isProhibited())
c.setOccur(BooleanClause.Occur.SHOULD);
}
@@ -607,10 +559,10 @@ public class QueryParser {
}
if (success) {
if (buffer.hasAttribute(TermAttribute.class)) {
- termAtt = (TermAttribute) buffer.getAttribute(TermAttribute.class);
+ termAtt = buffer.getAttribute(TermAttribute.class);
}
if (buffer.hasAttribute(PositionIncrementAttribute.class)) {
- posIncrAtt = (PositionIncrementAttribute) buffer.getAttribute(PositionIncrementAttribute.class);
+ posIncrAtt = buffer.getAttribute(PositionIncrementAttribute.class);
}
}
@@ -683,7 +635,7 @@ public class QueryParser {
// phrase query:
MultiPhraseQuery mpq = newMultiPhraseQuery();
mpq.setSlop(phraseSlop);
- List multiTerms = new ArrayList();
+ List<Term> multiTerms = new ArrayList<Term>();
int position = -1;
for (int i = 0; i < numTokens; i++) {
String term = null;
@@ -701,9 +653,9 @@ public class QueryParser {
if (positionIncrement > 0 && multiTerms.size() > 0) {
if (enablePositionIncrements) {
- mpq.add((Term[])multiTerms.toArray(new Term[0]),position);
+ mpq.add(multiTerms.toArray(new Term[0]),position);
} else {
- mpq.add((Term[])multiTerms.toArray(new Term[0]));
+ mpq.add(multiTerms.toArray(new Term[0]));
}
multiTerms.clear();
}
@@ -711,9 +663,9 @@ public class QueryParser {
multiTerms.add(new Term(field, term));
}
if (enablePositionIncrements) {
- mpq.add((Term[])multiTerms.toArray(new Term[0]),position);
+ mpq.add(multiTerms.toArray(new Term[0]),position);
} else {
- mpq.add((Term[])multiTerms.toArray(new Term[0]));
+ mpq.add(multiTerms.toArray(new Term[0]));
}
return mpq;
}
@@ -933,26 +885,8 @@ public class QueryParser {
*
* @return Resulting {@link Query} object.
* @exception ParseException throw in overridden method to disallow
- * @deprecated use {@link #getBooleanQuery(List)} instead
*/
- protected Query getBooleanQuery(Vector clauses) throws ParseException {
- return getBooleanQuery((List) clauses, false);
- }
-
- /**
- * Factory method for generating query, given a set of clauses.
- * By default creates a boolean query composed of clauses passed in.
- *
- * Can be overridden by extending classes, to modify query being
- * returned.
- *
- * @param clauses List that contains {@link BooleanClause} instances
- * to join.
- *
- * @return Resulting {@link Query} object.
- * @exception ParseException throw in overridden method to disallow
- */
- protected Query getBooleanQuery(List clauses) throws ParseException {
+ protected Query getBooleanQuery(List<BooleanClause> clauses) throws ParseException {
return getBooleanQuery(clauses, false);
}
@@ -969,37 +903,16 @@ public class QueryParser {
*
* @return Resulting {@link Query} object.
* @exception ParseException throw in overridden method to disallow
- * @deprecated use {@link #getBooleanQuery(List, boolean)} instead
- */
- protected Query getBooleanQuery(Vector clauses, boolean disableCoord)
- throws ParseException
- {
- return getBooleanQuery((List) clauses, disableCoord);
- }
-
- /**
- * Factory method for generating query, given a set of clauses.
- * By default creates a boolean query composed of clauses passed in.
- *
- * Can be overridden by extending classes, to modify query being
- * returned.
- *
- * @param clauses List that contains {@link BooleanClause} instances
- * to join.
- * @param disableCoord true if coord scoring should be disabled.
- *
- * @return Resulting {@link Query} object.
- * @exception ParseException throw in overridden method to disallow
*/
- protected Query getBooleanQuery(List clauses, boolean disableCoord)
+ protected Query getBooleanQuery(List<BooleanClause> clauses, boolean disableCoord)
throws ParseException
{
if (clauses.size()==0) {
return null; // all clause words were filtered away by the analyzer.
}
BooleanQuery query = newBooleanQuery(disableCoord);
- for (int i = 0; i < clauses.size(); i++) {
- query.add((BooleanClause)clauses.get(i));
+ for(final BooleanClause clause: clauses) {
+ query.add(clause);
}
return query;
}
@@ -1179,7 +1092,7 @@ public class QueryParser {
* expects to be escaped are escaped by a preceding <code>\</code>.
*/
public static String escape(String s) {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
// These characters are part of the query syntax and must be escaped
@@ -1310,7 +1223,7 @@ Query TopLevelQuery(String field) :
Query Query(String field) :
{
- List clauses = new ArrayList();
+ List<BooleanClause> clauses = new ArrayList<BooleanClause>();
Query q, firstQuery=null;
int conj, mods;
}
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/QueryParser/Token.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/QueryParser/Token.cs?rev=1203769&r1=1203768&r2=1203769&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/QueryParser/Token.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/QueryParser/Token.cs Fri Nov 18 17:54:13 2011
@@ -129,5 +129,5 @@ namespace Lucene.Net.QueryParsers
return NewToken(ofKind, null);
}
}
- /* JavaCC - OriginalChecksum=37b1923f964a5a434f5ea3d6952ff200 (do not edit this line) */
+ /* JavaCC - OriginalChecksum=c147cc166a7cf8812c7c39bc8c5eb868 (do not edit this line) */
}
\ No newline at end of file
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/QueryParser/TokenMgrError.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/QueryParser/TokenMgrError.cs?rev=1203769&r1=1203768&r2=1203769&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/QueryParser/TokenMgrError.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/QueryParser/TokenMgrError.cs Fri Nov 18 17:54:13 2011
@@ -165,5 +165,5 @@ namespace Lucene.Net.QueryParsers
{
}
}
- /* JavaCC - OriginalChecksum=55cddb2336a66b376c0bb59d916b326d (do not edit this line) */
+ /* JavaCC - OriginalChecksum=1c94e13236c7e0121e49427992341ee3 (do not edit this line) */
}
\ No newline at end of file
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Collector.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Collector.cs?rev=1203769&r1=1203768&r2=1203769&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Collector.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Collector.cs Fri Nov 18 17:54:13 2011
@@ -26,13 +26,6 @@ namespace Lucene.Net.Search
/// gather raw results from a search, and implement sorting
/// or custom result filtering, collation, etc. <p/>
///
- /// <p/>As of 2.9, this class replaces the deprecated
- /// HitCollector, and offers an API for efficient collection
- /// of hits across sequential <see cref="IndexReader" />s. <see cref="IndexSearcher" />
- /// advances the collector through each of the
- /// sub readers, in an arbitrary order. This results in a
- /// higher performance means of collection.<p/>
- ///
/// <p/>Lucene's core collectors are derived from Collector.
/// Likely your application can use one of these classes, or
/// subclass <see cref="TopDocsCollector" />, instead of
@@ -60,8 +53,7 @@ namespace Lucene.Net.Search
///
/// <item><see cref="TimeLimitingCollector" />, which wraps any other
/// Collector and aborts the search if it's taken too much
- /// time, will subclass Collector in 3.0 (presently it
- /// subclasses the deprecated HitCollector).</item>
+ /// time.</item>
///
/// <item><see cref="PositiveScoresOnlyCollector" /> wraps any other
/// Collector and prevents collection of hits whose score
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/ConstantScoreRangeQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/ConstantScoreRangeQuery.cs?rev=1203769&r1=1203768&r2=1203769&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/ConstantScoreRangeQuery.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/ConstantScoreRangeQuery.cs Fri Nov 18 17:54:13 2011
@@ -27,14 +27,14 @@ namespace Lucene.Net.Search
///
/// <p/>This query matches the documents looking for terms that fall into the
/// supplied range according to <see cref="String.CompareTo(String)" />. It is not intended
- /// for numerical ranges, use <see cref="NumericRangeQuery" /> instead.
+ /// for numerical ranges, use <see cref="NumericRangeQuery{T}" /> instead.
///
/// <p/>This query is hardwired to <see cref="MultiTermQuery.CONSTANT_SCORE_AUTO_REWRITE_DEFAULT" />.
/// If you want to change this, use <see cref="TermRangeQuery" /> instead.
///
/// </summary>
/// <deprecated> Use <see cref="TermRangeQuery" /> for term ranges or
- /// <see cref="NumericRangeQuery" /> for numeric ranges instead.
+ /// <see cref="NumericRangeQuery{T}" /> for numeric ranges instead.
/// This class will be removed in Lucene 3.0.
/// </deprecated>
/// <version> $Id: ConstantScoreRangeQuery.java 797694 2009-07-25 00:03:33Z mikemccand $
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/DefaultSimilarity.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/DefaultSimilarity.cs?rev=1203769&r1=1203768&r2=1203769&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/DefaultSimilarity.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/DefaultSimilarity.cs Fri Nov 18 17:54:13 2011
@@ -44,7 +44,7 @@ namespace Lucene.Net.Search
numTerms = state.GetLength() - state.GetNumOverlap();
else
numTerms = state.GetLength();
- return (float) (state.GetBoost() * LengthNorm(field, numTerms));
+ return (state.GetBoost() * LengthNorm(field, numTerms));
}
/// <summary>Implemented as <c>1/sqrt(numTerms)</c>. </summary>
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/DocIdSetIterator.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/DocIdSetIterator.cs?rev=1203769&r1=1203768&r2=1203769&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/DocIdSetIterator.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/DocIdSetIterator.cs Fri Nov 18 17:54:13 2011
@@ -43,9 +43,7 @@ namespace Lucene.Net.Search
/// <item>Otherwise it should return the doc ID it is currently on.</item>
/// </list>
/// <p/>
- /// <b>NOTE:</b> in 3.0, this method will become abstract.
/// </summary>
- /// <since>2.9</since>
public abstract int DocID();
/// <summary> Advances to the next document in the set and returns the doc it is
@@ -56,8 +54,6 @@ namespace Lucene.Net.Search
/// method, as it may result in unpredicted behavior.
///
/// </summary>
- /// <since> 2.9
- /// </since>
public abstract int NextDoc();
/// <summary> Advances to the first beyond the current whose document number is greater
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FieldCache.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FieldCache.cs?rev=1203769&r1=1203768&r2=1203769&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FieldCache.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FieldCache.cs Fri Nov 18 17:54:13 2011
@@ -592,48 +592,6 @@ namespace Lucene.Net.Search
/// <throws> IOException If any error occurs. </throws>
StringIndex GetStringIndex(IndexReader reader, System.String field);
- /// <summary>Checks the internal cache for an appropriate entry, and if
- /// none is found reads <c>field</c> to see if it contains integers, longs, floats
- /// or strings, and then calls one of the other methods in this class to get the
- /// values. For string values, a StringIndex is returned. After
- /// calling this method, there is an entry in the cache for both
- /// type <c>AUTO</c> and the actual found type.
- /// </summary>
- /// <param name="reader"> Used to get field values.
- /// </param>
- /// <param name="field"> Which field contains the values.
- /// </param>
- /// <returns> int[], long[], float[] or StringIndex.
- /// </returns>
- /// <throws> IOException If any error occurs. </throws>
- /// <deprecated> Please specify the exact type, instead.
- /// Especially, guessing does <b>not</b> work with the new
- /// <see cref="NumericField" /> type.
- /// </deprecated>
- [Obsolete("Please specify the exact type, instead. Especially, guessing does not work with the new NumericField type.")]
- System.Object GetAuto(IndexReader reader, System.String field);
-
- /// <summary>Checks the internal cache for an appropriate entry, and if none
- /// is found reads the terms out of <c>field</c> and calls the given SortComparator
- /// to get the sort values. A hit in the cache will happen if <c>reader</c>,
- /// <c>field</c>, and <c>comparator</c> are the same (using <c>equals()</c>)
- /// as a previous call to this method.
- /// </summary>
- /// <param name="reader"> Used to get field values.
- /// </param>
- /// <param name="field"> Which field contains the values.
- /// </param>
- /// <param name="comparator">Used to convert terms into something to sort by.
- /// </param>
- /// <returns> Array of sort objects, one for each document.
- /// </returns>
- /// <throws> IOException If any error occurs. </throws>
- /// <deprecated> Please implement <see cref="FieldComparatorSource" />
- /// directly, instead.
- /// </deprecated>
- [Obsolete("Please implement FieldComparatorSource directly, instead.")]
- System.IComparable[] GetCustom(IndexReader reader, System.String field, SortComparator comparator);
-
/// <summary> EXPERT: Generates an array of CacheEntry objects representing all items
/// currently in the FieldCache.
/// <p/>
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FieldCacheImpl.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FieldCacheImpl.cs?rev=1203769&r1=1203768&r2=1203769&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FieldCacheImpl.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FieldCacheImpl.cs Fri Nov 18 17:54:13 2011
@@ -16,6 +16,8 @@
*/
using System;
+using System.Collections.Generic;
+using System.Linq;
using Lucene.Net.Support;
using NumericField = Lucene.Net.Documents.NumericField;
using IndexReader = Lucene.Net.Index.IndexReader;
@@ -37,13 +39,10 @@ namespace Lucene.Net.Search
/// </summary>
/// <since> lucene 1.4
/// </since>
- /// <version> $Id: FieldCacheImpl.java 807572 2009-08-25 11:44:45Z mikemccand $
- /// </version>
- // TODO: change interface to FieldCache in 3.0 when removed
- class FieldCacheImpl : ExtendedFieldCache_old.ExtendedFieldCache
+ class FieldCacheImpl : FieldCache
{
- private System.Collections.IDictionary caches;
+ private IDictionary<Type, Cache> caches;
internal FieldCacheImpl()
{
Init();
@@ -52,18 +51,15 @@ namespace Lucene.Net.Search
{
lock (this)
{
- System.Collections.Hashtable caches2 = new System.Collections.Hashtable(7);
- caches2[System.Type.GetType("System.SByte")] = new ByteCache(this);
- caches2[System.Type.GetType("System.Int16")] = new ShortCache(this);
- caches2[System.Type.GetType("System.Int32")] = new IntCache(this);
- caches2[System.Type.GetType("System.Single")] = new FloatCache(this);
- caches2[System.Type.GetType("System.Int64")] = new LongCache(this);
- caches2[System.Type.GetType("System.Double")] = new DoubleCache(this);
- caches2[typeof(System.String)] = new StringCache(this);
- caches2[typeof(StringIndex)] = new StringIndexCache(this);
- caches2[typeof(System.IComparable)] = new CustomCache(this);
- caches2[typeof(System.Object)] = new AutoCache(this);
- caches = caches2;
+ caches = new HashMap<Type, Cache>(7);
+ caches[typeof(sbyte)] = new ByteCache(this);
+ caches[typeof(short)] = new ShortCache(this);
+ caches[typeof(int)] = new IntCache(this);
+ caches[typeof(float)] = new FloatCache(this);
+ caches[typeof(long)] = new LongCache(this);
+ caches[typeof(double)] = new DoubleCache(this);
+ caches[typeof(string)] = new StringCache(this);
+ caches[typeof(StringIndex)] = new StringIndexCache(this);
}
}
@@ -82,63 +78,42 @@ namespace Lucene.Net.Search
public virtual CacheEntry[] GetCacheEntries()
{
- System.Collections.IList result = new System.Collections.ArrayList(17);
- System.Collections.IEnumerator outerKeys = caches.Keys.GetEnumerator();
- while (outerKeys.MoveNext())
- {
- System.Type cacheType = (System.Type) outerKeys.Current;
- Cache cache = (Cache) caches[cacheType];
- System.Collections.IEnumerator innerKeys = cache.readerCache.Keys.GetEnumerator();
- while (innerKeys.MoveNext())
+ IList<CacheEntry> result = new List<CacheEntry>(17);
+ foreach(var cacheType in caches.Keys)
+ {
+ var cache = caches[cacheType];
+ foreach(var readerKey in cache.readerCache.Keys)
{
// we've now materialized a hard ref
- System.Object readerKey = innerKeys.Current;
// innerKeys was backed by WeakDictionary, sanity check
// that it wasn't GCed before we made hard ref
- if (null != readerKey && cache.readerCache.Contains(readerKey))
+ if (null != readerKey && cache.readerCache.ContainsKey(readerKey))
{
- System.Collections.IDictionary innerCache = ((System.Collections.IDictionary) cache.readerCache[readerKey]);
- System.Collections.IEnumerator entrySetIterator = new System.Collections.Hashtable(innerCache).GetEnumerator();
- while (entrySetIterator.MoveNext())
+ var innerCache = cache.readerCache[readerKey];
+ foreach (KeyValuePair<Entry, Object> mapEntry in innerCache)
{
- System.Collections.DictionaryEntry mapEntry = (System.Collections.DictionaryEntry) entrySetIterator.Current;
- Entry entry = (Entry) mapEntry.Key;
- result.Add(new CacheEntryImpl(readerKey, entry.field, cacheType, entry.type, entry.custom, entry.locale, mapEntry.Value));
+ Entry entry = mapEntry.Key;
+ result.Add(new CacheEntryImpl(readerKey, entry.field, cacheType, entry.custom, mapEntry.Value));
}
}
}
}
- return (CacheEntry[]) new System.Collections.ArrayList(result).ToArray(typeof(CacheEntry));
+ return result.ToArray();
}
- private sealed class CacheEntryImpl:CacheEntry
+ private sealed class CacheEntryImpl : CacheEntry
{
- /// <deprecated> Only needed because of Entry (ab)use by
- /// FieldSortedHitQueue, remove when FieldSortedHitQueue
- /// is removed
- /// </deprecated>
- [Obsolete("Only needed because of Entry (ab)use by FieldSortedHitQueue, remove when FieldSortedHitQueue is removed")]
- private int sortFieldType;
- /// <deprecated> Only needed because of Entry (ab)use by
- /// FieldSortedHitQueue, remove when FieldSortedHitQueue
- /// is removed
- /// </deprecated>
- [Obsolete("Only needed because of Entry (ab)use by FieldSortedHitQueue, remove when FieldSortedHitQueue is removed")]
- private System.Globalization.CultureInfo locale;
-
private System.Object readerKey;
private System.String fieldName;
private System.Type cacheType;
private System.Object custom;
private System.Object value_Renamed;
- internal CacheEntryImpl(System.Object readerKey, System.String fieldName, System.Type cacheType, int sortFieldType, System.Object custom, System.Globalization.CultureInfo locale, System.Object value_Renamed)
+ internal CacheEntryImpl(System.Object readerKey, System.String fieldName, System.Type cacheType, System.Object custom, System.Object value_Renamed)
{
this.readerKey = readerKey;
this.fieldName = fieldName;
this.cacheType = cacheType;
- this.sortFieldType = sortFieldType;
this.custom = custom;
- this.locale = locale;
this.value_Renamed = value_Renamed;
// :HACK: for testing.
@@ -166,25 +141,6 @@ namespace Lucene.Net.Search
{
return value_Renamed;
}
- /// <summary> Adds warning to super.toString if Local or sortFieldType were specified</summary>
- /// <deprecated> Only needed because of Entry (ab)use by
- /// FieldSortedHitQueue, remove when FieldSortedHitQueue
- /// is removed
- /// </deprecated>
- [Obsolete("Only needed because of Entry (ab)use by FieldSortedHitQueue, remove when FieldSortedHitQueue is removed")]
- public override System.String ToString()
- {
- System.String r = base.ToString();
- if (null != locale)
- {
- r = r + "...!!!Locale:" + locale + "???";
- }
- if (SortField.CUSTOM != sortFieldType)
- {
- r = r + "...!!!SortType:" + sortFieldType + "???";
- }
- return r;
- }
}
/// <summary> Hack: When thrown from a Parser (NUMERIC_UTILS_* ones), this stops
@@ -211,7 +167,7 @@ namespace Lucene.Net.Search
internal FieldCache wrapper;
- internal System.Collections.IDictionary readerCache = new WeakHashTable();
+ internal IDictionary<object, IDictionary<Entry, object>> readerCache = new WeakDictionary<object, IDictionary<Entry, object>>();
protected internal abstract System.Object CreateValue(IndexReader reader, Entry key);
@@ -227,37 +183,37 @@ namespace Lucene.Net.Search
public virtual System.Object Get(IndexReader reader, Entry key)
{
- System.Collections.IDictionary innerCache;
- System.Object value_Renamed;
+ IDictionary<Entry, object> innerCache;
+ System.Object value;
System.Object readerKey = reader.GetFieldCacheKey();
- lock (readerCache.SyncRoot)
+ lock (readerCache)
{
- innerCache = (System.Collections.IDictionary) readerCache[readerKey];
+ innerCache = readerCache[readerKey];
if (innerCache == null)
{
- innerCache = new System.Collections.Hashtable();
+ innerCache = new HashMap<Entry, object>();
readerCache[readerKey] = innerCache;
- value_Renamed = null;
+ value = null;
}
else
{
- value_Renamed = innerCache[key];
+ value = innerCache[key];
}
- if (value_Renamed == null)
+ if (value == null)
{
- value_Renamed = new CreationPlaceholder();
- innerCache[key] = value_Renamed;
+ value = new CreationPlaceholder();
+ innerCache[key] = value;
}
}
- if (value_Renamed is CreationPlaceholder)
+ if (value is CreationPlaceholder)
{
- lock (value_Renamed)
+ lock (value)
{
- CreationPlaceholder progress = (CreationPlaceholder) value_Renamed;
+ CreationPlaceholder progress = (CreationPlaceholder) value;
if (progress.value_Renamed == null)
{
progress.value_Renamed = CreateValue(reader, key);
- lock (readerCache.SyncRoot)
+ lock (readerCache)
{
innerCache[key] = progress.value_Renamed;
}
@@ -277,7 +233,7 @@ namespace Lucene.Net.Search
return progress.value_Renamed;
}
}
- return value_Renamed;
+ return value;
}
private void PrintNewInsanity(System.IO.StreamWriter infoStream, System.Object value_Renamed)
@@ -306,80 +262,41 @@ namespace Lucene.Net.Search
protected internal class Entry
{
internal System.String field; // which Fieldable
- /// <deprecated> Only (ab)used by FieldSortedHitQueue,
- /// remove when FieldSortedHitQueue is removed
- /// </deprecated>
- [Obsolete("Only (ab)used by FieldSortedHitQueue, remove when FieldSortedHitQueue is removed")]
- internal int type; // which SortField type
internal System.Object custom; // which custom comparator or parser
- /// <deprecated> Only (ab)used by FieldSortedHitQueue,
- /// remove when FieldSortedHitQueue is removed
- /// </deprecated>
- [Obsolete("Only (ab)used by FieldSortedHitQueue, remove when FieldSortedHitQueue is removed")]
- internal System.Globalization.CultureInfo locale; // the locale we're sorting (if string)
-
- /// <deprecated> Only (ab)used by FieldSortedHitQueue,
- /// remove when FieldSortedHitQueue is removed
- /// </deprecated>
- [Obsolete("Only (ab)used by FieldSortedHitQueue, remove when FieldSortedHitQueue is removed")]
- internal Entry(System.String field, int type, System.Globalization.CultureInfo locale)
- {
- this.field = StringHelper.Intern(field);
- this.type = type;
- this.custom = null;
- this.locale = locale;
- }
-
+
/// <summary>Creates one of these objects for a custom comparator/parser. </summary>
internal Entry(System.String field, System.Object custom)
{
this.field = StringHelper.Intern(field);
- this.type = SortField.CUSTOM;
this.custom = custom;
- this.locale = null;
- }
-
- /// <deprecated> Only (ab)used by FieldSortedHitQueue,
- /// remove when FieldSortedHitQueue is removed
- /// </deprecated>
- [Obsolete("Only (ab)used by FieldSortedHitQueue, remove when FieldSortedHitQueue is removed")]
- internal Entry(System.String field, int type, Parser parser)
- {
- this.field = StringHelper.Intern(field);
- this.type = type;
- this.custom = parser;
- this.locale = null;
}
/// <summary>Two of these are equal iff they reference the same field and type. </summary>
public override bool Equals(System.Object o)
{
- if (o is Entry)
- {
- Entry other = (Entry) o;
- if ((System.Object) other.field == (System.Object) field && other.type == type)
- {
- if (other.locale == null?locale == null:other.locale.Equals(locale))
- {
- if (other.custom == null)
- {
- if (custom == null)
- return true;
- }
- else if (other.custom.Equals(custom))
- {
- return true;
- }
- }
- }
- }
- return false;
+ if (o is Entry)
+ {
+ Entry other = (Entry) o;
+ if (other.field == field)
+ {
+ if (other.custom == null)
+ {
+ if (custom == null)
+ return true;
+ }
+ else if (other.custom.Equals(custom))
+ {
+ return true;
+ }
+ }
+ }
+ return false;
}
/// <summary>Composes a hashcode based on the field and type. </summary>
public override int GetHashCode()
{
- return field.GetHashCode() ^ type ^ (custom == null?0:custom.GetHashCode()) ^ (locale == null?0:locale.GetHashCode());
+ return field.GetHashCode() ^ (custom == null?0:custom.GetHashCode());
}
}
@@ -392,7 +309,7 @@ namespace Lucene.Net.Search
// inherit javadocs
public virtual sbyte[] GetBytes(IndexReader reader, System.String field, ByteParser parser)
{
- return (sbyte[]) ((Cache) caches[System.Type.GetType("System.SByte")]).Get(reader, new Entry(field, parser));
+ return (sbyte[]) caches[typeof(sbyte)].Get(reader, new Entry(field, parser));
}
internal sealed class ByteCache:Cache
@@ -402,7 +319,7 @@ namespace Lucene.Net.Search
}
protected internal override System.Object CreateValue(IndexReader reader, Entry entryKey)
{
- Entry entry = (Entry) entryKey;
+ Entry entry = entryKey;
System.String field = entry.field;
ByteParser parser = (ByteParser) entry.custom;
if (parser == null)
@@ -450,7 +367,7 @@ namespace Lucene.Net.Search
// inherit javadocs
public virtual short[] GetShorts(IndexReader reader, System.String field, ShortParser parser)
{
- return (short[]) ((Cache) caches[System.Type.GetType("System.Int16")]).Get(reader, new Entry(field, parser));
+ return (short[]) caches[typeof(short)].Get(reader, new Entry(field, parser));
}
internal sealed class ShortCache:Cache
@@ -461,7 +378,7 @@ namespace Lucene.Net.Search
protected internal override System.Object CreateValue(IndexReader reader, Entry entryKey)
{
- Entry entry = (Entry) entryKey;
+ Entry entry = entryKey;
System.String field = entry.field;
ShortParser parser = (ShortParser) entry.custom;
if (parser == null)
@@ -509,7 +426,7 @@ namespace Lucene.Net.Search
// inherit javadocs
public virtual int[] GetInts(IndexReader reader, System.String field, IntParser parser)
{
- return (int[]) ((Cache) caches[System.Type.GetType("System.Int32")]).Get(reader, new Entry(field, parser));
+ return (int[]) caches[typeof(int)].Get(reader, new Entry(field, parser));
}
internal sealed class IntCache:Cache
@@ -520,7 +437,7 @@ namespace Lucene.Net.Search
protected internal override System.Object CreateValue(IndexReader reader, Entry entryKey)
{
- Entry entry = (Entry) entryKey;
+ Entry entry = entryKey;
System.String field = entry.field;
IntParser parser = (IntParser) entry.custom;
if (parser == null)
@@ -583,7 +500,7 @@ namespace Lucene.Net.Search
public virtual float[] GetFloats(IndexReader reader, System.String field, FloatParser parser)
{
- return (float[]) ((Cache) caches[System.Type.GetType("System.Single")]).Get(reader, new Entry(field, parser));
+ return (float[]) caches[typeof(float)].Get(reader, new Entry(field, parser));
}
internal sealed class FloatCache:Cache
@@ -594,7 +511,7 @@ namespace Lucene.Net.Search
protected internal override System.Object CreateValue(IndexReader reader, Entry entryKey)
{
- Entry entry = (Entry) entryKey;
+ Entry entry = entryKey;
System.String field = entry.field;
FloatParser parser = (FloatParser) entry.custom;
if (parser == null)
@@ -655,15 +572,7 @@ namespace Lucene.Net.Search
// inherit javadocs
public virtual long[] GetLongs(IndexReader reader, System.String field, Lucene.Net.Search.LongParser parser)
{
- return (long[]) ((Cache) caches[System.Type.GetType("System.Int64")]).Get(reader, new Entry(field, parser));
- }
-
- /// <deprecated> Will be removed in 3.0, this is for binary compatibility only
- /// </deprecated>
- [Obsolete("Will be removed in 3.0, this is for binary compatibility only ")]
- public virtual long[] GetLongs(IndexReader reader, System.String field, Lucene.Net.Search.ExtendedFieldCache_old.LongParser parser)
- {
- return (long[]) ((Cache) caches[System.Type.GetType("System.Int64")]).Get(reader, new Entry(field, parser));
+ return (long[]) caches[typeof(long)].Get(reader, new Entry(field, parser));
}
internal sealed class LongCache:Cache
@@ -674,7 +583,7 @@ namespace Lucene.Net.Search
protected internal override System.Object CreateValue(IndexReader reader, Entry entryKey)
{
- Entry entry = (Entry) entryKey;
+ Entry entry = entryKey;
System.String field = entry.field;
Lucene.Net.Search.LongParser parser = (Lucene.Net.Search.LongParser) entry.custom;
if (parser == null)
@@ -735,15 +644,7 @@ namespace Lucene.Net.Search
// inherit javadocs
public virtual double[] GetDoubles(IndexReader reader, System.String field, Lucene.Net.Search.DoubleParser parser)
{
- return (double[]) ((Cache) caches[System.Type.GetType("System.Double")]).Get(reader, new Entry(field, parser));
- }
-
- /// <deprecated> Will be removed in 3.0, this is for binary compatibility only
- /// </deprecated>
- [Obsolete("Will be removed in 3.0, this is for binary compatibility only ")]
- public virtual double[] GetDoubles(IndexReader reader, System.String field, Lucene.Net.Search.ExtendedFieldCache_old.DoubleParser parser)
- {
- return (double[]) ((Cache) caches[System.Type.GetType("System.Double")]).Get(reader, new Entry(field, parser));
+ return (double[]) caches[typeof(double)].Get(reader, new Entry(field, parser));
}
internal sealed class DoubleCache:Cache
@@ -754,7 +655,7 @@ namespace Lucene.Net.Search
protected internal override System.Object CreateValue(IndexReader reader, Entry entryKey)
{
- Entry entry = (Entry) entryKey;
+ Entry entry = entryKey;
System.String field = entry.field;
Lucene.Net.Search.DoubleParser parser = (Lucene.Net.Search.DoubleParser) entry.custom;
if (parser == null)
@@ -809,7 +710,7 @@ namespace Lucene.Net.Search
// inherit javadocs
public virtual System.String[] GetStrings(IndexReader reader, System.String field)
{
- return (System.String[]) ((Cache) caches[typeof(System.String)]).Get(reader, new Entry(field, (Parser) null));
+ return (System.String[]) caches[typeof(string)].Get(reader, new Entry(field, (Parser) null));
}
internal sealed class StringCache:Cache
@@ -820,7 +721,7 @@ namespace Lucene.Net.Search
protected internal override System.Object CreateValue(IndexReader reader, Entry entryKey)
{
- System.String field = StringHelper.Intern((System.String) entryKey.field);
+ System.String field = StringHelper.Intern(entryKey.field);
System.String[] retArray = new System.String[reader.MaxDoc()];
TermDocs termDocs = reader.TermDocs();
TermEnum termEnum = reader.Terms(new Term(field));
@@ -853,7 +754,7 @@ namespace Lucene.Net.Search
// inherit javadocs
public virtual StringIndex GetStringIndex(IndexReader reader, System.String field)
{
- return (StringIndex) ((Cache) caches[typeof(StringIndex)]).Get(reader, new Entry(field, (Parser) null));
+ return (StringIndex) caches[typeof(StringIndex)].Get(reader, new Entry(field, (Parser) null));
}
internal sealed class StringIndexCache:Cache
@@ -864,7 +765,7 @@ namespace Lucene.Net.Search
protected internal override System.Object CreateValue(IndexReader reader, Entry entryKey)
{
- System.String field = StringHelper.Intern((System.String) entryKey.field);
+ System.String field = StringHelper.Intern(entryKey.field);
int[] retArray = new int[reader.MaxDoc()];
System.String[] mterms = new System.String[reader.MaxDoc() + 1];
TermDocs termDocs = reader.TermDocs();
@@ -923,141 +824,6 @@ namespace Lucene.Net.Search
}
}
-
- ///// <summary>The pattern used to detect integer values in a field </summary>
- ///// <summary>removed for java 1.3 compatibility
- ///// protected static final Pattern pIntegers = Pattern.compile ("[0-9\\-]+");
- ///// </summary>
-
- ///// <summary>The pattern used to detect float values in a field </summary>
- ///// <summary> removed for java 1.3 compatibility
- ///// protected static final Object pFloats = Pattern.compile ("[0-9+\\-\\.eEfFdD]+");
- ///// </summary>
-
- // inherit javadocs
- public virtual System.Object GetAuto(IndexReader reader, System.String field)
- {
- return ((Cache) caches[typeof(System.Object)]).Get(reader, new Entry(field, (Parser) null));
- }
-
- /// <deprecated> Please specify the exact type, instead.
- /// Especially, guessing does <b>not</b> work with the new
- /// <see cref="NumericField" /> type.
- /// </deprecated>
- [Obsolete("Please specify the exact type, instead. Especially, guessing does not work with the new NumericField type.")]
- internal sealed class AutoCache:Cache
- {
- internal AutoCache(FieldCache wrapper):base(wrapper)
- {
- }
-
- protected internal override System.Object CreateValue(IndexReader reader, Entry entryKey)
- {
- System.String field = StringHelper.Intern((System.String) entryKey.field);
- TermEnum enumerator = reader.Terms(new Term(field));
- try
- {
- Term term = enumerator.Term();
- if (term == null)
- {
- throw new System.SystemException("no terms in field " + field + " - cannot determine type");
- }
- System.Object ret = null;
- if ((System.Object) term.Field() == (System.Object) field)
- {
- System.String termtext = term.Text().Trim();
-
- try
- {
- System.Int32.Parse(termtext);
- ret = wrapper.GetInts(reader, field);
- }
- catch (System.FormatException nfe1)
- {
- try
- {
- System.Int64.Parse(termtext);
- ret = wrapper.GetLongs(reader, field);
- }
- catch (System.FormatException nfe2)
- {
- try
- {
- Single.Parse(termtext);
- ret = wrapper.GetFloats(reader, field);
- }
- catch (System.FormatException nfe3)
- {
- ret = wrapper.GetStringIndex(reader, field);
- }
- }
- }
- }
- else
- {
- throw new System.SystemException("field \"" + field + "\" does not appear to be indexed");
- }
- return ret;
- }
- finally
- {
- enumerator.Close();
- }
- }
- }
-
-
- /// <deprecated>
- /// </deprecated>
- [Obsolete]
- public virtual System.IComparable[] GetCustom(IndexReader reader, System.String field, SortComparator comparator)
- {
- return (System.IComparable[]) ((Cache) caches[typeof(System.IComparable)]).Get(reader, new Entry(field, comparator));
- }
-
- /// <deprecated>
- /// </deprecated>
- [Obsolete]
- internal sealed class CustomCache:Cache
- {
- internal CustomCache(FieldCache wrapper):base(wrapper)
- {
- }
-
- protected internal override System.Object CreateValue(IndexReader reader, Entry entryKey)
- {
- Entry entry = (Entry) entryKey;
- System.String field = entry.field;
- SortComparator comparator = (SortComparator) entry.custom;
- System.IComparable[] retArray = new System.IComparable[reader.MaxDoc()];
- TermDocs termDocs = reader.TermDocs();
- TermEnum termEnum = reader.Terms(new Term(field));
- try
- {
- do
- {
- Term term = termEnum.Term();
- if (term == null || (System.Object) term.Field() != (System.Object) field)
- break;
- System.IComparable termval = comparator.GetComparable(term.Text());
- termDocs.Seek(termEnum);
- while (termDocs.Next())
- {
- retArray[termDocs.Doc()] = termval;
- }
- }
- while (termEnum.Next());
- }
- finally
- {
- termDocs.Close();
- termEnum.Close();
- }
- return retArray;
- }
- }
-
-
private volatile System.IO.StreamWriter infoStream;
public virtual void SetInfoStream(System.IO.StreamWriter stream)
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FieldCacheRangeFilter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FieldCacheRangeFilter.cs?rev=1203769&r1=1203768&r2=1203769&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FieldCacheRangeFilter.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/FieldCacheRangeFilter.cs Fri Nov 18 17:54:13 2011
@@ -35,7 +35,7 @@ namespace Lucene.Net.Search
/// as building a <see cref="TermRangeFilter" /> if using a <see cref="NewStringRange" />. However, if the range never changes it
/// is slower (around 2x as slow) than building a CachingWrapperFilter on top of a single <see cref="TermRangeFilter" />.
///
- /// For numeric data types, this filter may be significantly faster than <see cref="NumericRangeFilter" />.
+ /// For numeric data types, this filter may be significantly faster than <see cref="NumericRangeFilter{T}" />.
/// Furthermore, it does not need the numeric values encoded by <see cref="NumericField" />. But
/// it has the problem that it only works with exact one value/document (see below).
///