arangosh> db.example.ensureIndex({ type: "fulltext", fields: [ "text" ], minLength: 3 });
{
"fields" : [
"text"
],
"id" : "example/340282952",
"minLength" : 3,
"sparse" : true,
"type" : "fulltext",
"unique" : false,
"isNewlyCreated" : true,
"code" : 201
}
arangosh> db.example.save({ text : "the quick brown", b : { c : 1 } });
{
"_id" : "example/340807240",
"_rev" : "340807240",
"_key" : "340807240"
}
arangosh> db.example.save({ text : "quick brown fox", b : { c : 2 } });
{
"_id" : "example/341003848",
"_rev" : "341003848",
"_key" : "341003848"
}
arangosh> db.example.save({ text : "brown fox jums", b : { c : 3 } });
{
"_id" : "example/341200456",
"_rev" : "341200456",
"_key" : "341200456"
}
arangosh> db.example.save({ text : "fox jumps over", b : { c : 4 } });
{
"_id" : "example/341397064",
"_rev" : "341397064",
"_key" : "341397064"
}
arangosh> db.example.save({ text : "jumps over the", b : { c : 5 } });
{
"_id" : "example/341593672",
"_rev" : "341593672",
"_key" : "341593672"
}
arangosh> db.example.save({ text : "over the lazy", b : { c : 6 } });
{
"_id" : "example/341790280",
"_rev" : "341790280",
"_key" : "341790280"
}
arangosh> db.example.save({ text : "the lazy dog", b : { c : 7 } });
{
"_id" : "example/341986888",
"_rev" : "341986888",
"_key" : "341986888"
}
arangosh> db._query("FOR document IN FULLTEXT(example, 'text', 'the') RETURN document");
[
{
"_id" : "example/340807240",
"_key" : "340807240",
"_rev" : "340807240",
"b" : {
"c" : 1
},
"text" : "the quick brown"
},
{
"_id" : "example/341593672",
"_key" : "341593672",
"_rev" : "341593672",
"b" : {
"c" : 5
},
"text" : "jumps over the"
},
{
"_id" : "example/341790280",
"_key" : "341790280",
"_rev" : "341790280",
"b" : {
"c" : 6
},
"text" : "over the lazy"
},
{
"_id" : "example/341986888",
"_key" : "341986888",
"_rev" : "341986888",
"b" : {
"c" : 7
},
"text" : "the lazy dog"
}
]
[object ArangoQueryCursor, count: 4, hasMore: false]