arangosh> db.example.ensureIndex({ type: "fulltext", fields: [ "text" ], minLength: 3 });
{
"id" : "example/15797",
"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/15800",
"_key" : "15800",
"_rev" : "15800"
}
arangosh> db.example.save({ text : "quick brown fox", b : { c : 2 } });
{
"_id" : "example/15804",
"_key" : "15804",
"_rev" : "15804"
}
arangosh> db.example.save({ text : "brown fox jums", b : { c : 3 } });
{
"_id" : "example/15807",
"_key" : "15807",
"_rev" : "15807"
}
arangosh> db.example.save({ text : "fox jumps over", b : { c : 4 } });
{
"_id" : "example/15810",
"_key" : "15810",
"_rev" : "15810"
}
arangosh> db.example.save({ text : "jumps over the", b : { c : 5 } });
{
"_id" : "example/15813",
"_key" : "15813",
"_rev" : "15813"
}
arangosh> db.example.save({ text : "over the lazy", b : { c : 6 } });
{
"_id" : "example/15816",
"_key" : "15816",
"_rev" : "15816"
}
arangosh> db.example.save({ text : "the lazy dog", b : { c : 7 } });
{
"_id" : "example/15819",
"_key" : "15819",
"_rev" : "15819"
}
arangosh> db._query("FOR document IN FULLTEXT(example, 'text', 'the') RETURN document");
[
{
"_key" : "15800",
"_id" : "example/15800",
"_rev" : "15800",
"b" : {
"c" : 1
},
"text" : "the quick brown"
},
{
"_key" : "15813",
"_id" : "example/15813",
"_rev" : "15813",
"b" : {
"c" : 5
},
"text" : "jumps over the"
},
{
"_key" : "15816",
"_id" : "example/15816",
"_rev" : "15816",
"b" : {
"c" : 6
},
"text" : "over the lazy"
},
{
"_key" : "15819",
"_id" : "example/15819",
"_rev" : "15819",
"b" : {
"c" : 7
},
"text" : "the lazy dog"
}
]
[object ArangoQueryCursor, count: 4, hasMore: false]