Lucene Full Text search & Starts With on Neo4j & REST?

201 views
Skip to first unread message

elado

unread,
Mar 5, 2012, 11:07:29 AM3/5/12
to ne...@googlegroups.com
Is there a way to query Neo4j's Lucene with a "starts with" query, in REST? (For an autocomplete purposes).

I can put a token string (say, <start_token>) at the beginning and query for <start_token>word*, but that's ugly.

Any suggestions?

Shouer.Shen

unread,
Mar 5, 2012, 12:06:21 PM3/5/12
to Neo4j
Hi elado

which version did you use ?

shen

elado

unread,
Mar 5, 2012, 12:16:40 PM3/5/12
to ne...@googlegroups.com
Latest, 1.6.1

Luanne Coutinho

unread,
Mar 5, 2012, 12:23:13 PM3/5/12
to ne...@googlegroups.com
Perhaps I have not understood you correctly, but why do you need a start token?
You could just do something like:
<server>/index/node/<indexName>?query=<property>:word*

-Luanne

elado

unread,
Mar 5, 2012, 12:31:43 PM3/5/12
to ne...@googlegroups.com
If I have these indexed strings:

- Lorem ipsum
- Lorem ipsum dolor sit amet
- Ipsum dolor


When I search for ipsu* it'll fetch them all. I want to fetch all items that start with ipsum (only the third).

Thanks.

Luanne

unread,
Mar 5, 2012, 1:10:15 PM3/5/12
to ne...@googlegroups.com
Weird, cos my autocomplete does a starts with, and does not return substring matches like the example you mentioned below. Need to check my code again

Sent from my iPad

Michael Hunger

unread,
Mar 5, 2012, 4:48:52 PM3/5/12
to ne...@googlegroups.com
Did you use an fulltext index for indexing the strings?

An exact index doesn't break them down into the individual parts, a fulltext index does.

Michael

Luanne Coutinho

unread,
Mar 5, 2012, 9:44:33 PM3/5/12
to ne...@googlegroups.com
Yes, that was it. I didn't notice that Elado was using a full text index- my bad!

Luanne Coutinho

unread,
Mar 5, 2012, 9:53:03 PM3/5/12
to ne...@googlegroups.com
So you may need to use a PrefixQuery.
I guess you may need to write a script for this (someone correct me if there is a better way)- example: http://docs.neo4j.org/chunked/stable/gremlin-plugin.html#rest-api-send-an-arbitrary-groovy-script---lucene-sorting
Reply all
Reply to author
Forward
0 new messages