I am using Orient DB 2.1.16. I have a vertex class in orientDB called person, I also created a property for person class called name. I added a full text index on that property called person.name.Upon searching on index I can only order by key, is there any other way to search on index INDEX:person.name but order by another property of property of person like age SELECT FROM INDEX:person.name WHERE KEY CONTAINSTEXT 'abc' ORDER BY KEY ASC
works fine but SELECT FROM INDEX:person.name WHERE KEY CONTAINSTEXT 'abc' ORDER BY age ASC
gives error saying when selecting from index can only order by key
The result of Selecting from an index will not contain unindexed properties. If you want to order by a field which is not part of the index, you need to select the related field also.
E.g.:
SELECT name, age FROM (SELECT EXPAND(rid) FROM INDEX:person.name WHERE
KEY CONTAINSTEXT 'abc') ORDER BY age ASC
More simple solution is to query properties from original vertex with the ContainsText operator:
SELECT name, age from person WHERE (name CONTAINSTEXT 'abc') ORDER BY age ASC