Lucene text search not working with nested queries?

72 views
Skip to first unread message

Davide Neri

unread,
Dec 7, 2015, 6:09:49 AM12/7/15
to OrientDB
Hi,
I realized that Lucene text search doesn't work on nested queries (and in other types of queries too).

An example:

Person (V)
owner (E)
Address (V)

where   Person -- owner --> Address



SELECT * FROM Person WHERE full_name LUCENE 'Mark*'

returns the list of records about people called Mark


SELECT expand(in('residence')) FROM Address WHERE city = 'London'

returns the list of records about people from Person who's residence is in London


If I want to search for all the Mark living in London I nest the queries

SELECT * FROM ( select expand(in('owner')) from Address where city = 'London' ) WHERE full_name LUCENE 'Mark*'

but the result is empty. If I user something like first_name = "Mark" works fine, but if I use Lucene just returns empty results.


I also tried to see what happens if I substitute the nested query with an array of RIDs of records that would match the query

SELECT * FROM [#10:1, #10:2, #10:3] WHERE full_name LUCENE 'Mark*'

but same result: empty.



Is there anything that I can do to make Lucene working on this type of queries?

Thanks!!

[davide]

alessand...@gmail.com

unread,
Dec 7, 2015, 7:03:01 AM12/7/15
to OrientDB
I tried your DB with OrientDB 2.1.6 and after launching your query I get this exception

com.orientechnologies.orient.core.exception.OQueryParsingException: Error on parsing command at position #0: LUCENE condition is allowed only when query target is a Class or an Index

because if you want to work with Lucene index in nested queries the Lucene engine must be used in the target query.

Otherwise you can try this:

SELECT * FROM Person WHERE full_name LUCENE 'Mark*'and out('owner').city contains 'London'
Reply all
Reply to author
Forward
Message has been deleted
0 new messages