arangosh> db.example.ensureIndex({ type: "fulltext", fields: [ "text" ], minLength: 3 });
{
"id" : "example/1140667497",
"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/1141191785",
"_rev" : "1141191785",
"_key" : "1141191785"
}
arangosh> db.example.save({ text : "quick brown fox", b : { c : 2 } });
{
"_id" : "example/1141388393",
"_rev" : "1141388393",
"_key" : "1141388393"
}
arangosh> db.example.save({ text : "brown fox jums", b : { c : 3 } });
{
"_id" : "example/1141585001",
"_rev" : "1141585001",
"_key" : "1141585001"
}
arangosh> db.example.save({ text : "fox jumps over", b : { c : 4 } });
{
"_id" : "example/1141781609",
"_rev" : "1141781609",
"_key" : "1141781609"
}
arangosh> db.example.save({ text : "jumps over the", b : { c : 5 } });
{
"_id" : "example/1141978217",
"_rev" : "1141978217",
"_key" : "1141978217"
}
arangosh> db.example.save({ text : "over the lazy", b : { c : 6 } });
{
"_id" : "example/1142174825",
"_rev" : "1142174825",
"_key" : "1142174825"
}
arangosh> db.example.save({ text : "the lazy dog", b : { c : 7 } });
{
"_id" : "example/1142371433",
"_rev" : "1142371433",
"_key" : "1142371433"
}
arangosh> db._query("FOR document IN FULLTEXT(example, 'text', 'the') RETURN document");
[
{
"b" : {
"c" : 1
},
"text" : "the quick brown",
"_id" : "example/1141191785",
"_rev" : "1141191785",
"_key" : "1141191785"
},
{
"b" : {
"c" : 5
},
"text" : "jumps over the",
"_id" : "example/1141978217",
"_rev" : "1141978217",
"_key" : "1141978217"
},
{
"b" : {
"c" : 6
},
"text" : "over the lazy",
"_id" : "example/1142174825",
"_rev" : "1142174825",
"_key" : "1142174825"
},
{
"b" : {
"c" : 7
},
"text" : "the lazy dog",
"_id" : "example/1142371433",
"_rev" : "1142371433",
"_key" : "1142371433"
}
]
[object ArangoQueryCursor, count: 4, hasMore: false]