Reputation: 159
I'm using OrientDB 2.1.8 Community and built-in Lucene index. How I can define which field I want to use during the search in manual index? I.e. work with manual indexes in a manner like described on Working with Multiple Fields page in the documentation?
Below is short example to show what I'm trying to do.
CREATE VERTEX CONTENT {"name": "squirrel"}
// rid = #9:2
CREATE VERTEX CONTENT {"name": "scrat", "description": "Scrat was an acorn-obsessed saber-toothed squirrel"}
// rid = #9:3
CREATE INDEX manual FULLTEXT ENGINE LUCENE STRING,STRING
INSERT INTO INDEX:manual (key,rid) VALUES ('squirrel', #9:2)
INSERT INTO INDEX:manual (key,rid) VALUES (['scrat', 'scrat was an acorn-obsessed saber-toothed squirrel'], #9:3)
Now query SELECT rid FROM INDEX:manual WHERE key LUCENE 'squirrel'
will return both #9:2
and #9:3
.
How I should change the type of the key and/or INSERT INTO INDEX
commands to be able to define which field I want to use? For example, query like SELECT rid FROM INDEX:manual WHERE key LUCENE 'name:squirrel'
should return only #9:2
, but not #9:3
.
Any ideas?
Upvotes: 1
Views: 381
Reputation: 3570
I have tried with create index manual FULLTEXT ENGINE LUCENE STRING,STRING METADATA {"analyzer":"org.apache.lucene.analysis.core.KeywordAnalyzer"}
and it works
CREATE VERTEX CONTENT {"name": "squirrel"}
CREATE VERTEX CONTENT {"name": "scrat", "description": "Scrat was an acorn-obsessed saber-toothed squirrel"}
create index manual FULLTEXT ENGINE LUCENE STRING,STRING METADATA {"analyzer":"org.apache.lucene.analysis.core.KeywordAnalyzer"}
INSERT INTO INDEX:manual (key,rid) VALUES ('squirrel', #9:0)
INSERT INTO INDEX:manual (key,rid) VALUES (['scrat', 'scrat was an acorn-obsessed saber-toothed squirrel'], #9:1)
Upvotes: 1