Ejemplo n.º 1
0
            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);
                }
            }
Ejemplo n.º 2
0
 private Document UpdateAsDocument <T1>(IndexEntryUpdate <T1> update)
 {
     return(LuceneFulltextDocumentStructure.DocumentRepresentingProperties(update.EntityId, _descriptor.propertyNames(), update.Values()));
 }