Orientdb: Creating index on Embedded field failed

Created on 16 Mar 2016  路  11Comments  路  Source: orientechnologies/orientdb

Using 2.1.13

When i try to create an index including an Embedded field, i have the following issue :

com.orientechnologies.orient.core.index.OIndexException: Cannot create the index 'TestIDX'
com.orientechnologies.orient.core.index.sbtree.local.OSBTreeException: Error creation of sbtree with nameTestIDX
java.lang.NullPointerException

Embedded class contains one string field named text

Most helpful comment

hi @thierry-github

if you want to store property like i18n field.

You could use Embedded map of String

like this

create class Color extends V

create property Color.name EMBEDDEDMAP STRING
create index Color.name on Color (name by value) NOTUNIQUE

insert into Color set name = {"it" : "Rosso","en" : "Red"}
insert into Color set name = {"it" : "Giallo","en" : "Yellow" }


select from Color where name containsValue 'Yellow'
explain select from Color where name containsValue 'Red'

The query with countainsValue on map field will use the index.

All 11 comments

hi @thierry-github

can you paste here the sql command that you use for index creation?

hi @maggiolo00

the SQL command :
create index TestIDX on myClass (field) NOTUNIQUE
field is the embedded property

I've tried it with studio with the same result

hi @maggiolo00

any update on this ?

hi @thierry-github

which embedded type is is field?

hi @maggiolo00

See attached file for Embedded type structure (mString)
basicly, mString is used for save multilingual properties.

the index looks like :
create index TestIDX on V (property.en) NOTUNIQUE

to index English part of the proprerty.

mstring

hi @thierry-github

index on embedded like property.en are not supported yet.

http://orientdb.com/docs/2.1/Roadmap.html#release-3-0

Now are supported EmbeddedList/set and Embedded Map (key/value).

Ok, Thanks !

hi @thierry-github

if you want to store property like i18n field.

You could use Embedded map of String

like this

create class Color extends V

create property Color.name EMBEDDEDMAP STRING
create index Color.name on Color (name by value) NOTUNIQUE

insert into Color set name = {"it" : "Rosso","en" : "Red"}
insert into Color set name = {"it" : "Giallo","en" : "Yellow" }


select from Color where name containsValue 'Yellow'
explain select from Color where name containsValue 'Red'

The query with countainsValue on map field will use the index.

@thierry-github, indexing text values (string properties) as for your initial embedded type structure is possible with LUCENE engine (http://orientdb.com/docs/2.1/Full-Text-Index.html).

@maggiolo00, we are eagerly looking forward to have indexes on embedded fields too.

Thank you all guys,!

@maggiolo00 - I looked everywhere in the docs, and I couldn't find that tidbit of interesting info about only lists, sets and maps working for indexing or rather that embedded fields don't work. I'd add it myself, but I am also not sure where to best put it. In the limitations section, in the indexing section (if there, where exactly) or both?

Scott

Was this page helpful?
0 / 5 - 0 ratings