Hi Romiko,

Out of the box auto-indexing only supports exact matches, rather than full text 
searches. The reason is that auto indexes are created with the default 
configuration (http://docs.neo4j.org/chunked/snapshot/indexing-create.html) the 
first time you access them. But this gives us a little wiggle room to cheat the 
lifecycle of the server.

Warning: if you read past this point, what I'm about to suggest might make you 
rip out your own eyeballs and feed them to a passing alley cat. 
Seriously, you've been warned, this is a bit of a hack :-)

So, before we do anything, let's make sure we've got auto-indexing enabled for 
the server. Make sure that you've added some config like this into your 
neo4j.properties file:

node_keys_indexable=name,phone
relationship_keys_indexable=since
node_auto_indexing=true
relationship_auto_indexing=true

Then bring up your server.

Next up, we want to pre-empt the creation of an auto-index, by telling the 
server to create an apparently manual index which has the same name as the node 
(or rel) auto-index (in this case we're making a node auto index so the index 
name is node_auto_index), like so:

POST /db/data/index/node HTTP/1.1
Host: localhost:7474
Content-Length: 76
Content-Type: application/json

{"name":"node_auto_index", "config":{"type":"fulltext","provider":"lucene"}}

This triggers the creation of an index which happens to have the same name as 
the auto index that the database will create for itself. Now when we interact 
with the database, the index is created so the state machine skips over that 
step and just gets on with normal day-to-day auto-indexing.

You have to do this early in your server lifecycle, otherwise you run the risk 
of creating a normal auto index as a side effect of doing normal work.

See, I told you it was yucky.

Jim

PS - cheers to Chris Gioran for the tip that this is possible
PPS - double cheers to Chris for wanting to make this sane in future releases 
:-)
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to