Beispiel #1
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)
        {
            IndexUpdater to = Select(update.Values()[0].valueGroup());

            switch (update.UpdateMode())
            {
            case ADDED:
            case REMOVED:
                to.Process(update);
                break;

            case CHANGED:
                IndexUpdater from = Select(update.BeforeValues()[0].valueGroup());
                // 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;

            default:
                throw new System.ArgumentException("Unknown update mode");
            }
        }
            public override void Process <T1>(IndexEntryUpdate <T1> update)
            {
                Pair <IndexPopulation, IndexUpdater> pair = PopulationsWithUpdaters[update.IndexKey().schema()];

                if (pair != null)
                {
                    IndexPopulation population = pair.First();
                    IndexUpdater    updater    = pair.Other();

                    try
                    {
                        population.Populator.includeSample(update);
                        updater.Process(update);
                    }
                    catch (Exception t)
                    {
                        try
                        {
                            updater.Close();
                        }
                        catch (Exception ce)
                        {
                            Log.error(format("Failed to close index updater: [%s]", updater), ce);
                        }
                        PopulationsWithUpdaters.Remove(update.IndexKey().schema());
                        MultipleIndexPopulator.fail(population, t);
                    }
                }
            }
Beispiel #3
0
            public override void Process <T1>(IndexEntryUpdate <T1> update)
            {
                // we do not support adding partial entries
                Debug.Assert(update.IndexKey().schema().Equals(outerInstance.Descriptor.schema()));

                switch (update.UpdateMode())
                {
                case ADDED:
                    if (Idempotent)
                    {
                        AddIdempotent(update.EntityId, update.Values());
                    }
                    else
                    {
                        Add(update.EntityId, update.Values());
                    }
                    break;

                case CHANGED:
                    Change(update.EntityId, update.Values());
                    break;

                case REMOVED:
                    Remove(update.EntityId);
                    break;

                default:
                    throw new System.NotSupportedException();
                }
                HasChanges = true;
            }
            public override void Process <T1>(IndexEntryUpdate <T1> update)
            {
                Debug.Assert(update.IndexKey().schema().Equals(outerInstance.descriptor.Schema()));
                try
                {
                    switch (update.UpdateMode())
                    {
                    case ADDED:
                        long nodeId = update.EntityId;
                        outerInstance.LuceneIndex.IndexWriter.updateDocument(LuceneFulltextDocumentStructure.NewTermForChangeOrRemove(nodeId), LuceneFulltextDocumentStructure.DocumentRepresentingProperties(nodeId, outerInstance.descriptor.PropertyNames(), update.Values()));

                        goto case CHANGED;

                    case CHANGED:
                        long nodeId1 = update.EntityId;
                        outerInstance.LuceneIndex.IndexWriter.updateDocument(LuceneFulltextDocumentStructure.NewTermForChangeOrRemove(nodeId1), LuceneFulltextDocumentStructure.DocumentRepresentingProperties(nodeId1, outerInstance.descriptor.PropertyNames(), update.Values()));
                        break;

                    case REMOVED:
                        outerInstance.LuceneIndex.IndexWriter.deleteDocuments(LuceneFulltextDocumentStructure.NewTermForChangeOrRemove(update.EntityId));
                        break;

                    default:
                        throw new System.NotSupportedException();
                    }
                }
                catch (IOException e)
                {
                    throw new UncheckedIOException(e);
                }
            }
Beispiel #5
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)
        {
            PointValue value = ( PointValue )update.Values()[0];

            switch (update.UpdateMode())
            {
            case ADDED:
                Select(value.CoordinateReferenceSystem).process(update);
                break;

            case CHANGED:
                // These are both spatial, but could belong in different parts
                PointValue   fromValue = ( PointValue )update.BeforeValues()[0];
                IndexUpdater from      = Select(fromValue.CoordinateReferenceSystem);
                IndexUpdater to        = Select(value.CoordinateReferenceSystem);
                // 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:
                Select(value.CoordinateReferenceSystem).process(update);
                break;

            default:
                throw new System.ArgumentException("Unknown update mode");
            }
        }
Beispiel #6
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");
            }
        }