Пример #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);
                }
            }
Пример #2
0
        public override void Add <T1>(ICollection <T1> updates) where T1 : Org.Neo4j.Kernel.Api.Index.IndexEntryUpdate <T1>
        {
            try
            {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: for (org.neo4j.kernel.api.index.IndexEntryUpdate<?> update : updates)
                foreach (IndexEntryUpdate <object> update in updates)
                {
                    Writer.updateDocument(LuceneFulltextDocumentStructure.NewTermForChangeOrRemove(update.EntityId), UpdateAsDocument(update));
                }
            }
            catch (IOException e)
            {
                throw new UncheckedIOException(e);
            }
        }
Пример #3
0
 public override long CountIndexedNodes(long nodeId, int[] propertyKeyIds, params Value[] propertyValues)
 {
     try
     {
         string[] propertyKeys = new string[propertyKeyIds.Length];
         for (int i = 0; i < propertyKeyIds.Length; i++)
         {
             propertyKeys[i] = _propertyKeyTokenHolder.getTokenById(propertyKeyIds[i]).name();
         }
         Query query = LuceneFulltextDocumentStructure.NewCountNodeEntriesQuery(nodeId, propertyKeys, propertyValues);
         TotalHitCountCollector collector = new TotalHitCountCollector();
         IndexSearcher.search(query, collector);
         return(collector.TotalHits);
     }
     catch (Exception e)
     {
         throw new Exception(e);
     }
 }
Пример #4
0
 private Document UpdateAsDocument <T1>(IndexEntryUpdate <T1> update)
 {
     return(LuceneFulltextDocumentStructure.DocumentRepresentingProperties(update.EntityId, _descriptor.propertyNames(), update.Values()));
 }