コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void indexNumberRangeQuery() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void IndexNumberRangeQuery()
        {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: updateAndCommit(asList(add(1, 1), add(2, 2), add(3, 3), add(4, 4), add(5, Double.NaN)));
            UpdateAndCommit(new IList <IndexEntryUpdate <object> > {
                Add(1, 1), Add(2, 2), Add(3, 3), Add(4, 4), Add(5, Double.NaN)
            });

            IndexReader reader = _accessor.newReader();

            LongIterator rangeTwoThree = reader.Query(range(PROP_ID, 2, true, 3, true));

            assertThat(PrimitiveLongCollections.asArray(rangeTwoThree), LongArrayMatcher.Of(2, 3));

            LongIterator infiniteMaxRange = reader.Query(range(PROP_ID, 2, true, long.MaxValue, true));

            assertThat(PrimitiveLongCollections.asArray(infiniteMaxRange), LongArrayMatcher.Of(2, 3, 4));

            LongIterator infiniteMinRange = reader.Query(range(PROP_ID, long.MinValue, true, 3, true));

            assertThat(PrimitiveLongCollections.asArray(infiniteMinRange), LongArrayMatcher.Of(PROP_ID, 2, 3));

            LongIterator maxNanInterval = reader.Query(range(PROP_ID, 3, true, Double.NaN, true));

            assertThat(PrimitiveLongCollections.asArray(maxNanInterval), LongArrayMatcher.Of(3, 4, 5));

            LongIterator minNanInterval = reader.Query(range(PROP_ID, Double.NaN, true, 5, true));

            assertThat(PrimitiveLongCollections.asArray(minNanInterval), LongArrayMatcher.EmptyArrayMatcher());

            LongIterator nanInterval = reader.Query(range(PROP_ID, Double.NaN, true, Double.NaN, true));

            assertThat(PrimitiveLongCollections.asArray(nanInterval), LongArrayMatcher.Of(5));
        }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void indexStringRangeQuery() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void IndexStringRangeQuery()
        {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: updateAndCommit(asList(add(PROP_ID, "A"), add(2, "B"), add(3, "C"), add(4, "")));
            UpdateAndCommit(new IList <IndexEntryUpdate <object> > {
                Add(PROP_ID, "A"), Add(2, "B"), Add(3, "C"), Add(4, "")
            });

            IndexReader reader = _accessor.newReader();

            LongIterator rangeFromBInclusive = reader.Query(range(PROP_ID, "B", true, null, false));

            assertThat(PrimitiveLongCollections.asArray(rangeFromBInclusive), LongArrayMatcher.Of(2, 3));

            LongIterator rangeFromANonInclusive = reader.Query(range(PROP_ID, "A", false, null, false));

            assertThat(PrimitiveLongCollections.asArray(rangeFromANonInclusive), LongArrayMatcher.Of(2, 3));

            LongIterator emptyLowInclusive = reader.Query(range(PROP_ID, "", true, null, false));

            assertThat(PrimitiveLongCollections.asArray(emptyLowInclusive), LongArrayMatcher.Of(PROP_ID, 2, 3, 4));

            LongIterator emptyUpperNonInclusive = reader.Query(range(PROP_ID, "B", true, "", false));

            assertThat(PrimitiveLongCollections.asArray(emptyUpperNonInclusive), LongArrayMatcher.EmptyArrayMatcher());

            LongIterator emptyInterval = reader.Query(range(PROP_ID, "", true, "", true));

            assertThat(PrimitiveLongCollections.asArray(emptyInterval), LongArrayMatcher.Of(4));

            LongIterator emptyAllNonInclusive = reader.Query(range(PROP_ID, "", false, null, false));

            assertThat(PrimitiveLongCollections.asArray(emptyAllNonInclusive), LongArrayMatcher.Of(PROP_ID, 2, 3));

            LongIterator nullNonInclusive = reader.Query(range(PROP_ID, ( string )null, false, null, false));

            assertThat(PrimitiveLongCollections.asArray(nullNonInclusive), LongArrayMatcher.Of(PROP_ID, 2, 3, 4));

            LongIterator nullInclusive = reader.Query(range(PROP_ID, ( string )null, false, null, false));

            assertThat(PrimitiveLongCollections.asArray(nullInclusive), LongArrayMatcher.Of(PROP_ID, 2, 3, 4));
        }