예제 #1
0
 private void AwaitIndexOnline(IndexDefinition definition)
 {
     using (Transaction tx = _db.beginTx())
     {
         _db.schema().awaitIndexOnline(definition, 10, TimeUnit.SECONDS);
         tx.Success();
     }
 }
예제 #2
0
 private IndexDefinition CreateIndex()
 {
     using (Transaction tx = _db.beginTx())
     {
         IndexDefinition index = _db.schema().indexFor(_myLabel).on("number_of_bananas_owned").create();
         tx.Success();
         return(index);
     }
 }
예제 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void validateIndexedNodePropertiesInLucene()
        internal virtual void ValidateIndexedNodePropertiesInLucene()
        {
            setUp(default_schema_provider.name(), GraphDatabaseSettings.SchemaIndex.NATIVE10.providerName());
            Label  label        = Label.label("indexedNodePropertiesTestLabel");
            string propertyName = "indexedNodePropertyName";

            CreateIndex(label, propertyName);

            using (Transaction ignored = _database.beginTx())
            {
                _database.schema().awaitIndexesOnline(5, TimeUnit.MINUTES);
            }

            System.ArgumentException argumentException = assertThrows(typeof(System.ArgumentException), () =>
            {
                using (Transaction transaction = _database.beginTx())
                {
                    Node node = _database.createNode(label);
                    node.setProperty(propertyName, StringUtils.repeat("a", IndexWriter.MAX_TERM_LENGTH + 1));
                    transaction.success();
                }
            });
            assertThat(argumentException.Message, equalTo("Property value size is too large for index. Please see index documentation for limitations."));
        }
예제 #4
0
        public virtual void Accept(DbStructureVisitor visitor)
        {
            CommitAndReOpen();

            _graph.schema().awaitIndexesOnline(10, TimeUnit.SECONDS);
            Commit();

            if (_bridge.hasTransaction())
            {
                throw new System.InvalidOperationException("Dangling transaction before running visitable");
            }

            GraphDbStructureGuide analyzer = new GraphDbStructureGuide(_graph);

            analyzer.Accept(visitor);
        }