示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustSelectCorrectTargetForAllGivenValueCombinations()
        public virtual void MustSelectCorrectTargetForAllGivenValueCombinations()
        {
            // given
            Dictionary <IndexSlot, Value[]> values = FusionIndexTestHelp.ValuesByGroup();

            Value[] allValues = FusionIndexTestHelp.AllValues();

            foreach (IndexSlot slot in Enum.GetValues(typeof(IndexSlot)))
            {
                Value[] group = values[slot];
                foreach (Value value in group)
                {
                    // when
                    IndexProvider selected = _instanceSelector.select(_slotSelector.selectSlot(array(value), GROUP_OF));

                    // then
                    assertSame(OrLucene(_providers[slot]), selected);
                }
            }

            // All composite values should go to lucene
            foreach (Value firstValue in allValues)
            {
                foreach (Value secondValue in allValues)
                {
                    // when
                    IndexProvider selected = _instanceSelector.select(_slotSelector.selectSlot(array(firstValue, secondValue), GROUP_OF));

                    // then
                    assertSame(_providers[LUCENE], selected);
                }
            }
        }
示例#2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.neo4j.collection.PrimitiveLongResourceIterator query(org.neo4j.internal.kernel.api.IndexQuery... predicates) throws org.neo4j.internal.kernel.api.exceptions.schema.IndexNotApplicableKernelException
        public override PrimitiveLongResourceIterator Query(params IndexQuery[] predicates)
        {
//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
            IndexSlot slot = SlotSelector.selectSlot(predicates, IndexQuery::valueGroup);

            return(slot != null?InstanceSelector.select(slot).query(predicates) : concat(InstanceSelector.transform(reader => reader.query(predicates))));
        }
示例#3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void verifyDeferredConstraints(org.neo4j.storageengine.api.NodePropertyAccessor nodePropertyAccessor) throws org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException
        public override void VerifyDeferredConstraints(NodePropertyAccessor nodePropertyAccessor)
        {
            foreach (IndexSlot slot in Enum.GetValues(typeof(IndexSlot)))
            {
                InstanceSelector.select(slot).verifyDeferredConstraints(nodePropertyAccessor);
            }
        }
示例#4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void verifyDeferredConstraints(org.neo4j.storageengine.api.NodePropertyAccessor nodePropertyAccessor) throws org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException
        public override void VerifyDeferredConstraints(NodePropertyAccessor nodePropertyAccessor)
        {
            // Manual loop due do multiple exception types
            foreach (IndexSlot slot in Enum.GetValues(typeof(IndexSlot)))
            {
                InstanceSelector.select(slot).verifyDeferredConstraints(nodePropertyAccessor);
            }
        }
示例#5
0
        public override bool HasFullValuePrecision(params IndexQuery[] predicates)
        {
//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
            IndexSlot slot = SlotSelector.selectSlot(predicates, IndexQuery::valueGroup);

            if (slot != null)
            {
                return(InstanceSelector.select(slot).hasFullValuePrecision(predicates));
            }
            else
            {
                // UNKNOWN slot which basically means the EXISTS predicate
                if (!(predicates.Length == 1 && predicates[0] is IndexQuery.ExistsPredicate))
                {
                    throw new System.InvalidOperationException("Selected IndexReader null for predicates " + Arrays.ToString(predicates));
                }
                return(true);
            }
        }
示例#6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void query(org.neo4j.storageengine.api.schema.IndexProgressor_NodeValueClient cursor, org.neo4j.internal.kernel.api.IndexOrder indexOrder, boolean needsValues, org.neo4j.internal.kernel.api.IndexQuery... predicates) throws org.neo4j.internal.kernel.api.exceptions.schema.IndexNotApplicableKernelException
        public override void Query(Org.Neo4j.Storageengine.Api.schema.IndexProgressor_NodeValueClient cursor, IndexOrder indexOrder, bool needsValues, params IndexQuery[] predicates)
        {
//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
            IndexSlot slot = SlotSelector.selectSlot(predicates, IndexQuery::valueGroup);

            if (slot != null)
            {
                InstanceSelector.select(slot).query(cursor, indexOrder, needsValues, predicates);
            }
            else
            {
                if (indexOrder != IndexOrder.NONE)
                {
                    throw new System.NotSupportedException(format("Tried to query index with unsupported order %s. Supported orders for query %s are %s.", indexOrder, Arrays.ToString(predicates), IndexOrder.NONE));
                }
                BridgingIndexProgressor multiProgressor = new BridgingIndexProgressor(cursor, _descriptor.schema().PropertyIds);
                cursor.Initialize(_descriptor, multiProgressor, predicates, indexOrder, needsValues);
                try
                {
                    InstanceSelector.forAll(reader =>
                    {
                        try
                        {
                            reader.query(multiProgressor, indexOrder, needsValues, predicates);
                        }
                        catch (IndexNotApplicableKernelException e)
                        {
                            throw new InnerException(e);
                        }
                    });
                }
                catch (InnerException e)
                {
                    throw e.InnerException;
                }
            }
        }
