OrientDB: text searching using gremlin

2019-06-02 07:13发布

问题:

I am using OrientDB and the gremlin console that comes with.

I am trying to search a pattern in text property. I have Email vertices with ebodyText property. The problem is that the result of querying with SQL like command and Gremlin language is quite different.

If I use SQL like query such as:

select count(*) from Email where eBodyText like '%Syria%'

it returns 24.

But if I query in gremlin console such as:

g.V.has('eBodyText').filter{it.eBodyText.matches('.*Syria.*')}.count()

it returns none.

Same queries with a different keyword 'memo' returns 161 by SQL but 20 by gremlin.

Why does this behave like this? Is there a problem with the syntax of gremlin command? Is there a better way to search text in gremlin?

I guess there might be a problem of setting properties in the upload script which uses python driver 'pyorient'. Python script used to upload the dataset

Thanks for your help.

回答1:

I tried with 2.1.15 and I had no problem.

These are the records.

EDITED

I added some vertexes to my DB and now the count() is 11

QUERY:

g.V.has('eBodyText').filter{it.eBodyText.contains('Syria')}.count()

OUTPUT:

==>11

Hope it helps.