Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void createAndQueryFulltextRelationshipIndex() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void CreateAndQueryFulltextRelationshipIndex()
        {
            FulltextIndexProvider provider = ( FulltextIndexProvider )Db.resolveDependency(typeof(IndexProviderMap)).lookup(DESCRIPTOR);
            IndexReference        indexReference;

            using (KernelTransactionImplementation transaction = KernelTransaction)
            {
                MultiTokenSchemaDescriptor multiTokenSchemaDescriptor = multiToken(new int[] { 0, 1, 2 }, EntityType.RELATIONSHIP, 0, 1, 2, 3);
                FulltextSchemaDescriptor   schema = new FulltextSchemaDescriptor(multiTokenSchemaDescriptor, new Properties());
                indexReference = transaction.SchemaWrite().indexCreate(schema, DESCRIPTOR.name(), "fulltext");
                transaction.Success();
            }
            Await(indexReference);
            long secondRelId;

            using (Transaction transaction = Db.beginTx())
            {
                Relationship ho = _node1.createRelationshipTo(_node2, RelationshipType.withName("ho"));
                secondRelId = ho.Id;
                ho.SetProperty("hej", "villa");
                ho.SetProperty("ho", "value3");
                transaction.Success();
            }
            VerifyRelationshipData(provider, secondRelId);
            Db.restartDatabase(DatabaseRule.RestartAction_Fields.EMPTY);
            provider = ( FulltextIndexProvider )Db.resolveDependency(typeof(IndexProviderMap)).lookup(DESCRIPTOR);
            VerifyRelationshipData(provider, secondRelId);
        }
Ejemplo n.º 2
0
        public virtual void CreateRelationshipFulltextIndex(string name, IList <string> relTypes, IList <string> properties, IDictionary <string, string> config)
        {
            Properties settings = new Properties();

            settings.putAll(config);
            SchemaDescriptor schemaDescriptor = Accessor.schemaFor(EntityType.RELATIONSHIP, StringArray(relTypes), settings, StringArray(properties));

            Tx.schemaWrite().indexCreate(schemaDescriptor, DESCRIPTOR.name(), name);
        }
Ejemplo n.º 3
0
        public virtual void CreateNodeFulltextIndex(string name, IList <string> labels, IList <string> properties, IDictionary <string, string> indexConfigurationMap)
        {
            Properties indexConfiguration = new Properties();

            indexConfiguration.putAll(indexConfigurationMap);
            SchemaDescriptor schemaDescriptor = Accessor.schemaFor(EntityType.NODE, StringArray(labels), indexConfiguration, StringArray(properties));

            Tx.schemaWrite().indexCreate(schemaDescriptor, DESCRIPTOR.name(), name);
        }
Ejemplo n.º 4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.internal.kernel.api.IndexReference createIndex(int[] entityTokens, int[] propertyIds) throws org.neo4j.internal.kernel.api.exceptions.TransactionFailureException, org.neo4j.internal.kernel.api.exceptions.InvalidTransactionTypeKernelException, org.neo4j.internal.kernel.api.exceptions.schema.SchemaKernelException
        private IndexReference CreateIndex(int[] entityTokens, int[] propertyIds)

        {
            IndexReference fulltext;

            using (KernelTransactionImplementation transaction = KernelTransaction)
            {
                MultiTokenSchemaDescriptor multiTokenSchemaDescriptor = multiToken(entityTokens, EntityType.NODE, propertyIds);
                FulltextSchemaDescriptor   schema = new FulltextSchemaDescriptor(multiTokenSchemaDescriptor, new Properties());
                fulltext = transaction.SchemaWrite().indexCreate(schema, DESCRIPTOR.name(), NAME);
                transaction.Success();
            }
            return(fulltext);
        }
Ejemplo n.º 5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void createAndRetainRelationshipFulltextIndex() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void CreateAndRetainRelationshipFulltextIndex()
        {
            IndexReference indexReference;

            using (KernelTransactionImplementation transaction = KernelTransaction)
            {
                MultiTokenSchemaDescriptor multiTokenSchemaDescriptor = multiToken(new int[] { 0, 1, 2 }, EntityType.RELATIONSHIP, 0, 1, 2, 3);
                FulltextSchemaDescriptor   schema = new FulltextSchemaDescriptor(multiTokenSchemaDescriptor, new Properties());
                indexReference = transaction.SchemaWrite().indexCreate(schema, DESCRIPTOR.name(), "fulltext");
                transaction.Success();
            }
            Await(indexReference);
            Db.restartDatabase(DatabaseRule.RestartAction_Fields.EMPTY);

            VerifyThatFulltextIndexIsPresent(indexReference);
        }
Ejemplo n.º 6
0
 private GraphDatabaseAPI CreateDatabase(TrackingIndexExtensionFactory indexExtensionFactory)
 {
     return(( GraphDatabaseAPI )(new TestGraphDatabaseFactory()).setKernelExtensions(singletonList(indexExtensionFactory)).newEmbeddedDatabaseBuilder(Directory.databaseDir()).setConfig(default_schema_provider, DESCRIPTOR.name()).newGraphDatabase());
 }