arangosh> db.example.ensureIndex({ type: "fulltext", fields: [ "text" ], minLength: 3 });
{
"id" : "example/4231110587",
"type" : "fulltext",
"fields" : [
"text"
],
"unique" : false,
"sparse" : true,
"minLength" : 3,
"isNewlyCreated" : true,
"code" : 201
}
arangosh> db.example.save({ text : "the quick brown", b : { c : 1 } });
{
"_id" : "example/4231634875",
"_rev" : "4231634875",
"_key" : "4231634875"
}
arangosh> db.example.save({ text : "quick brown fox", b : { c : 2 } });
{
"_id" : "example/4231831483",
"_rev" : "4231831483",
"_key" : "4231831483"
}
arangosh> db.example.save({ text : "brown fox jums", b : { c : 3 } });
{
"_id" : "example/4232028091",
"_rev" : "4232028091",
"_key" : "4232028091"
}
arangosh> db.example.save({ text : "fox jumps over", b : { c : 4 } });
{
"_id" : "example/4232224699",
"_rev" : "4232224699",
"_key" : "4232224699"
}
arangosh> db.example.save({ text : "jumps over the", b : { c : 5 } });
{
"_id" : "example/4232421307",
"_rev" : "4232421307",
"_key" : "4232421307"
}
arangosh> db.example.save({ text : "over the lazy", b : { c : 6 } });
{
"_id" : "example/4232617915",
"_rev" : "4232617915",
"_key" : "4232617915"
}
arangosh> db.example.save({ text : "the lazy dog", b : { c : 7 } });
{
"_id" : "example/4232814523",
"_rev" : "4232814523",
"_key" : "4232814523"
}
arangosh> db._query("FOR document IN FULLTEXT(example, 'text', 'the') RETURN document");
[
{
"b" : {
"c" : 1
},
"text" : "the quick brown",
"_id" : "example/4231634875",
"_rev" : "4231634875",
"_key" : "4231634875"
},
{
"b" : {
"c" : 5
},
"text" : "jumps over the",
"_id" : "example/4232421307",
"_rev" : "4232421307",
"_key" : "4232421307"
},
{
"b" : {
"c" : 6
},
"text" : "over the lazy",
"_id" : "example/4232617915",
"_rev" : "4232617915",
"_key" : "4232617915"
},
{
"b" : {
"c" : 7
},
"text" : "the lazy dog",
"_id" : "example/4232814523",
"_rev" : "4232814523",
"_key" : "4232814523"
}
]
[object ArangoQueryCursor, count: 4, hasMore: false]