Unable to use LUCENE FULLTEXT index on field with other indexes

27 views
Skip to first unread message

Jean-Sebastien Lemay

unread,
May 12, 2015, 4:50:39 AM5/12/15
to orient-...@googlegroups.com
(using OrientDB 2.0.7 Community)

I created a simple Vertex class:

CREATE CLASS PublicProfile EXTENDS V;

CREATE PROPERTY PublicProfile.username STRING;
CREATE INDEX PublicProfile.uq_username ON PublicProfile(username) UNIQUE_HASH_INDEX;
CREATE INDEX PublicProfile.txt_username ON PublicProfile(username) FULLTEXT ENGINE LUCENE;

The indexes ensure that the username is unique, but also that it can be queried using Lucene.

I insert many records where username is "test1", "test2", "test3", etc.

Next, I want to query for all users where the username starts with "test". Therefore, I run this query:

SELECT FROM PublicProfile
WHERE username LUCENE
"test*"

No results are returned.

The EXPLAIN indicates that my LUCENE index is not used. The unique index is used instead.
involvedIndexes: ["PublicProfile.uq_username"]

Why isn't the engine using my Lucene index?
And I don't want to switch to querying the index directly, because I might have a more complicated query down the line, e.g.:
SELECT FROM PublicProfile
WHERE username LUCENE 
"test*"
AND joinDate < date("2015-05-05 05:05:05")
AND numFriends = 5
...

How do I query my LUCENE index properly in this case?

Reply all
Reply to author
Forward
0 new messages