示例#7
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void process(org.neo4j.kernel.api.index.IndexEntryUpdate<?> update) throws org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException
        public override void Process <T1>(IndexEntryUpdate <T1> update)
        {
            switch (update.UpdateMode())
            {
            case ADDED:
                InstanceSelector.select(SlotSelector.selectSlot(update.Values(), GroupOf)).process(update);
                break;

            case CHANGED:
                // Hmm, here's a little conundrum. What if we change from a value that goes into native
                // to a value that goes into fallback, or vice versa? We also don't want to blindly pass
                // all CHANGED updates to both updaters since not all values will work in them.
                IndexUpdater from = InstanceSelector.select(SlotSelector.selectSlot(update.BeforeValues(), GroupOf));
                IndexUpdater to   = InstanceSelector.select(SlotSelector.selectSlot(update.Values(), GroupOf));
                // There are two cases:
                // - both before/after go into the same updater --> pass update into that updater
                if (from == to)
                {
                    from.Process(update);
                }
                // - before go into one and after into the other --> REMOVED from one and ADDED into the other
                else
                {
                    from.Process(IndexEntryUpdate.remove(update.EntityId, update.IndexKey(), update.BeforeValues()));
                    to.Process(IndexEntryUpdate.add(update.EntityId, update.IndexKey(), update.Values()));
                }
                break;

            case REMOVED:
                InstanceSelector.select(SlotSelector.selectSlot(update.Values(), GroupOf)).process(update);
                break;

            default:
                throw new System.ArgumentException("Unknown update mode");
            }
        }
示例#8
0
 public override long CountIndexedNodes(long nodeId, int[] propertyKeyIds, params Value[] propertyValues)
 {
     return(InstanceSelector.select(SlotSelector.selectSlot(propertyValues, GroupOf)).countIndexedNodes(nodeId, propertyKeyIds, propertyValues));
 }
示例#9
0
        public override IndexReader NewReader()
        {
            LazyInstanceSelector <IndexReader> readerSelector = new LazyInstanceSelector <IndexReader>(slot => InstanceSelector.select(slot).newReader());

            return(new FusionIndexReader(SlotSelector, readerSelector, _descriptor));
        }
示例#10
0
        public override IndexUpdater NewUpdater(IndexUpdateMode mode)
        {
            LazyInstanceSelector <IndexUpdater> updaterSelector = new LazyInstanceSelector <IndexUpdater>(slot => InstanceSelector.select(slot).newUpdater(mode));

            return(new FusionIndexUpdater(SlotSelector, updaterSelector));
        }
示例#11
0
 public override void ValidateBeforeCommit(Value[] tuple)
 {
     InstanceSelector.select(SlotSelector.selectSlot(tuple, GroupOf)).validateBeforeCommit(tuple);
 }
示例#12
0
        public override IndexUpdater NewPopulatingUpdater(NodePropertyAccessor accessor)
        {
            LazyInstanceSelector <IndexUpdater> updaterSelector = new LazyInstanceSelector <IndexUpdater>(slot => InstanceSelector.select(slot).newPopulatingUpdater(accessor));

            return(new FusionIndexUpdater(SlotSelector, updaterSelector));
        }
示例#13
0
 public override void IncludeSample <T1>(IndexEntryUpdate <T1> update)
 {
     InstanceSelector.select(SlotSelector.selectSlot(update.Values(), GroupOf)).includeSample(update);
 }