arangosh> db.example.ensureIndex({ type: "fulltext", fields: [ "text" ], minLength: 3 });
{
"id" : "example/15960",
"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/15963",
"_key" : "15963",
"_rev" : "15963"
}
arangosh> db.example.save({ text : "quick brown fox", b : { c : 2 } });
{
"_id" : "example/15967",
"_key" : "15967",
"_rev" : "15967"
}
arangosh> db.example.save({ text : "brown fox jums", b : { c : 3 } });
{
"_id" : "example/15970",
"_key" : "15970",
"_rev" : "15970"
}
arangosh> db.example.save({ text : "fox jumps over", b : { c : 4 } });
{
"_id" : "example/15973",
"_key" : "15973",
"_rev" : "15973"
}
arangosh> db.example.save({ text : "jumps over the", b : { c : 5 } });
{
"_id" : "example/15976",
"_key" : "15976",
"_rev" : "15976"
}
arangosh> db.example.save({ text : "over the lazy", b : { c : 6 } });
{
"_id" : "example/15979",
"_key" : "15979",
"_rev" : "15979"
}
arangosh> db.example.save({ text : "the lazy dog", b : { c : 7 } });
{
"_id" : "example/15982",
"_key" : "15982",
"_rev" : "15982"
}
arangosh> db._query("FOR document IN FULLTEXT(example, 'text', 'the') RETURN document");
[
{
"_key" : "15963",
"_id" : "example/15963",
"_rev" : "15963",
"b" : {
"c" : 1
},
"text" : "the quick brown"
},
{
"_key" : "15976",
"_id" : "example/15976",
"_rev" : "15976",
"b" : {
"c" : 5
},
"text" : "jumps over the"
},
{
"_key" : "15979",
"_id" : "example/15979",
"_rev" : "15979",
"b" : {
"c" : 6
},
"text" : "over the lazy"
},
{
"_key" : "15982",
"_id" : "example/15982",
"_rev" : "15982",
"b" : {
"c" : 7
},
"text" : "the lazy dog"
}
]
[object ArangoQueryCursor, count: 4, hasMore: false]