How to search with 'MATCH' on OrientDB with case-INsensitive?

596 views Asked by At

I am using OrientDB version 2.2.30, and I want to search for all persons that related to a WHITE car.

Both vertex (person & entity) are set to case-insensitive on all string-properties.

The problem is that the word "white" is written with upper and lower cases and the MATCH returns only those that are a match to the exact form I write on the query.

MATCH {class:Person, as:E0}.outE(){class:Drive, as:R0}.inV(){class:Car, as:E1 , where:( (   CarColor IN ['white']   ) ) } RETURN $paths

This will return all the match-paths but only if the word "white" is written as the query: 'white' (WHIte or WHITE won't be retreived as a result even though this field is set to be case-INsensitive)

The funny thing is that if I take the condition of the color OUT from the 'match' query and place it in a 'regular' where-clause - it is working just fine and retrieve all upper&lower cases

SELECT  *
 FROM 
 ( MATCH {class:Person, as:E0}.outE(){class:Drive, as:R0}.inV(){class:Car, as:E1 } RETURN $paths )
WHERE ( (   E1.CarColor IN ['white']   ) )

But this solution causes the match query to run much longer... So I need another solution to use "match" with conditions that will apply as case-INsensitive...

Thanks.

1

There are 1 answers

2
Luigi Dell'Aquila On

The easiest thing is to use .toLowerCase() eg. CarColor.toLowerCase() IN ['white']