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/15 09:41:46 UTC
[Lucene.Net] svn commit: r1202091 [1/6] - in
/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk: src/core/
src/core/Index/ src/core/Search/ src/core/Store/ src/demo/Demo.Common/
test/core/ test/core/Analysis/ test/core/Index/ test/core/QueryParser/
test/core/Sea...
Author: ccurrens
Date: Tue Nov 15 08:41:44 2011
New Revision: 1202091
URL: http://svn.apache.org/viewvc?rev=1202091&view=rev
Log:
Converted Index, Search, Analysis tests. Still in a non-compiling state.
Added:
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Store/TestMultiMMap.cs
Modified:
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/Index/IndexDeletionPolicy.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/KeepOnlyLastCommitDeletionPolicy.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/SnapshotDeletionPolicy.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/Sort.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TopDocsCollector.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/MMapDirectory.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/demo/Demo.Common/FileDocument.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Analysis/TestCharArraySet.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Index/TestBackwardsCompatibility.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Index/TestCheckIndex.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Index/TestCompoundFile.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Index/TestDeletionPolicy.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Index/TestDoc.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Index/TestIndexReaderReopen.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Index/TestIndexWriter.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Index/TestIndexWriterMergePolicy.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Index/TestIndexWriterMerging.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Index/TestMultiLevelSkipList.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Index/TestNorms.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Index/TestOmitTf.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Index/TestParallelReader.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Index/TestPayloads.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Index/TestSnapshotDeletionPolicy.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Index/TestTermVectorsReader.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Index/TestTermdocPerf.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Index/TestThreadedOptimize.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Index/TestTransactionRollback.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Index/TestWordlistLoader.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/QueryParser/TestMultiAnalyzer.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/QueryParser/TestMultiFieldQueryParser.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/QueryParser/TestQueryParser.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/QueryUtils.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestBoolean2.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestBooleanMinShouldMatch.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestBooleanOr.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestBooleanPrefixQuery.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestBooleanQuery.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestBooleanScorer.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestCachingWrapperFilter.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestCustomSearcherSort.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestDateSort.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestDocIdSet.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestElevationComparator.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestExplanations.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestFilteredQuery.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestFuzzyQuery.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestMultiSearcher.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestMultiSearcherRanking.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestPositionIncrement.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestPositiveScoresOnlyCollector.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestQueryWrapperFilter.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestScoreCachingWrappingScorer.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestSimilarity.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestSimpleExplanations.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestSort.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestTermRangeQuery.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestTopDocsCollector.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Search/TestWildcard.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Store/MockRAMDirectory.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Store/MockRAMInputStream.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Store/TestBufferedIndexInput.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Store/TestDirectory.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Store/TestHugeRamFile.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Store/TestLockFactory.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Store/TestRAMDirectory.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Store/TestWindowsMMap.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/TestDemo.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/TestMergeSchedulerExternal.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/TestSupportClass.cs
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/UpdatedTests.txt
incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Util/TestCloseableThreadLocal.cs
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=1202091&r1=1202090&r2=1202091&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 Tue Nov 15 08:41:44 2011
@@ -133,7 +133,7 @@ index\
index\FreqProxTermsWriterPerThread.java - Text files are different
index\IndexCommit.java - Text files are different
index\IndexCommitPoint.java - Removed in 3.x
- index\IndexDeletionPolicy.java - Text files are different
+ index\IndexDeletionPolicy.java - PORTED
index\IndexFileDeleter.java - PORTED
index\IndexFileNameFilter.java - Text files are different
index\IndexFileNames.java - Text files are different
@@ -147,7 +147,7 @@ index\
index\InvertedDocEndConsumer.java - PORTED
index\InvertedDocEndConsumerPerField.java - IDENTICAL
index\InvertedDocEndConsumerPerThread.java - IDENTICAL
- index\KeepOnlyLastCommitDeletionPolicy.java - Text files are different
+ index\KeepOnlyLastCommitDeletionPolicy.java - PORTED
index\LogByteSizeMergePolicy.java - PORTED
index\LogDocMergePolicy.java - PORTED
index\LogMergePolicy.java - PORTED
@@ -182,7 +182,7 @@ index\
index\SegmentTermVector.java - Text files are different
index\SegmentWriteState.java - PORTED
index\SerialMergeScheduler.java - Text files are different
- index\SnapshotDeletionPolicy.java - Text files are different
+ index\SnapshotDeletionPolicy.java - PORTED
index\SortedTermVectorMapper.java - Text files are different
index\StaleReaderException.java - IDENTICAL
index\StoredFieldsWriter.java - Text files are different
@@ -358,7 +358,7 @@ search
SimilarityDelegator.java - PORTED
SingleTermEnum.java - PORTED
SloppyPhraseScorer.java - PORTED
- Sort.java - Text files are different
+ Sort.java - PORTED
SortComparator.java - Removed in 3.x
SortComparatorSource.java - Removed in 3.x
SortField.java - Text files are different
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/IndexDeletionPolicy.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/IndexDeletionPolicy.cs?rev=1202091&r1=1202090&r2=1202091&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/IndexDeletionPolicy.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/IndexDeletionPolicy.cs Tue Nov 15 08:41:44 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
namespace Lucene.Net.Index
{
@@ -70,7 +71,7 @@ namespace Lucene.Net.Index
/// <see cref="IndexCommit">point-in-time commits</see>,
/// sorted by age (the 0th one is the oldest commit).
/// </param>
- void OnInit(System.Collections.IList commits);
+ void OnInit<T>(IList<T> commits) where T : IndexCommit;
/// <summary> <p/>This is called each time the writer completed a commit.
/// This gives the policy a chance to remove old commit points
@@ -97,6 +98,6 @@ namespace Lucene.Net.Index
/// <param name="commits">List of <see cref="IndexCommit" />,
/// sorted by age (the 0th one is the oldest commit).
/// </param>
- void OnCommit(System.Collections.IList commits);
+ void OnCommit<T>(IList<T> commits) where T : IndexCommit;
}
}
\ No newline at end of file
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/KeepOnlyLastCommitDeletionPolicy.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/KeepOnlyLastCommitDeletionPolicy.cs?rev=1202091&r1=1202090&r2=1202091&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/KeepOnlyLastCommitDeletionPolicy.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/KeepOnlyLastCommitDeletionPolicy.cs Tue Nov 15 08:41:44 2011
@@ -16,6 +16,7 @@
*/
using System;
+using System.Collections.Generic;
namespace Lucene.Net.Index
{
@@ -30,21 +31,21 @@ namespace Lucene.Net.Index
{
/// <summary> Deletes all commits except the most recent one.</summary>
- public void OnInit(System.Collections.IList commits)
+ public void OnInit<T>(IList<T> commits) where T : IndexCommit
{
// Note that commits.size() should normally be 1:
OnCommit(commits);
}
/// <summary> Deletes all commits except the most recent one.</summary>
- public void OnCommit(System.Collections.IList commits)
+ public void OnCommit<T>(IList<T> commits) where T : IndexCommit
{
// Note that commits.size() should normally be 2 (if not
// called by onInit above):
int size = commits.Count;
for (int i = 0; i < size - 1; i++)
{
- ((IndexCommit) commits[i]).Delete();
+ commits[i].Delete();
}
}
}
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/SnapshotDeletionPolicy.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/SnapshotDeletionPolicy.cs?rev=1202091&r1=1202090&r2=1202091&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/SnapshotDeletionPolicy.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Index/SnapshotDeletionPolicy.cs Tue Nov 15 08:41:44 2011
@@ -16,7 +16,7 @@
*/
using System;
-
+using System.Collections.Generic;
using Directory = Lucene.Net.Store.Directory;
namespace Lucene.Net.Index
@@ -53,21 +53,21 @@ namespace Lucene.Net.Index
this.primary = primary;
}
- public virtual void OnInit(System.Collections.IList commits)
+ public virtual void OnInit<T>(IList<T> commits) where T : IndexCommit
{
lock (this)
{
primary.OnInit(WrapCommits(commits));
- lastCommit = (IndexCommit) commits[commits.Count - 1];
+ lastCommit = commits[commits.Count - 1];
}
}
- public virtual void OnCommit(System.Collections.IList commits)
+ public virtual void OnCommit<T>(IList<T> commits) where T : IndexCommit
{
lock (this)
{
primary.OnCommit(WrapCommits(commits));
- lastCommit = (IndexCommit) commits[commits.Count - 1];
+ lastCommit = commits[commits.Count - 1];
}
}
@@ -81,8 +81,7 @@ namespace Lucene.Net.Index
/// consume an extra 1X of your total index size, until
/// you release the snapshot.
/// </summary>
- // TODO 3.0: change this to return IndexCommit instead
- public virtual IndexCommitPoint Snapshot()
+ public virtual IndexCommit Snapshot()
{
lock (this)
{
@@ -90,6 +89,7 @@ namespace Lucene.Net.Index
{
throw new System.SystemException("no index commits to snapshot !");
}
+
if (snapshot == null)
snapshot = lastCommit.GetSegmentsFileName();
else
@@ -110,7 +110,7 @@ namespace Lucene.Net.Index
}
}
- private class MyCommitPoint:IndexCommit
+ private class MyCommitPoint : IndexCommit
{
private void InitBlock(SnapshotDeletionPolicy enclosingInstance)
{
@@ -141,7 +141,7 @@ namespace Lucene.Net.Index
{
return cp.GetSegmentsFileName();
}
- public override System.Collections.Generic.ICollection<string> GetFileNames()
+ public override ICollection<string> GetFileNames()
{
return cp.GetFileNames();
}
@@ -171,7 +171,7 @@ namespace Lucene.Net.Index
{
return cp.GetGeneration();
}
- public override System.Collections.Generic.IDictionary<string, string> GetUserData()
+ public override IDictionary<string, string> GetUserData()
{
return cp.GetUserData();
}
@@ -182,13 +182,15 @@ namespace Lucene.Net.Index
}
}
- private System.Collections.IList WrapCommits(System.Collections.IList commits)
+ private IList<IndexCommit> WrapCommits<T>(IList<T> commits) where T : IndexCommit
{
int count = commits.Count;
- System.Collections.IList myCommits = new System.Collections.ArrayList(count);
- for (int i = 0; i < count; i++)
- myCommits.Add(new MyCommitPoint(this, (IndexCommit) commits[i]));
- return myCommits;
+ var myCommits = new List<IndexCommit>(count);
+ for (int i = 0; i < count; i++)
+ {
+ myCommits.Add(new MyCommitPoint(this, commits[i]));
+ }
+ return myCommits;
}
}
}
\ No newline at end of file
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=1202091&r1=1202090&r2=1202091&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 Tue Nov 15 08:41:44 2011
@@ -52,552 +52,673 @@ namespace Lucene.Net.Search
/// that create a correct instance for different data types supported by <see cref="FieldCache" />.
/// </summary>
- [Serializable]
- public abstract class FieldCacheRangeFilter<T> : Filter
+ public static class FieldCacheRangeFilter
{
- [Serializable]
+ [Serializable]
private class AnonymousClassFieldCacheRangeFilter : FieldCacheRangeFilter<string>
- {
- private class AnonymousClassFieldCacheDocIdSet:FieldCacheDocIdSet
- {
+ {
+ private class AnonymousClassFieldCacheDocIdSet : FieldCacheDocIdSet
+ {
private void InitBlock(Lucene.Net.Search.StringIndex fcsi, int inclusiveLowerPoint, int inclusiveUpperPoint, FieldCacheRangeFilter<string> enclosingInstance)
- {
- this.fcsi = fcsi;
- this.inclusiveLowerPoint = inclusiveLowerPoint;
- this.inclusiveUpperPoint = inclusiveUpperPoint;
- this.enclosingInstance = enclosingInstance;
- }
- private Lucene.Net.Search.StringIndex fcsi;
- private int inclusiveLowerPoint;
- private int inclusiveUpperPoint;
+ {
+ this.fcsi = fcsi;
+ this.inclusiveLowerPoint = inclusiveLowerPoint;
+ this.inclusiveUpperPoint = inclusiveUpperPoint;
+ this.enclosingInstance = enclosingInstance;
+ }
+ private Lucene.Net.Search.StringIndex fcsi;
+ private int inclusiveLowerPoint;
+ private int inclusiveUpperPoint;
private FieldCacheRangeFilter<string> enclosingInstance;
public FieldCacheRangeFilter<string> Enclosing_Instance
- {
- get
- {
- return enclosingInstance;
- }
-
- }
+ {
+ get
+ {
+ return enclosingInstance;
+ }
+
+ }
internal AnonymousClassFieldCacheDocIdSet(Lucene.Net.Search.StringIndex fcsi, int inclusiveLowerPoint, int inclusiveUpperPoint, FieldCacheRangeFilter<string> enclosingInstance, Lucene.Net.Index.IndexReader Param1, bool Param2)
: base(Param1, Param2)
- {
- InitBlock(fcsi, inclusiveLowerPoint, inclusiveUpperPoint, enclosingInstance);
- }
- internal override bool MatchDoc(int doc)
- {
- return fcsi.order[doc] >= inclusiveLowerPoint && fcsi.order[doc] <= inclusiveUpperPoint;
- }
- }
- internal AnonymousClassFieldCacheRangeFilter(string field, Lucene.Net.Search.Parser parser, string lowerVal, string upperVal, bool includeLower, bool includeUpper)
+ {
+ InitBlock(fcsi, inclusiveLowerPoint, inclusiveUpperPoint, enclosingInstance);
+ }
+ internal override bool MatchDoc(int doc)
+ {
+ return fcsi.order[doc] >= inclusiveLowerPoint && fcsi.order[doc] <= inclusiveUpperPoint;
+ }
+ }
+ internal AnonymousClassFieldCacheRangeFilter(string field, Lucene.Net.Search.Parser parser, string lowerVal, string upperVal, bool includeLower, bool includeUpper)
: base(field, parser, lowerVal, upperVal, includeLower, includeUpper)
- {
- }
- public override DocIdSet GetDocIdSet(IndexReader reader)
- {
- Lucene.Net.Search.StringIndex fcsi = Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetStringIndex(reader, field);
- int lowerPoint = fcsi.BinarySearchLookup(lowerVal);
- int upperPoint = fcsi.BinarySearchLookup(upperVal);
-
- int inclusiveLowerPoint;
- int inclusiveUpperPoint;
-
- // Hints:
- // * binarySearchLookup returns 0, if value was null.
- // * the value is <0 if no exact hit was found, the returned value
- // is (-(insertion point) - 1)
- if (lowerPoint == 0)
- {
- System.Diagnostics.Debug.Assert(lowerVal == null);
- inclusiveLowerPoint = 1;
- }
- else if (includeLower && lowerPoint > 0)
- {
- inclusiveLowerPoint = lowerPoint;
- }
- else if (lowerPoint > 0)
- {
- inclusiveLowerPoint = lowerPoint + 1;
- }
- else
- {
- inclusiveLowerPoint = System.Math.Max(1, - lowerPoint - 1);
- }
-
- if (upperPoint == 0)
- {
- System.Diagnostics.Debug.Assert(upperVal == null);
- inclusiveUpperPoint = System.Int32.MaxValue;
- }
- else if (includeUpper && upperPoint > 0)
- {
- inclusiveUpperPoint = upperPoint;
- }
- else if (upperPoint > 0)
- {
- inclusiveUpperPoint = upperPoint - 1;
- }
- else
- {
- inclusiveUpperPoint = - upperPoint - 2;
- }
-
- if (inclusiveUpperPoint <= 0 || inclusiveLowerPoint > inclusiveUpperPoint)
- return DocIdSet.EMPTY_DOCIDSET;
-
- System.Diagnostics.Debug.Assert(inclusiveLowerPoint > 0 && inclusiveUpperPoint > 0);
-
- // for this DocIdSet, we never need to use TermDocs,
- // because deleted docs have an order of 0 (null entry in StringIndex)
- return new AnonymousClassFieldCacheDocIdSet(fcsi, inclusiveLowerPoint, inclusiveUpperPoint, this, reader, false);
- }
- }
- [Serializable]
- private class AnonymousClassFieldCacheRangeFilter1 : FieldCacheRangeFilter<byte?>
- {
- private class AnonymousClassFieldCacheDocIdSet:FieldCacheDocIdSet
- {
+ {
+ }
+ public override DocIdSet GetDocIdSet(IndexReader reader)
+ {
+ Lucene.Net.Search.StringIndex fcsi = Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetStringIndex(reader, field);
+ int lowerPoint = fcsi.BinarySearchLookup(lowerVal);
+ int upperPoint = fcsi.BinarySearchLookup(upperVal);
+
+ int inclusiveLowerPoint;
+ int inclusiveUpperPoint;
+
+ // Hints:
+ // * binarySearchLookup returns 0, if value was null.
+ // * the value is <0 if no exact hit was found, the returned value
+ // is (-(insertion point) - 1)
+ if (lowerPoint == 0)
+ {
+ System.Diagnostics.Debug.Assert(lowerVal == null);
+ inclusiveLowerPoint = 1;
+ }
+ else if (includeLower && lowerPoint > 0)
+ {
+ inclusiveLowerPoint = lowerPoint;
+ }
+ else if (lowerPoint > 0)
+ {
+ inclusiveLowerPoint = lowerPoint + 1;
+ }
+ else
+ {
+ inclusiveLowerPoint = System.Math.Max(1, -lowerPoint - 1);
+ }
+
+ if (upperPoint == 0)
+ {
+ System.Diagnostics.Debug.Assert(upperVal == null);
+ inclusiveUpperPoint = System.Int32.MaxValue;
+ }
+ else if (includeUpper && upperPoint > 0)
+ {
+ inclusiveUpperPoint = upperPoint;
+ }
+ else if (upperPoint > 0)
+ {
+ inclusiveUpperPoint = upperPoint - 1;
+ }
+ else
+ {
+ inclusiveUpperPoint = -upperPoint - 2;
+ }
+
+ if (inclusiveUpperPoint <= 0 || inclusiveLowerPoint > inclusiveUpperPoint)
+ return DocIdSet.EMPTY_DOCIDSET;
+
+ System.Diagnostics.Debug.Assert(inclusiveLowerPoint > 0 && inclusiveUpperPoint > 0);
+
+ // for this DocIdSet, we never need to use TermDocs,
+ // because deleted docs have an order of 0 (null entry in StringIndex)
+ return new AnonymousClassFieldCacheDocIdSet(fcsi, inclusiveLowerPoint, inclusiveUpperPoint, this, reader, false);
+ }
+ }
+ [Serializable]
+ private class AnonymousClassFieldCacheRangeFilter1 : FieldCacheRangeFilter<byte?>
+ {
+ private class AnonymousClassFieldCacheDocIdSet : FieldCacheDocIdSet
+ {
private void InitBlock(sbyte[] values, byte inclusiveLowerPoint, byte inclusiveUpperPoint, FieldCacheRangeFilter<byte?> enclosingInstance)
- {
- this.values = values;
- this.inclusiveLowerPoint = inclusiveLowerPoint;
- this.inclusiveUpperPoint = inclusiveUpperPoint;
- this.enclosingInstance = enclosingInstance;
- }
- private sbyte[] values;
- private byte inclusiveLowerPoint;
- private byte inclusiveUpperPoint;
+ {
+ this.values = values;
+ this.inclusiveLowerPoint = inclusiveLowerPoint;
+ this.inclusiveUpperPoint = inclusiveUpperPoint;
+ this.enclosingInstance = enclosingInstance;
+ }
+ private sbyte[] values;
+ private byte inclusiveLowerPoint;
+ private byte inclusiveUpperPoint;
private FieldCacheRangeFilter<byte?> enclosingInstance;
public FieldCacheRangeFilter<byte?> Enclosing_Instance
- {
- get
- {
- return enclosingInstance;
- }
-
- }
+ {
+ get
+ {
+ return enclosingInstance;
+ }
+
+ }
internal AnonymousClassFieldCacheDocIdSet(sbyte[] values, byte inclusiveLowerPoint, byte inclusiveUpperPoint, FieldCacheRangeFilter<byte?> enclosingInstance, Lucene.Net.Index.IndexReader Param1, bool Param2)
: base(Param1, Param2)
- {
- InitBlock(values, inclusiveLowerPoint, inclusiveUpperPoint, enclosingInstance);
- }
- internal override bool MatchDoc(int doc)
- {
- return values[doc] >= inclusiveLowerPoint && values[doc] <= inclusiveUpperPoint;
- }
- }
- internal AnonymousClassFieldCacheRangeFilter1(string field, Parser parser, byte? lowerVal, byte? upperVal, bool includeLower, bool includeUpper)
+ {
+ InitBlock(values, inclusiveLowerPoint, inclusiveUpperPoint, enclosingInstance);
+ }
+ internal override bool MatchDoc(int doc)
+ {
+ return values[doc] >= inclusiveLowerPoint && values[doc] <= inclusiveUpperPoint;
+ }
+ }
+ internal AnonymousClassFieldCacheRangeFilter1(string field, Parser parser, byte? lowerVal, byte? upperVal, bool includeLower, bool includeUpper)
: base(field, parser, lowerVal, upperVal, includeLower, includeUpper)
- {
- }
- public override DocIdSet GetDocIdSet(IndexReader reader)
- {
- byte inclusiveLowerPoint;
- byte inclusiveUpperPoint;
- if (lowerVal != null)
- {
- byte i = (byte) lowerVal;
- if (!includeLower && i == byte.MaxValue)
- return DocIdSet.EMPTY_DOCIDSET;
- inclusiveLowerPoint = (byte) (includeLower?i:(i + 1));
- }
- else
- {
- inclusiveLowerPoint = byte.MinValue;
- }
- if (upperVal != null)
- {
- byte i = (byte)upperVal;
- if (!includeUpper && i == byte.MinValue)
- return DocIdSet.EMPTY_DOCIDSET;
- inclusiveUpperPoint = (byte) (includeUpper?i:(i - 1));
- }
- else
- {
- inclusiveUpperPoint = byte.MaxValue;
- }
-
- if (inclusiveLowerPoint > inclusiveUpperPoint)
- return DocIdSet.EMPTY_DOCIDSET;
-
- sbyte[] values = Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetBytes(reader, field, (Lucene.Net.Search.ByteParser) parser);
- // we only request the usage of termDocs, if the range contains 0
- return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint, this, reader, (inclusiveLowerPoint <= 0 && inclusiveUpperPoint >= 0));
- }
- }
- [Serializable]
- private class AnonymousClassFieldCacheRangeFilter2 : FieldCacheRangeFilter<short?>
- {
- private class AnonymousClassFieldCacheDocIdSet:FieldCacheDocIdSet
- {
+ {
+ }
+ public override DocIdSet GetDocIdSet(IndexReader reader)
+ {
+ byte inclusiveLowerPoint;
+ byte inclusiveUpperPoint;
+ if (lowerVal != null)
+ {
+ byte i = (byte)lowerVal;
+ if (!includeLower && i == byte.MaxValue)
+ return DocIdSet.EMPTY_DOCIDSET;
+ inclusiveLowerPoint = (byte)(includeLower ? i : (i + 1));
+ }
+ else
+ {
+ inclusiveLowerPoint = byte.MinValue;
+ }
+ if (upperVal != null)
+ {
+ byte i = (byte)upperVal;
+ if (!includeUpper && i == byte.MinValue)
+ return DocIdSet.EMPTY_DOCIDSET;
+ inclusiveUpperPoint = (byte)(includeUpper ? i : (i - 1));
+ }
+ else
+ {
+ inclusiveUpperPoint = byte.MaxValue;
+ }
+
+ if (inclusiveLowerPoint > inclusiveUpperPoint)
+ return DocIdSet.EMPTY_DOCIDSET;
+
+ sbyte[] values = Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetBytes(reader, field, (Lucene.Net.Search.ByteParser)parser);
+ // we only request the usage of termDocs, if the range contains 0
+ return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint, this, reader, (inclusiveLowerPoint <= 0 && inclusiveUpperPoint >= 0));
+ }
+ }
+ [Serializable]
+ private class AnonymousClassFieldCacheRangeFilter2 : FieldCacheRangeFilter<short?>
+ {
+ private class AnonymousClassFieldCacheDocIdSet : FieldCacheDocIdSet
+ {
private void InitBlock(short[] values, short inclusiveLowerPoint, short inclusiveUpperPoint, FieldCacheRangeFilter<short?> enclosingInstance)
- {
- this.values = values;
- this.inclusiveLowerPoint = inclusiveLowerPoint;
- this.inclusiveUpperPoint = inclusiveUpperPoint;
- this.enclosingInstance = enclosingInstance;
- }
- private short[] values;
- private short inclusiveLowerPoint;
- private short inclusiveUpperPoint;
+ {
+ this.values = values;
+ this.inclusiveLowerPoint = inclusiveLowerPoint;
+ this.inclusiveUpperPoint = inclusiveUpperPoint;
+ this.enclosingInstance = enclosingInstance;
+ }
+ private short[] values;
+ private short inclusiveLowerPoint;
+ private short inclusiveUpperPoint;
private FieldCacheRangeFilter<short?> enclosingInstance;
public FieldCacheRangeFilter<short?> Enclosing_Instance
- {
- get
- {
- return enclosingInstance;
- }
-
- }
+ {
+ get
+ {
+ return enclosingInstance;
+ }
+
+ }
internal AnonymousClassFieldCacheDocIdSet(short[] values, short inclusiveLowerPoint, short inclusiveUpperPoint, FieldCacheRangeFilter<short?> enclosingInstance, Lucene.Net.Index.IndexReader Param1, bool Param2)
: base(Param1, Param2)
- {
- InitBlock(values, inclusiveLowerPoint, inclusiveUpperPoint, enclosingInstance);
- }
- internal override bool MatchDoc(int doc)
- {
- return values[doc] >= inclusiveLowerPoint && values[doc] <= inclusiveUpperPoint;
- }
- }
- internal AnonymousClassFieldCacheRangeFilter2(string field, Parser parser, short? lowerVal, short? upperVal, bool includeLower, bool includeUpper)
+ {
+ InitBlock(values, inclusiveLowerPoint, inclusiveUpperPoint, enclosingInstance);
+ }
+ internal override bool MatchDoc(int doc)
+ {
+ return values[doc] >= inclusiveLowerPoint && values[doc] <= inclusiveUpperPoint;
+ }
+ }
+ internal AnonymousClassFieldCacheRangeFilter2(string field, Parser parser, short? lowerVal, short? upperVal, bool includeLower, bool includeUpper)
: base(field, parser, lowerVal, upperVal, includeLower, includeUpper)
- {
- }
- public override DocIdSet GetDocIdSet(IndexReader reader)
- {
- short inclusiveLowerPoint;
- short inclusiveUpperPoint;
- if (lowerVal != null)
- {
- short i = (short)lowerVal;
- if (!includeLower && i == short.MaxValue)
- return DocIdSet.EMPTY_DOCIDSET;
- inclusiveLowerPoint = (short) (includeLower?i:(i + 1));
- }
- else
- {
- inclusiveLowerPoint = short.MinValue;
- }
- if (upperVal != null)
- {
- short i = (short)upperVal;
- if (!includeUpper && i == short.MinValue)
- return DocIdSet.EMPTY_DOCIDSET;
- inclusiveUpperPoint = (short) (includeUpper?i:(i - 1));
- }
- else
- {
- inclusiveUpperPoint = short.MaxValue;
- }
-
- if (inclusiveLowerPoint > inclusiveUpperPoint)
- return DocIdSet.EMPTY_DOCIDSET;
-
- short[] values = Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetShorts(reader, field, (Lucene.Net.Search.ShortParser) parser);
- // we only request the usage of termDocs, if the range contains 0
- return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint, this, reader, (inclusiveLowerPoint <= 0 && inclusiveUpperPoint >= 0));
- }
- }
- [Serializable]
- private class AnonymousClassFieldCacheRangeFilter3 : FieldCacheRangeFilter<int?>
- {
- private class AnonymousClassFieldCacheDocIdSet : FieldCacheDocIdSet
- {
+ {
+ }
+ public override DocIdSet GetDocIdSet(IndexReader reader)
+ {
+ short inclusiveLowerPoint;
+ short inclusiveUpperPoint;
+ if (lowerVal != null)
+ {
+ short i = (short)lowerVal;
+ if (!includeLower && i == short.MaxValue)
+ return DocIdSet.EMPTY_DOCIDSET;
+ inclusiveLowerPoint = (short)(includeLower ? i : (i + 1));
+ }
+ else
+ {
+ inclusiveLowerPoint = short.MinValue;
+ }
+ if (upperVal != null)
+ {
+ short i = (short)upperVal;
+ if (!includeUpper && i == short.MinValue)
+ return DocIdSet.EMPTY_DOCIDSET;
+ inclusiveUpperPoint = (short)(includeUpper ? i : (i - 1));
+ }
+ else
+ {
+ inclusiveUpperPoint = short.MaxValue;
+ }
+
+ if (inclusiveLowerPoint > inclusiveUpperPoint)
+ return DocIdSet.EMPTY_DOCIDSET;
+
+ short[] values = Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetShorts(reader, field, (Lucene.Net.Search.ShortParser)parser);
+ // we only request the usage of termDocs, if the range contains 0
+ return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint, this, reader, (inclusiveLowerPoint <= 0 && inclusiveUpperPoint >= 0));
+ }
+ }
+ [Serializable]
+ private class AnonymousClassFieldCacheRangeFilter3 : FieldCacheRangeFilter<int?>
+ {
+ private class AnonymousClassFieldCacheDocIdSet : FieldCacheDocIdSet
+ {
private void InitBlock(int[] values, int inclusiveLowerPoint, int inclusiveUpperPoint, FieldCacheRangeFilter<int?> enclosingInstance)
- {
- this.values = values;
- this.inclusiveLowerPoint = inclusiveLowerPoint;
- this.inclusiveUpperPoint = inclusiveUpperPoint;
- this.enclosingInstance = enclosingInstance;
- }
- private int[] values;
- private int inclusiveLowerPoint;
- private int inclusiveUpperPoint;
+ {
+ this.values = values;
+ this.inclusiveLowerPoint = inclusiveLowerPoint;
+ this.inclusiveUpperPoint = inclusiveUpperPoint;
+ this.enclosingInstance = enclosingInstance;
+ }
+ private int[] values;
+ private int inclusiveLowerPoint;
+ private int inclusiveUpperPoint;
private FieldCacheRangeFilter<int?> enclosingInstance;
public FieldCacheRangeFilter<int?> Enclosing_Instance
- {
- get
- {
- return enclosingInstance;
- }
-
- }
+ {
+ get
+ {
+ return enclosingInstance;
+ }
+
+ }
internal AnonymousClassFieldCacheDocIdSet(int[] values, int inclusiveLowerPoint, int inclusiveUpperPoint, FieldCacheRangeFilter<int?> enclosingInstance, Lucene.Net.Index.IndexReader Param1, bool Param2)
: base(Param1, Param2)
- {
- InitBlock(values, inclusiveLowerPoint, inclusiveUpperPoint, enclosingInstance);
- }
- internal override bool MatchDoc(int doc)
- {
- return values[doc] >= inclusiveLowerPoint && values[doc] <= inclusiveUpperPoint;
- }
- }
- internal AnonymousClassFieldCacheRangeFilter3(string field, Lucene.Net.Search.Parser parser, int? lowerVal, int? upperVal, bool includeLower, bool includeUpper)
+ {
+ InitBlock(values, inclusiveLowerPoint, inclusiveUpperPoint, enclosingInstance);
+ }
+ internal override bool MatchDoc(int doc)
+ {
+ return values[doc] >= inclusiveLowerPoint && values[doc] <= inclusiveUpperPoint;
+ }
+ }
+ internal AnonymousClassFieldCacheRangeFilter3(string field, Lucene.Net.Search.Parser parser, int? lowerVal, int? upperVal, bool includeLower, bool includeUpper)
: base(field, parser, lowerVal, upperVal, includeLower, includeUpper)
- {
- }
- public override DocIdSet GetDocIdSet(IndexReader reader)
- {
- int inclusiveLowerPoint;
- int inclusiveUpperPoint;
- if (lowerVal != null)
- {
- int i = (int) lowerVal;
- if (!includeLower && i == int.MaxValue)
- return DocIdSet.EMPTY_DOCIDSET;
- inclusiveLowerPoint = includeLower?i:(i + 1);
- }
- else
- {
- inclusiveLowerPoint = int.MinValue;
- }
- if (upperVal != null)
- {
- int i = (int) upperVal;
- if (!includeUpper && i == int.MinValue)
- return DocIdSet.EMPTY_DOCIDSET;
- inclusiveUpperPoint = includeUpper?i:(i - 1);
- }
- else
- {
- inclusiveUpperPoint = int.MaxValue;
- }
-
- if (inclusiveLowerPoint > inclusiveUpperPoint)
- return DocIdSet.EMPTY_DOCIDSET;
-
- int[] values = Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetInts(reader, field, (Lucene.Net.Search.IntParser) parser);
- // we only request the usage of termDocs, if the range contains 0
- return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint, this, reader, (inclusiveLowerPoint <= 0 && inclusiveUpperPoint >= 0));
- }
- }
- [Serializable]
- private class AnonymousClassFieldCacheRangeFilter4 : FieldCacheRangeFilter<long?>
- {
- private class AnonymousClassFieldCacheDocIdSet:FieldCacheDocIdSet
- {
+ {
+ }
+ public override DocIdSet GetDocIdSet(IndexReader reader)
+ {
+ int inclusiveLowerPoint;
+ int inclusiveUpperPoint;
+ if (lowerVal != null)
+ {
+ int i = (int)lowerVal;
+ if (!includeLower && i == int.MaxValue)
+ return DocIdSet.EMPTY_DOCIDSET;
+ inclusiveLowerPoint = includeLower ? i : (i + 1);
+ }
+ else
+ {
+ inclusiveLowerPoint = int.MinValue;
+ }
+ if (upperVal != null)
+ {
+ int i = (int)upperVal;
+ if (!includeUpper && i == int.MinValue)
+ return DocIdSet.EMPTY_DOCIDSET;
+ inclusiveUpperPoint = includeUpper ? i : (i - 1);
+ }
+ else
+ {
+ inclusiveUpperPoint = int.MaxValue;
+ }
+
+ if (inclusiveLowerPoint > inclusiveUpperPoint)
+ return DocIdSet.EMPTY_DOCIDSET;
+
+ int[] values = Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetInts(reader, field, (Lucene.Net.Search.IntParser)parser);
+ // we only request the usage of termDocs, if the range contains 0
+ return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint, this, reader, (inclusiveLowerPoint <= 0 && inclusiveUpperPoint >= 0));
+ }
+ }
+ [Serializable]
+ private class AnonymousClassFieldCacheRangeFilter4 : FieldCacheRangeFilter<long?>
+ {
+ private class AnonymousClassFieldCacheDocIdSet : FieldCacheDocIdSet
+ {
private void InitBlock(long[] values, long inclusiveLowerPoint, long inclusiveUpperPoint, FieldCacheRangeFilter<long?> enclosingInstance)
- {
- this.values = values;
- this.inclusiveLowerPoint = inclusiveLowerPoint;
- this.inclusiveUpperPoint = inclusiveUpperPoint;
- this.enclosingInstance = enclosingInstance;
- }
- private long[] values;
- private long inclusiveLowerPoint;
- private long inclusiveUpperPoint;
+ {
+ this.values = values;
+ this.inclusiveLowerPoint = inclusiveLowerPoint;
+ this.inclusiveUpperPoint = inclusiveUpperPoint;
+ this.enclosingInstance = enclosingInstance;
+ }
+ private long[] values;
+ private long inclusiveLowerPoint;
+ private long inclusiveUpperPoint;
private FieldCacheRangeFilter<long?> enclosingInstance;
public FieldCacheRangeFilter<long?> Enclosing_Instance
- {
- get
- {
- return enclosingInstance;
- }
-
- }
+ {
+ get
+ {
+ return enclosingInstance;
+ }
+
+ }
internal AnonymousClassFieldCacheDocIdSet(long[] values, long inclusiveLowerPoint, long inclusiveUpperPoint, FieldCacheRangeFilter<long?> enclosingInstance, Lucene.Net.Index.IndexReader Param1, bool Param2)
: base(Param1, Param2)
- {
- InitBlock(values, inclusiveLowerPoint, inclusiveUpperPoint, enclosingInstance);
- }
- internal override bool MatchDoc(int doc)
- {
- return values[doc] >= inclusiveLowerPoint && values[doc] <= inclusiveUpperPoint;
- }
- }
- internal AnonymousClassFieldCacheRangeFilter4(string field, Lucene.Net.Search.Parser parser, long? lowerVal, long? upperVal, bool includeLower, bool includeUpper)
+ {
+ InitBlock(values, inclusiveLowerPoint, inclusiveUpperPoint, enclosingInstance);
+ }
+ internal override bool MatchDoc(int doc)
+ {
+ return values[doc] >= inclusiveLowerPoint && values[doc] <= inclusiveUpperPoint;
+ }
+ }
+ internal AnonymousClassFieldCacheRangeFilter4(string field, Lucene.Net.Search.Parser parser, long? lowerVal, long? upperVal, bool includeLower, bool includeUpper)
: base(field, parser, lowerVal, upperVal, includeLower, includeUpper)
- {
- }
- public override DocIdSet GetDocIdSet(IndexReader reader)
- {
- long inclusiveLowerPoint;
- long inclusiveUpperPoint;
- if (lowerVal != null)
- {
- long i = (long)lowerVal;
- if (!includeLower && i == long.MaxValue)
- return DocIdSet.EMPTY_DOCIDSET;
- inclusiveLowerPoint = includeLower?i:(i + 1L);
- }
- else
- {
- inclusiveLowerPoint = long.MinValue;
- }
- if (upperVal != null)
- {
- long i = (long)upperVal;
- if (!includeUpper && i == long.MinValue)
- return DocIdSet.EMPTY_DOCIDSET;
- inclusiveUpperPoint = includeUpper?i:(i - 1L);
- }
- else
- {
- inclusiveUpperPoint = long.MaxValue;
- }
-
- if (inclusiveLowerPoint > inclusiveUpperPoint)
- return DocIdSet.EMPTY_DOCIDSET;
-
- long[] values = Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetLongs(reader, field, (Lucene.Net.Search.LongParser) parser);
- // we only request the usage of termDocs, if the range contains 0
- return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint, this, reader, (inclusiveLowerPoint <= 0L && inclusiveUpperPoint >= 0L));
- }
- }
- [Serializable]
- private class AnonymousClassFieldCacheRangeFilter5 : FieldCacheRangeFilter<float?>
- {
- private class AnonymousClassFieldCacheDocIdSet:FieldCacheDocIdSet
- {
+ {
+ }
+ public override DocIdSet GetDocIdSet(IndexReader reader)
+ {
+ long inclusiveLowerPoint;
+ long inclusiveUpperPoint;
+ if (lowerVal != null)
+ {
+ long i = (long)lowerVal;
+ if (!includeLower && i == long.MaxValue)
+ return DocIdSet.EMPTY_DOCIDSET;
+ inclusiveLowerPoint = includeLower ? i : (i + 1L);
+ }
+ else
+ {
+ inclusiveLowerPoint = long.MinValue;
+ }
+ if (upperVal != null)
+ {
+ long i = (long)upperVal;
+ if (!includeUpper && i == long.MinValue)
+ return DocIdSet.EMPTY_DOCIDSET;
+ inclusiveUpperPoint = includeUpper ? i : (i - 1L);
+ }
+ else
+ {
+ inclusiveUpperPoint = long.MaxValue;
+ }
+
+ if (inclusiveLowerPoint > inclusiveUpperPoint)
+ return DocIdSet.EMPTY_DOCIDSET;
+
+ long[] values = Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetLongs(reader, field, (Lucene.Net.Search.LongParser)parser);
+ // we only request the usage of termDocs, if the range contains 0
+ return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint, this, reader, (inclusiveLowerPoint <= 0L && inclusiveUpperPoint >= 0L));
+ }
+ }
+ [Serializable]
+ private class AnonymousClassFieldCacheRangeFilter5 : FieldCacheRangeFilter<float?>
+ {
+ private class AnonymousClassFieldCacheDocIdSet : FieldCacheDocIdSet
+ {
private void InitBlock(float[] values, float inclusiveLowerPoint, float inclusiveUpperPoint, FieldCacheRangeFilter<float?> enclosingInstance)
- {
- this.values = values;
- this.inclusiveLowerPoint = inclusiveLowerPoint;
- this.inclusiveUpperPoint = inclusiveUpperPoint;
- this.enclosingInstance = enclosingInstance;
- }
- private float[] values;
- private float inclusiveLowerPoint;
- private float inclusiveUpperPoint;
+ {
+ this.values = values;
+ this.inclusiveLowerPoint = inclusiveLowerPoint;
+ this.inclusiveUpperPoint = inclusiveUpperPoint;
+ this.enclosingInstance = enclosingInstance;
+ }
+ private float[] values;
+ private float inclusiveLowerPoint;
+ private float inclusiveUpperPoint;
private FieldCacheRangeFilter<float?> enclosingInstance;
public FieldCacheRangeFilter<float?> Enclosing_Instance
- {
- get
- {
- return enclosingInstance;
- }
-
- }
+ {
+ get
+ {
+ return enclosingInstance;
+ }
+
+ }
internal AnonymousClassFieldCacheDocIdSet(float[] values, float inclusiveLowerPoint, float inclusiveUpperPoint, FieldCacheRangeFilter<float?> enclosingInstance, Lucene.Net.Index.IndexReader Param1, bool Param2)
: base(Param1, Param2)
- {
- InitBlock(values, inclusiveLowerPoint, inclusiveUpperPoint, enclosingInstance);
- }
- internal override bool MatchDoc(int doc)
- {
- return values[doc] >= inclusiveLowerPoint && values[doc] <= inclusiveUpperPoint;
- }
- }
- internal AnonymousClassFieldCacheRangeFilter5(string field, Lucene.Net.Search.Parser parser, float? lowerVal, float? upperVal, bool includeLower, bool includeUpper)
+ {
+ InitBlock(values, inclusiveLowerPoint, inclusiveUpperPoint, enclosingInstance);
+ }
+ internal override bool MatchDoc(int doc)
+ {
+ return values[doc] >= inclusiveLowerPoint && values[doc] <= inclusiveUpperPoint;
+ }
+ }
+ internal AnonymousClassFieldCacheRangeFilter5(string field, Lucene.Net.Search.Parser parser, float? lowerVal, float? upperVal, bool includeLower, bool includeUpper)
: base(field, parser, lowerVal, upperVal, includeLower, includeUpper)
- {
- }
- public override DocIdSet GetDocIdSet(IndexReader reader)
- {
- // we transform the floating point numbers to sortable integers
- // using NumericUtils to easier find the next bigger/lower value
- float inclusiveLowerPoint;
- float inclusiveUpperPoint;
- if (lowerVal != null)
- {
- float f = (float)lowerVal;
- if (!includeUpper && f > 0.0f && float.IsInfinity(f))
- return DocIdSet.EMPTY_DOCIDSET;
- int i = NumericUtils.FloatToSortableInt(f);
- inclusiveLowerPoint = NumericUtils.SortableIntToFloat(includeLower?i:(i + 1));
- }
- else
- {
- inclusiveLowerPoint = float.NegativeInfinity;
- }
- if (upperVal != null)
- {
- float f = (float) upperVal;
- if (!includeUpper && f < 0.0f && float.IsInfinity(f))
- return DocIdSet.EMPTY_DOCIDSET;
- int i = NumericUtils.FloatToSortableInt(f);
- inclusiveUpperPoint = NumericUtils.SortableIntToFloat(includeUpper?i:(i - 1));
- }
- else
- {
- inclusiveUpperPoint = float.PositiveInfinity;
- }
-
- if (inclusiveLowerPoint > inclusiveUpperPoint)
- return DocIdSet.EMPTY_DOCIDSET;
-
- float[] values = Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetFloats(reader, field, (Lucene.Net.Search.FloatParser) parser);
- // we only request the usage of termDocs, if the range contains 0
- return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint, this, reader, (inclusiveLowerPoint <= 0.0f && inclusiveUpperPoint >= 0.0f));
- }
- }
- [Serializable]
- private class AnonymousClassFieldCacheRangeFilter6 : FieldCacheRangeFilter<double?>
- {
- private class AnonymousClassFieldCacheDocIdSet:FieldCacheDocIdSet
- {
+ {
+ }
+ public override DocIdSet GetDocIdSet(IndexReader reader)
+ {
+ // we transform the floating point numbers to sortable integers
+ // using NumericUtils to easier find the next bigger/lower value
+ float inclusiveLowerPoint;
+ float inclusiveUpperPoint;
+ if (lowerVal != null)
+ {
+ float f = (float)lowerVal;
+ if (!includeUpper && f > 0.0f && float.IsInfinity(f))
+ return DocIdSet.EMPTY_DOCIDSET;
+ int i = NumericUtils.FloatToSortableInt(f);
+ inclusiveLowerPoint = NumericUtils.SortableIntToFloat(includeLower ? i : (i + 1));
+ }
+ else
+ {
+ inclusiveLowerPoint = float.NegativeInfinity;
+ }
+ if (upperVal != null)
+ {
+ float f = (float)upperVal;
+ if (!includeUpper && f < 0.0f && float.IsInfinity(f))
+ return DocIdSet.EMPTY_DOCIDSET;
+ int i = NumericUtils.FloatToSortableInt(f);
+ inclusiveUpperPoint = NumericUtils.SortableIntToFloat(includeUpper ? i : (i - 1));
+ }
+ else
+ {
+ inclusiveUpperPoint = float.PositiveInfinity;
+ }
+
+ if (inclusiveLowerPoint > inclusiveUpperPoint)
+ return DocIdSet.EMPTY_DOCIDSET;
+
+ float[] values = Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetFloats(reader, field, (Lucene.Net.Search.FloatParser)parser);
+ // we only request the usage of termDocs, if the range contains 0
+ return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint, this, reader, (inclusiveLowerPoint <= 0.0f && inclusiveUpperPoint >= 0.0f));
+ }
+ }
+ [Serializable]
+ private class AnonymousClassFieldCacheRangeFilter6 : FieldCacheRangeFilter<double?>
+ {
+ private class AnonymousClassFieldCacheDocIdSet : FieldCacheDocIdSet
+ {
private void InitBlock(double[] values, double inclusiveLowerPoint, double inclusiveUpperPoint, FieldCacheRangeFilter<double?> enclosingInstance)
- {
- this.values = values;
- this.inclusiveLowerPoint = inclusiveLowerPoint;
- this.inclusiveUpperPoint = inclusiveUpperPoint;
- this.enclosingInstance = enclosingInstance;
- }
- private double[] values;
- private double inclusiveLowerPoint;
- private double inclusiveUpperPoint;
+ {
+ this.values = values;
+ this.inclusiveLowerPoint = inclusiveLowerPoint;
+ this.inclusiveUpperPoint = inclusiveUpperPoint;
+ this.enclosingInstance = enclosingInstance;
+ }
+ private double[] values;
+ private double inclusiveLowerPoint;
+ private double inclusiveUpperPoint;
private FieldCacheRangeFilter<double?> enclosingInstance;
public FieldCacheRangeFilter<double?> Enclosing_Instance
- {
- get
- {
- return enclosingInstance;
- }
-
- }
+ {
+ get
+ {
+ return enclosingInstance;
+ }
+
+ }
internal AnonymousClassFieldCacheDocIdSet(double[] values, double inclusiveLowerPoint, double inclusiveUpperPoint, FieldCacheRangeFilter<double?> enclosingInstance, Lucene.Net.Index.IndexReader Param1, bool Param2)
: base(Param1, Param2)
- {
- InitBlock(values, inclusiveLowerPoint, inclusiveUpperPoint, enclosingInstance);
- }
- internal override bool MatchDoc(int doc)
- {
- return values[doc] >= inclusiveLowerPoint && values[doc] <= inclusiveUpperPoint;
- }
- }
- internal AnonymousClassFieldCacheRangeFilter6(string field, Lucene.Net.Search.Parser parser, double? lowerVal, double? upperVal, bool includeLower, bool includeUpper)
+ {
+ InitBlock(values, inclusiveLowerPoint, inclusiveUpperPoint, enclosingInstance);
+ }
+ internal override bool MatchDoc(int doc)
+ {
+ return values[doc] >= inclusiveLowerPoint && values[doc] <= inclusiveUpperPoint;
+ }
+ }
+ internal AnonymousClassFieldCacheRangeFilter6(string field, Lucene.Net.Search.Parser parser, double? lowerVal, double? upperVal, bool includeLower, bool includeUpper)
: base(field, parser, lowerVal, upperVal, includeLower, includeUpper)
- {
- }
- public override DocIdSet GetDocIdSet(IndexReader reader)
- {
- // we transform the floating point numbers to sortable integers
- // using NumericUtils to easier find the next bigger/lower value
- double inclusiveLowerPoint;
- double inclusiveUpperPoint;
- if (lowerVal != null)
- {
- double f = (double) lowerVal;
- if (!includeUpper && f > 0.0 && double.IsInfinity(f))
- return DocIdSet.EMPTY_DOCIDSET;
- long i = NumericUtils.DoubleToSortableLong(f);
- inclusiveLowerPoint = NumericUtils.SortableLongToDouble(includeLower ? i : (i + 1L));
- }
- else
- {
- inclusiveLowerPoint = double.NegativeInfinity;
- }
- if (upperVal != null)
- {
- double f = (double) upperVal;
- if (!includeUpper && f < 0.0 && double.IsInfinity(f))
- return DocIdSet.EMPTY_DOCIDSET;
- long i = NumericUtils.DoubleToSortableLong(f);
- inclusiveUpperPoint = NumericUtils.SortableLongToDouble(includeUpper?i:(i - 1L));
- }
- else
- {
- inclusiveUpperPoint = double.PositiveInfinity;
- }
-
- if (inclusiveLowerPoint > inclusiveUpperPoint)
- return DocIdSet.EMPTY_DOCIDSET;
-
- double[] values = Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetDoubles(reader, field, (Lucene.Net.Search.DoubleParser) parser);
- // we only request the usage of termDocs, if the range contains 0
- return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint, this, reader, (inclusiveLowerPoint <= 0.0 && inclusiveUpperPoint >= 0.0));
- }
- }
+ {
+ }
+ public override DocIdSet GetDocIdSet(IndexReader reader)
+ {
+ // we transform the floating point numbers to sortable integers
+ // using NumericUtils to easier find the next bigger/lower value
+ double inclusiveLowerPoint;
+ double inclusiveUpperPoint;
+ if (lowerVal != null)
+ {
+ double f = (double)lowerVal;
+ if (!includeUpper && f > 0.0 && double.IsInfinity(f))
+ return DocIdSet.EMPTY_DOCIDSET;
+ long i = NumericUtils.DoubleToSortableLong(f);
+ inclusiveLowerPoint = NumericUtils.SortableLongToDouble(includeLower ? i : (i + 1L));
+ }
+ else
+ {
+ inclusiveLowerPoint = double.NegativeInfinity;
+ }
+ if (upperVal != null)
+ {
+ double f = (double)upperVal;
+ if (!includeUpper && f < 0.0 && double.IsInfinity(f))
+ return DocIdSet.EMPTY_DOCIDSET;
+ long i = NumericUtils.DoubleToSortableLong(f);
+ inclusiveUpperPoint = NumericUtils.SortableLongToDouble(includeUpper ? i : (i - 1L));
+ }
+ else
+ {
+ inclusiveUpperPoint = double.PositiveInfinity;
+ }
+
+ if (inclusiveLowerPoint > inclusiveUpperPoint)
+ return DocIdSet.EMPTY_DOCIDSET;
+
+ double[] values = Lucene.Net.Search.FieldCache_Fields.DEFAULT.GetDoubles(reader, field, (Lucene.Net.Search.DoubleParser)parser);
+ // we only request the usage of termDocs, if the range contains 0
+ return new AnonymousClassFieldCacheDocIdSet(values, inclusiveLowerPoint, inclusiveUpperPoint, this, reader, (inclusiveLowerPoint <= 0.0 && inclusiveUpperPoint >= 0.0));
+ }
+ }
+
+ /// <summary> Creates a string range filter using <see cref="FieldCache.GetStringIndex(IndexReader,string)" />. This works with all
+ /// fields containing zero or one term in the field. The range can be half-open by setting one
+ /// of the values to <c>null</c>.
+ /// </summary>
+ public static FieldCacheRangeFilter<string> NewStringRange(string field, string lowerVal, string upperVal, bool includeLower, bool includeUpper)
+ {
+ return new AnonymousClassFieldCacheRangeFilter(field, null, lowerVal, upperVal, includeLower, includeUpper);
+ }
+
+ /// <summary> Creates a numeric range filter using <see cref="FieldCache.GetBytes(IndexReader,String)" />. This works with all
+ /// byte fields containing exactly one numeric term in the field. The range can be half-open by setting one
+ /// of the values to <c>null</c>.
+ /// </summary>
+ public static FieldCacheRangeFilter<byte?> NewByteRange(string field, byte? lowerVal, byte? upperVal, bool includeLower, bool includeUpper)
+ {
+ return NewByteRange(field, null, lowerVal, upperVal, includeLower, includeUpper);
+ }
+
+ /// <summary> Creates a numeric range filter using <see cref="FieldCache.GetBytes(IndexReader,String,ByteParser)" />. This works with all
+ /// byte fields containing exactly one numeric term in the field. The range can be half-open by setting one
+ /// of the values to <c>null</c>.
+ /// </summary>
+ public static FieldCacheRangeFilter<byte?> NewByteRange(string field, Lucene.Net.Search.ByteParser parser, byte? lowerVal, byte? upperVal, bool includeLower, bool includeUpper)
+ {
+ return new AnonymousClassFieldCacheRangeFilter1(field, parser, lowerVal, upperVal, includeLower, includeUpper);
+ }
+
+ /// <summary> Creates a numeric range query using <see cref="FieldCache.GetShorts(IndexReader,String)" />. This works with all
+ /// short fields containing exactly one numeric term in the field. The range can be half-open by setting one
+ /// of the values to <c>null</c>.
+ /// </summary>
+ public static FieldCacheRangeFilter<short?> NewShortRange(string field, short? lowerVal, short? upperVal, bool includeLower, bool includeUpper)
+ {
+ return NewShortRange(field, null, lowerVal, upperVal, includeLower, includeUpper);
+ }
+
+ /// <summary> Creates a numeric range query using <see cref="FieldCache.GetShorts(IndexReader,String,ShortParser)" />. This works with all
+ /// short fields containing exactly one numeric term in the field. The range can be half-open by setting one
+ /// of the values to <c>null</c>.
+ /// </summary>
+ public static FieldCacheRangeFilter<short?> NewShortRange(string field, Lucene.Net.Search.ShortParser parser, short? lowerVal, short? upperVal, bool includeLower, bool includeUpper)
+ {
+ return new AnonymousClassFieldCacheRangeFilter2(field, parser, lowerVal, upperVal, includeLower, includeUpper);
+ }
+
+ /// <summary> Creates a numeric range query using <see cref="FieldCache.GetInts(IndexReader,String)" />. This works with all
+ /// int fields containing exactly one numeric term in the field. The range can be half-open by setting one
+ /// of the values to <c>null</c>.
+ /// </summary>
+ public static FieldCacheRangeFilter<int?> NewIntRange(string field, int? lowerVal, int? upperVal, bool includeLower, bool includeUpper)
+ {
+ return NewIntRange(field, null, lowerVal, upperVal, includeLower, includeUpper);
+ }
+
+ /// <summary> Creates a numeric range query using <see cref="FieldCache.GetInts(IndexReader,String,IntParser)" />. This works with all
+ /// int fields containing exactly one numeric term in the field. The range can be half-open by setting one
+ /// of the values to <c>null</c>.
+ /// </summary>
+ public static FieldCacheRangeFilter<int?> NewIntRange(string field, Lucene.Net.Search.IntParser parser, int? lowerVal, int? upperVal, bool includeLower, bool includeUpper)
+ {
+ return new AnonymousClassFieldCacheRangeFilter3(field, parser, lowerVal, upperVal, includeLower, includeUpper);
+ }
+
+ /// <summary> Creates a numeric range query using <see cref="FieldCache.GetLongs(IndexReader,String)" />. This works with all
+ /// long fields containing exactly one numeric term in the field. The range can be half-open by setting one
+ /// of the values to <c>null</c>.
+ /// </summary>
+ public static FieldCacheRangeFilter<long?> NewLongRange(string field, long? lowerVal, long? upperVal, bool includeLower, bool includeUpper)
+ {
+ return NewLongRange(field, null, lowerVal, upperVal, includeLower, includeUpper);
+ }
+
+ /// <summary> Creates a numeric range query using <see cref="FieldCache.GetLongs(IndexReader,String,LongParser)" />. This works with all
+ /// long fields containing exactly one numeric term in the field. The range can be half-open by setting one
+ /// of the values to <c>null</c>.
+ /// </summary>
+ public static FieldCacheRangeFilter<long?> NewLongRange(string field, Lucene.Net.Search.LongParser parser, long? lowerVal, long? upperVal, bool includeLower, bool includeUpper)
+ {
+ return new AnonymousClassFieldCacheRangeFilter4(field, parser, lowerVal, upperVal, includeLower, includeUpper);
+ }
+
+ /// <summary> Creates a numeric range query using <see cref="FieldCache.GetFloats(IndexReader,String)" />. This works with all
+ /// float fields containing exactly one numeric term in the field. The range can be half-open by setting one
+ /// of the values to <c>null</c>.
+ /// </summary>
+ public static FieldCacheRangeFilter<float?> NewFloatRange(string field, float? lowerVal, float? upperVal, bool includeLower, bool includeUpper)
+ {
+ return NewFloatRange(field, null, lowerVal, upperVal, includeLower, includeUpper);
+ }
+
+ /// <summary> Creates a numeric range query using <see cref="FieldCache.GetFloats(IndexReader,String,FloatParser)" />. This works with all
+ /// float fields containing exactly one numeric term in the field. The range can be half-open by setting one
+ /// of the values to <c>null</c>.
+ /// </summary>
+ public static FieldCacheRangeFilter<float?> NewFloatRange(string field, Lucene.Net.Search.FloatParser parser, float? lowerVal, float? upperVal, bool includeLower, bool includeUpper)
+ {
+ return new AnonymousClassFieldCacheRangeFilter5(field, parser, lowerVal, upperVal, includeLower, includeUpper);
+ }
+
+ /// <summary> Creates a numeric range query using <see cref="FieldCache.GetDoubles(IndexReader,String)" />. This works with all
+ /// double fields containing exactly one numeric term in the field. The range can be half-open by setting one
+ /// of the values to <c>null</c>.
+ /// </summary>
+ public static FieldCacheRangeFilter<double?> NewDoubleRange(string field, double? lowerVal, double? upperVal, bool includeLower, bool includeUpper)
+ {
+ return NewDoubleRange(field, null, lowerVal, upperVal, includeLower, includeUpper);
+ }
+
+ /// <summary> Creates a numeric range query using <see cref="FieldCache.GetDoubles(IndexReader,String,DoubleParser)" />. This works with all
+ /// double fields containing exactly one numeric term in the field. The range can be half-open by setting one
+ /// of the values to <c>null</c>.
+ /// </summary>
+ public static FieldCacheRangeFilter<double?> NewDoubleRange(string field, Lucene.Net.Search.DoubleParser parser, double? lowerVal, double? upperVal, bool includeLower, bool includeUpper)
+ {
+ return new AnonymousClassFieldCacheRangeFilter6(field, parser, lowerVal, upperVal, includeLower, includeUpper);
+ }
+ }
+
+ [Serializable]
+ public abstract class FieldCacheRangeFilter<T> : Filter
+ {
internal System.String field;
internal Lucene.Net.Search.Parser parser;
internal T lowerVal;
@@ -605,7 +726,7 @@ namespace Lucene.Net.Search
internal bool includeLower;
internal bool includeUpper;
- private FieldCacheRangeFilter(System.String field, Lucene.Net.Search.Parser parser, T lowerVal, T upperVal, bool includeLower, bool includeUpper)
+ protected internal FieldCacheRangeFilter(System.String field, Lucene.Net.Search.Parser parser, T lowerVal, T upperVal, bool includeLower, bool includeUpper)
{
this.field = field;
this.parser = parser;
@@ -618,123 +739,6 @@ namespace Lucene.Net.Search
/// <summary>This method is implemented for each data type </summary>
public abstract override DocIdSet GetDocIdSet(IndexReader reader);
- /// <summary> Creates a string range filter using <see cref="FieldCache.GetStringIndex(IndexReader,string)" />. This works with all
- /// fields containing zero or one term in the field. The range can be half-open by setting one
- /// of the values to <c>null</c>.
- /// </summary>
- public static FieldCacheRangeFilter<string> NewStringRange(string field, string lowerVal, string upperVal, bool includeLower, bool includeUpper)
- {
- return new AnonymousClassFieldCacheRangeFilter(field, null, lowerVal, upperVal, includeLower, includeUpper);
- }
-
- /// <summary> Creates a numeric range filter using <see cref="FieldCache.GetBytes(IndexReader,String)" />. This works with all
- /// byte fields containing exactly one numeric term in the field. The range can be half-open by setting one
- /// of the values to <c>null</c>.
- /// </summary>
- public static FieldCacheRangeFilter<byte?> NewByteRange(string field, byte? lowerVal, byte? upperVal, bool includeLower, bool includeUpper)
- {
- return NewByteRange(field, null, lowerVal, upperVal, includeLower, includeUpper);
- }
-
- /// <summary> Creates a numeric range filter using <see cref="FieldCache.GetBytes(IndexReader,String,ByteParser)" />. This works with all
- /// byte fields containing exactly one numeric term in the field. The range can be half-open by setting one
- /// of the values to <c>null</c>.
- /// </summary>
- public static FieldCacheRangeFilter<byte?> NewByteRange(string field, Lucene.Net.Search.ByteParser parser, byte? lowerVal, byte? upperVal, bool includeLower, bool includeUpper)
- {
- return new AnonymousClassFieldCacheRangeFilter1(field, parser, lowerVal, upperVal, includeLower, includeUpper);
- }
-
- /// <summary> Creates a numeric range query using <see cref="FieldCache.GetShorts(IndexReader,String)" />. This works with all
- /// short fields containing exactly one numeric term in the field. The range can be half-open by setting one
- /// of the values to <c>null</c>.
- /// </summary>
- public static FieldCacheRangeFilter<short?> NewShortRange(string field, short? lowerVal, short? upperVal, bool includeLower, bool includeUpper)
- {
- return NewShortRange(field, null, lowerVal, upperVal, includeLower, includeUpper);
- }
-
- /// <summary> Creates a numeric range query using <see cref="FieldCache.GetShorts(IndexReader,String,ShortParser)" />. This works with all
- /// short fields containing exactly one numeric term in the field. The range can be half-open by setting one
- /// of the values to <c>null</c>.
- /// </summary>
- public static FieldCacheRangeFilter<short?> NewShortRange(string field, Lucene.Net.Search.ShortParser parser, short? lowerVal, short? upperVal, bool includeLower, bool includeUpper)
- {
- return new AnonymousClassFieldCacheRangeFilter2(field, parser, lowerVal, upperVal, includeLower, includeUpper);
- }
-
- /// <summary> Creates a numeric range query using <see cref="FieldCache.GetInts(IndexReader,String)" />. This works with all
- /// int fields containing exactly one numeric term in the field. The range can be half-open by setting one
- /// of the values to <c>null</c>.
- /// </summary>
- public static FieldCacheRangeFilter<int?> NewIntRange(string field, int? lowerVal, int? upperVal, bool includeLower, bool includeUpper)
- {
- return NewIntRange(field, null, lowerVal, upperVal, includeLower, includeUpper);
- }
-
- /// <summary> Creates a numeric range query using <see cref="FieldCache.GetInts(IndexReader,String,IntParser)" />. This works with all
- /// int fields containing exactly one numeric term in the field. The range can be half-open by setting one
- /// of the values to <c>null</c>.
- /// </summary>
- public static FieldCacheRangeFilter<int?> NewIntRange(string field, Lucene.Net.Search.IntParser parser, int? lowerVal, int? upperVal, bool includeLower, bool includeUpper)
- {
- return new AnonymousClassFieldCacheRangeFilter3(field, parser, lowerVal, upperVal, includeLower, includeUpper);
- }
-
- /// <summary> Creates a numeric range query using <see cref="FieldCache.GetLongs(IndexReader,String)" />. This works with all
- /// long fields containing exactly one numeric term in the field. The range can be half-open by setting one
- /// of the values to <c>null</c>.
- /// </summary>
- public static FieldCacheRangeFilter<long?> NewLongRange(string field, long? lowerVal, long? upperVal, bool includeLower, bool includeUpper)
- {
- return NewLongRange(field, null, lowerVal, upperVal, includeLower, includeUpper);
- }
-
- /// <summary> Creates a numeric range query using <see cref="FieldCache.GetLongs(IndexReader,String,LongParser)" />. This works with all
- /// long fields containing exactly one numeric term in the field. The range can be half-open by setting one
- /// of the values to <c>null</c>.
- /// </summary>
- public static FieldCacheRangeFilter<long?> NewLongRange(string field, Lucene.Net.Search.LongParser parser, long? lowerVal, long? upperVal, bool includeLower, bool includeUpper)
- {
- return new AnonymousClassFieldCacheRangeFilter4(field, parser, lowerVal, upperVal, includeLower, includeUpper);
- }
-
- /// <summary> Creates a numeric range query using <see cref="FieldCache.GetFloats(IndexReader,String)" />. This works with all
- /// float fields containing exactly one numeric term in the field. The range can be half-open by setting one
- /// of the values to <c>null</c>.
- /// </summary>
- public static FieldCacheRangeFilter<float?> NewFloatRange(string field, float? lowerVal, float? upperVal, bool includeLower, bool includeUpper)
- {
- return NewFloatRange(field, null, lowerVal, upperVal, includeLower, includeUpper);
- }
-
- /// <summary> Creates a numeric range query using <see cref="FieldCache.GetFloats(IndexReader,String,FloatParser)" />. This works with all
- /// float fields containing exactly one numeric term in the field. The range can be half-open by setting one
- /// of the values to <c>null</c>.
- /// </summary>
- public static FieldCacheRangeFilter<float?> NewFloatRange(string field, Lucene.Net.Search.FloatParser parser, float? lowerVal, float? upperVal, bool includeLower, bool includeUpper)
- {
- return new AnonymousClassFieldCacheRangeFilter5(field, parser, lowerVal, upperVal, includeLower, includeUpper);
- }
-
- /// <summary> Creates a numeric range query using <see cref="FieldCache.GetDoubles(IndexReader,String)" />. This works with all
- /// double fields containing exactly one numeric term in the field. The range can be half-open by setting one
- /// of the values to <c>null</c>.
- /// </summary>
- public static FieldCacheRangeFilter<double?> NewDoubleRange(string field, double? lowerVal, double? upperVal, bool includeLower, bool includeUpper)
- {
- return NewDoubleRange(field, null, lowerVal, upperVal, includeLower, includeUpper);
- }
-
- /// <summary> Creates a numeric range query using <see cref="FieldCache.GetDoubles(IndexReader,String,DoubleParser)" />. This works with all
- /// double fields containing exactly one numeric term in the field. The range can be half-open by setting one
- /// of the values to <c>null</c>.
- /// </summary>
- public static FieldCacheRangeFilter<double?> NewDoubleRange(string field, Lucene.Net.Search.DoubleParser parser, double? lowerVal, double? upperVal, bool includeLower, bool includeUpper)
- {
- return new AnonymousClassFieldCacheRangeFilter6(field, parser, lowerVal, upperVal, includeLower, includeUpper);
- }
-
public override System.String ToString()
{
System.Text.StringBuilder sb = new System.Text.StringBuilder(field).Append(":");
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Sort.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Sort.cs?rev=1202091&r1=1202090&r2=1202091&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Sort.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/Sort.cs Tue Nov 15 08:41:44 2011
@@ -96,17 +96,13 @@ namespace Lucene.Net.Search
/// <p/>Created: Feb 12, 2004 10:53:57 AM
///
/// </summary>
- /// <since> lucene 1.4
- /// </since>
- /// <version> $Id: Sort.java 795179 2009-07-17 18:23:30Z mikemccand $
- /// </version>
[Serializable]
public class Sort
{
/// <summary> Represents sorting by computed relevance. Using this sort criteria returns
/// the same results as calling
- /// <see cref="Searcher.Search(Query)" />Searcher#search()without a sort criteria,
+ /// <see cref="Searcher.Search(Query,int)" />Searcher#search()without a sort criteria,
/// only with slightly more overhead.
/// </summary>
public static readonly Sort RELEVANCE = new Sort();
@@ -118,63 +114,13 @@ namespace Lucene.Net.Search
internal SortField[] fields;
/// <summary> Sorts by computed relevance. This is the same sort criteria as calling
- /// <see cref="Searcher.Search(Query)" />without a sort criteria,
+ /// <see cref="Searcher.Search(Query,int)" />without a sort criteria,
/// only with slightly more overhead.
/// </summary>
public Sort():this(SortField.FIELD_SCORE)
{
}
- /// <summary> Sorts by the terms in <c>field</c> then by index order (document
- /// number). The type of value in <c>field</c> is determined
- /// automatically.
- ///
- /// </summary>
- /// <seealso cref="SortField.AUTO">
- /// </seealso>
- /// <deprecated> Please specify the type explicitly by
- /// first creating a <see cref="SortField" /> and then use <see cref="Sort(SortField)" />
- ///
- /// </deprecated>
- [Obsolete("Please specify the type explicitly by first creating a SortField and then use Sort(SortField)")]
- public Sort(System.String field)
- {
- SetSort(field, false);
- }
-
- /// <summary> Sorts possibly in reverse by the terms in <c>field</c> then by
- /// index order (document number). The type of value in <c>field</c> is
- /// determined automatically.
- ///
- /// </summary>
- /// <seealso cref="SortField.AUTO">
- /// </seealso>
- /// <deprecated> Please specify the type explicitly by
- /// first creating a <see cref="SortField" /> and then use <see cref="Sort(SortField)" />
- ///
- /// </deprecated>
- [Obsolete("Please specify the type explicitly by first creating a SortField and then use Sort(SortField)")]
- public Sort(System.String field, bool reverse)
- {
- SetSort(field, reverse);
- }
-
- /// <summary> Sorts in succession by the terms in each field. The type of value in
- /// <c>field</c> is determined automatically.
- ///
- /// </summary>
- /// <seealso cref="SortField.AUTO">
- /// </seealso>
- /// <deprecated> Please specify the type explicitly by
- /// first creating <see cref="SortField" />s and then use <see cref="Sort(SortField[])" />
- ///
- /// </deprecated>
- [Obsolete("Please specify the type explicitly by first creating SortFields and then use Sort(SortField[])")]
- public Sort(System.String[] fields)
- {
- SetSort(fields);
- }
-
/// <summary>Sorts by the criteria in the given SortField. </summary>
public Sort(SortField field)
{
@@ -182,54 +128,11 @@ namespace Lucene.Net.Search
}
/// <summary>Sorts in succession by the criteria in each SortField. </summary>
- public Sort(SortField[] fields)
+ public Sort(params SortField[] fields)
{
SetSort(fields);
}
- /// <summary> Sets the sort to the terms in <c>field</c> then by index order
- /// (document number).
- /// </summary>
- /// <deprecated> Please specify the type explicitly by
- /// first creating a <see cref="SortField" /> and then use <see cref="SetSort(SortField)" />
- ///
- /// </deprecated>
- [Obsolete("Please specify the type explicitly by first creating a SortField and then use SetSort(SortField)")]
- public void SetSort(System.String field)
- {
- SetSort(field, false);
- }
-
- /// <summary> Sets the sort to the terms in <c>field</c> possibly in reverse,
- /// then by index order (document number).
- /// </summary>
- /// <deprecated> Please specify the type explicitly by
- /// first creating a <see cref="SortField" /> and then use <see cref="SetSort(SortField)" />
- ///
- /// </deprecated>
- [Obsolete("Please specify the type explicitly by first creating a SortField and then use SetSort(SortField)")]
- public virtual void SetSort(System.String field, bool reverse)
- {
- fields = new SortField[]{new SortField(field, SortField.AUTO, reverse)};
- }
-
- /// <summary>Sets the sort to the terms in each field in succession.</summary>
- /// <deprecated> Please specify the type explicitly by
- /// first creating <see cref="SortField" />s and then use <see cref="SetSort(SortField[])" />
- ///
- /// </deprecated>
- [Obsolete("Please specify the type explicitly by first creating a SortFields and then use SetSort(SortField[])")]
- public virtual void SetSort(System.String[] fieldnames)
- {
- int n = fieldnames.Length;
- SortField[] nfields = new SortField[n];
- for (int i = 0; i < n; ++i)
- {
- nfields[i] = new SortField(fieldnames[i], SortField.AUTO);
- }
- fields = nfields;
- }
-
/// <summary>Sets the sort to the given criteria. </summary>
public virtual void SetSort(SortField field)
{
@@ -237,7 +140,7 @@ namespace Lucene.Net.Search
}
/// <summary>Sets the sort to the given criteria in succession. </summary>
- public virtual void SetSort(SortField[] fields)
+ public virtual void SetSort(params SortField[] fields)
{
this.fields = fields;
}
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TopDocsCollector.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TopDocsCollector.cs?rev=1202091&r1=1202090&r2=1202091&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TopDocsCollector.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Search/TopDocsCollector.cs Tue Nov 15 08:41:44 2011
@@ -20,7 +20,6 @@ using Lucene.Net.Util;
namespace Lucene.Net.Search
{
-
/// <summary> A base class for all collectors that return a <see cref="Lucene.Net.Search.TopDocs" /> output. This
/// collector allows easy extension by providing a single constructor which
/// accepts a <see cref="PriorityQueue{T}" /> as well as protected members for that
@@ -28,6 +27,9 @@ namespace Lucene.Net.Search
/// Extending classes can override <see cref="TopDocs(int, int)" /> and
/// <see cref="GetTotalHits()" /> in order to provide their own implementation.
/// </summary>
+ // TODO: I don't like this. Java's type inference allows this class to be defined without the type params wherever its used
+ // we may be able to get the same functionality via generic variance, but an interface would have to be made for PriorityQueue<T>,
+ // which is equally stupid.
public abstract class TopDocsCollector<T> : Collector where T : ScoreDoc
{
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/MMapDirectory.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/MMapDirectory.cs?rev=1202091&r1=1202090&r2=1202091&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/MMapDirectory.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/core/Store/MMapDirectory.cs Tue Nov 15 08:41:44 2011
@@ -308,7 +308,7 @@ namespace Lucene.Net.Store
// Because Java's ByteBuffer uses an int to address the
// values, it's necessary to access a file >
// Integer.MAX_VALUE in size using multiple byte buffers.
- private class MultiMMapIndexInput:IndexInput, System.ICloneable
+ protected internal class MultiMMapIndexInput:IndexInput, System.ICloneable
{
private void InitBlock(MMapDirectory enclosingInstance)
{
Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/demo/Demo.Common/FileDocument.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/demo/Demo.Common/FileDocument.cs?rev=1202091&r1=1202090&r2=1202091&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/demo/Demo.Common/FileDocument.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/demo/Demo.Common/FileDocument.cs Tue Nov 15 08:41:44 2011
@@ -40,7 +40,7 @@ namespace Lucene.Net.Demo
/// <li><code>contents</code>--containing the full contents of the file, as a
/// Reader field;
/// </summary>
- public static Document Document(System.IO.FileInfo f)
+ public static Document Document(System.IO.DirectoryInfo f)
{
// make a new, empty document