0
votes

I am following this tutorial by Michael http://jexp.de/blog/2014/03/full-text-indexing-fts-in-neo4j-2-0/ to setup my full text index. But there are couple of issues I ran into.

I have a node server running on my PC (windows). Anyway, I have something running on localhost that uses jQuery. So I used jQuery to make an ajax post call in the chrome console.

Step1:

 $.ajax({
    url: 'http://localhost:7474/db/data/index/node/',
    type: 'post',
    data: JSON.stringify({'name': 'NewIndex', 'config':{'type':'fulltext', 'provider':'lucene', 'to_lower_case': 'true'}}),
    headers: {
        "Content-Type": 'application/json',
        "Accept": 'application/json; charset=UTF-8'
    },
    dataType: 'json',
    success: function (data) {
        console.log(data);
    }
});

This worked! So it created an index. Next as the tutorial suggests, I setup these settings and restarted the server:

Step 2:

node_auto_indexing=true
node_keys_indexable=description

Next I used the following to reset properties

Step 3:

MATCH (n:anodelabel)
WHERE has(n.description)
SET n.description=n.description

Next I tried to query it in the browser localhost:7474.

Step 4:

START anodelabel=node:NewIndex("description:word*")
MATCH (o:anodelabel)<-[r:AUTHOR]-(user)
RETURN o LIMIT 10

But this is returning an empty set. So I tried to post a new item CREATE (n:anodelabel {description: "needs to work"}) and used the cypher call again. Again an empty set.

3

3 Answers

0
votes

In step 4, the index return value is a node, not a node label. Try this instead:

START n=node:NewIndex("description:word*")
MATCH (n)<-[r:AUTHOR]-(user)
RETURN n LIMIT 10
0
votes

In your first step you should have used node_auto_index instead.

And in your last step too.

Only then your nodes get automatically added to that index.

Also your statement is not correct, use something like this:

  1. find text nodes from FTS
  2. assure their label and match patterns
  3. return data

.

START o=node:NewIndex("description:word*")
MATCH (o:AnodeLabel)<-[r:AUTHOR]-(user)
RETURN user LIMIT 10
-3
votes
MATCH (n:anodelabel)
WHERE has(n.description)
SET n.description=n.description