arangosh> db.example.ensureIndex({ type: "fulltext", fields: [ "text" ], minLength: 3 });
{
"id" : "example/1132770865",
"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/1133295153",
"_rev" : "1133295153",
"_key" : "1133295153"
}
arangosh> db.example.save({ text : "quick brown fox", b : { c : 2 } });
{
"_id" : "example/1133491761",
"_rev" : "1133491761",
"_key" : "1133491761"
}
arangosh> db.example.save({ text : "brown fox jums", b : { c : 3 } });
{
"_id" : "example/1133688369",
"_rev" : "1133688369",
"_key" : "1133688369"
}
arangosh> db.example.save({ text : "fox jumps over", b : { c : 4 } });
{
"_id" : "example/1133884977",
"_rev" : "1133884977",
"_key" : "1133884977"
}
arangosh> db.example.save({ text : "jumps over the", b : { c : 5 } });
{
"_id" : "example/1134081585",
"_rev" : "1134081585",
"_key" : "1134081585"
}
arangosh> db.example.save({ text : "over the lazy", b : { c : 6 } });
{
"_id" : "example/1134278193",
"_rev" : "1134278193",
"_key" : "1134278193"
}
arangosh> db.example.save({ text : "the lazy dog", b : { c : 7 } });
{
"_id" : "example/1134474801",
"_rev" : "1134474801",
"_key" : "1134474801"
}
arangosh> db._query("FOR document IN FULLTEXT(example, 'text', 'the') RETURN document");
[
{
"b" : {
"c" : 1
},
"text" : "the quick brown",
"_id" : "example/1133295153",
"_rev" : "1133295153",
"_key" : "1133295153"
},
{
"b" : {
"c" : 5
},
"text" : "jumps over the",
"_id" : "example/1134081585",
"_rev" : "1134081585",
"_key" : "1134081585"
},
{
"b" : {
"c" : 6
},
"text" : "over the lazy",
"_id" : "example/1134278193",
"_rev" : "1134278193",
"_key" : "1134278193"
},
{
"b" : {
"c" : 7
},
"text" : "the lazy dog",
"_id" : "example/1134474801",
"_rev" : "1134474801",
"_key" : "1134474801"
}
]
[object ArangoQueryCursor, count: 4, hasMore: false]