Пример #1
0
        public override SchemaDescriptor SchemaFor(EntityType type, string[] entityTokens, Properties indexConfiguration, params string[] properties)
        {
            if (entityTokens.Length == 0)
            {
                throw new BadSchemaException("At least one " + (type == EntityType.NODE ? "label" : "relationship type") + " must be specified when creating a fulltext index.");
            }
            if (properties.Length == 0)
            {
                throw new BadSchemaException("At least one property name must be specified when creating a fulltext index.");
            }
            if (Arrays.asList(properties).contains(LuceneFulltextDocumentStructure.FIELD_ENTITY_ID))
            {
                throw new BadSchemaException("Unable to index the property, the name is reserved for internal use " + LuceneFulltextDocumentStructure.FIELD_ENTITY_ID);
            }
            int[] entityTokenIds = new int[entityTokens.Length];
            if (type == EntityType.NODE)
            {
                _tokenHolders.labelTokens().getOrCreateIds(entityTokens, entityTokenIds);
            }
            else
            {
                _tokenHolders.relationshipTypeTokens().getOrCreateIds(entityTokens, entityTokenIds);
            }
            int[] propertyIds = java.util.properties.Select(_tokenHolders.propertyKeyTokens().getOrCreateId).ToArray();

            SchemaDescriptor schema = SchemaDescriptorFactory.multiToken(entityTokenIds, type, propertyIds);

            indexConfiguration.putIfAbsent(FulltextIndexSettings.INDEX_CONFIG_ANALYZER, _defaultAnalyzerName);
            indexConfiguration.putIfAbsent(FulltextIndexSettings.INDEX_CONFIG_EVENTUALLY_CONSISTENT, _defaultEventuallyConsistentSetting);
            return(new FulltextSchemaDescriptor(schema, indexConfiguration));
        }
Пример #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public int relationshipTypeGetOrCreateForName(String relationshipTypeName) throws org.neo4j.internal.kernel.api.exceptions.schema.IllegalTokenNameException
        public override int RelationshipTypeGetOrCreateForName(string relationshipTypeName)
        {
            return(GetOrCreateForName(_tokenHolders.relationshipTypeTokens(), relationshipTypeName));
        }
Пример #3
0
 public override int RelationshipTypeCount()
 {
     return(_tokenHolders.relationshipTypeTokens().size());
 }