arangosh> db.example.ensureIndex({ type: "fulltext", fields: [ "text" ], minLength: 3 });
{
"id" : "example/15942",
"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/15945",
"_key" : "15945",
"_rev" : "15945"
}
arangosh> db.example.save({ text : "quick brown fox", b : { c : 2 } });
{
"_id" : "example/15949",
"_key" : "15949",
"_rev" : "15949"
}
arangosh> db.example.save({ text : "brown fox jums", b : { c : 3 } });
{
"_id" : "example/15952",
"_key" : "15952",
"_rev" : "15952"
}
arangosh> db.example.save({ text : "fox jumps over", b : { c : 4 } });
{
"_id" : "example/15955",
"_key" : "15955",
"_rev" : "15955"
}
arangosh> db.example.save({ text : "jumps over the", b : { c : 5 } });
{
"_id" : "example/15958",
"_key" : "15958",
"_rev" : "15958"
}
arangosh> db.example.save({ text : "over the lazy", b : { c : 6 } });
{
"_id" : "example/15961",
"_key" : "15961",
"_rev" : "15961"
}
arangosh> db.example.save({ text : "the lazy dog", b : { c : 7 } });
{
"_id" : "example/15964",
"_key" : "15964",
"_rev" : "15964"
}
arangosh> db._query("FOR document IN FULLTEXT(example, 'text', 'the') RETURN document");
[
{
"_key" : "15945",
"_id" : "example/15945",
"_rev" : "15945",
"b" : {
"c" : 1
},
"text" : "the quick brown"
},
{
"_key" : "15958",
"_id" : "example/15958",
"_rev" : "15958",
"b" : {
"c" : 5
},
"text" : "jumps over the"
},
{
"_key" : "15961",
"_id" : "example/15961",
"_rev" : "15961",
"b" : {
"c" : 6
},
"text" : "over the lazy"
},
{
"_key" : "15964",
"_id" : "example/15964",
"_rev" : "15964",
"b" : {
"c" : 7
},
"text" : "the lazy dog"
}
]
[object ArangoQueryCursor, count: 4, hasMore: false]