Full-Text Indexes (Lucene/SB-Tree): Querying All Keys of Indexes via SQL (not) possible?

Dear Community

According to the Orient-DB-Documentation on Indexing it should (generally) be possible to query the keys of an index via

SELECT key from INDEX:

However, it appears (to me) that this is not possible for full-text indexes:

SELECT key from INDEX:aFullTextIndex

throws an error

com.orientechnologies.orient.core.exception.OCommandExecutionException: Index afulltextindex does not allow iteration without a condition DB name=“DB_Name”.

[OrientDB v 3.0.10]

Does anyone know why? And what could be a possible solution/workaround to query all keys of a fulltext-based index?

Any input is appreciated.

Many thanks, Severin Waldis

Appendix: What I want to do

The OrientDB-Documentation gives the following example on how Lucene-Fulltext-Engine works (see: https://orientdb.org/docs/3.0.x/indexing/Full-Text-Index.html#how-lucenes-works):

Example Text Corpus:

1: My sister is coming for the holidays.
2: The holidays are a chance for family meeting.
3: Who did your sister meet?
4: It takes an hour to make fudge.
5: My sister makes awesome fudge.

A posting list for each word is created:

my --> 1,5

fudge --> 4,5

sister --> 1,3,5

What I want to do now is to retrieve “my,fudge, sister,…”, i.e. the keys of the posting lists, which Lucene created based on the text corpus.

Could be a typo but are you trying to execute SELECT key from INDEX:aFullTextIndex with the “:” in between?
If so you need to use “.” instead as such:

SELECT key from INDEX.aFullTextIndex

I’ve also tried on demodb (3.0.10) and it works, e.g.:

SELECT Bio from Profiles.aFullTextIndex

I hope it helps.

Many thanks for your effort and reply!

Unfortunately this is not the cause.

INDEX:indexName is the required syntax when examining an index via SQL - see “Understanding Indexes” in the documentation.

So, for instance

SELECT key from INDEX:aUniqueIndex

where aUniqueIndex is an index of type UNIQUE, works and delivers the expected results.

You can check for yourself on the demodb:

on the class “AerchaelogicalSites” three indexes are defined:

  • ArchaeologicalSites.Id --> Index of type UNIQUE on the property “Id”
  • Locations.Name --> Index of type FULLTEXT on the property “Name”
  • Locations.Type --> Index of type NOTUNIQUE on the property “Type”

Try the following SQL-Statement

SELECT key from INDEX:ArchaelogicalSites.ID



so, you get all the keys of the keys of the index “ArchaelogicalSites.ID”.

However, when you try to get the keys from the index “Locations.Name”, which is a full-text-index, you get an error!

SELECT key from INDEX:Locations.Name


com.orientechnologies.orient.core.exception.OCommandExecutionException: Index Locations.name does not allow iteration without a condition DB name=“demodb”

Any Input to a solution on how to retrieve the keys of a full-text-index is highly appreciated!

Thanks, Severin

1 Like

Fastforward 2 years to 2021, and the same issue is here! I’m having a very difficult time with Lucene indices on a graphdb