Neo4j indexing (with Lucene) - a good way to organize node "types"?

This is actually more of a Lucene question, but it is in the context of the neo4j database.

I have a database divided into 50 or near node types (so there are “collections” or “tables” in other dbs types). Each of them has a subset of properties that need to be indexed, some have the same name, and some do not.

When searching, I always want to find nodes of a certain type, but not through all nodes.

I can see three ways of organizing this:

  • One index for each type of property, naturally, represent fields indexes: index 'foo', 'id'='1234'.

  • One global index, each field matches a property name to distinguish between the type either to include it as part of the value ( 'id'='foo:1234'), or to check the nodes after they return (I expect duplicates to be very rare). A.

  • One index type is part of the field name: 'foo.id'='1234'.

Once created, the database is read-only.

Are there any advantages for one of them, in terms of convenience, size efficiency, and caching or performance?

As I understand it, for the first option, neo4j will create a separate physical index for each type, which seems suboptimal. For the third, I end up with most lucene docs having only a small subset of fields, not sure if this has any effect on.

+5
source share
3

, , , , . , O (lg (n)), . ( 50 , 6 (2 ^ 6 >= 50) , , .)

, OS, , .

2 3 id type (id: type: ), , neo4j.

+1

, ActiveRecord Neo4j REST, Rails. ActiveRecord ActiveRelation, SQL, NoSQL. , , :

  • model_index, , type model
  • type model. SHOW TABLES SQL, , .
  • model , . DESC <TABLENAME>.
  • , CREATE TABLE, node , node.
  • node model_index type:model model:<model-name>. "", node model.
  • , model ( ), instances, node . v[123] :=> [instances] :=> v[245] v [123] node, v [245] v [123].
  • , , model_index model:<model-name>, node, instances. .

model_index, 2x .

, , node, node instances. , SpringDataGraph __type__ node, node.

AREL . AR- https://github.com/yournextleap/activerecord-neo4j-adapter

, , Cheers!:)

+2

spring -data-neo4j - . , . , . .

The other two, by the way, seem a little artificial. Perhaps you are indexing completely unrelated data in the same index, which doesn't sound right.

+1
source

All Articles