arangosh> db.example.ensureIndex({ type: "fulltext", fields: [ "text" ], minLength: 3 });
{
"id" : "example/15849",
"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/15852",
"_key" : "15852",
"_rev" : "15852"
}
arangosh> db.example.save({ text : "quick brown fox", b : { c : 2 } });
{
"_id" : "example/15856",
"_key" : "15856",
"_rev" : "15856"
}
arangosh> db.example.save({ text : "brown fox jums", b : { c : 3 } });
{
"_id" : "example/15859",
"_key" : "15859",
"_rev" : "15859"
}
arangosh> db.example.save({ text : "fox jumps over", b : { c : 4 } });
{
"_id" : "example/15862",
"_key" : "15862",
"_rev" : "15862"
}
arangosh> db.example.save({ text : "jumps over the", b : { c : 5 } });
{
"_id" : "example/15865",
"_key" : "15865",
"_rev" : "15865"
}
arangosh> db.example.save({ text : "over the lazy", b : { c : 6 } });
{
"_id" : "example/15868",
"_key" : "15868",
"_rev" : "15868"
}
arangosh> db.example.save({ text : "the lazy dog", b : { c : 7 } });
{
"_id" : "example/15871",
"_key" : "15871",
"_rev" : "15871"
}
arangosh> db._query("FOR document IN FULLTEXT(example, 'text', 'the') RETURN document");
[
{
"_key" : "15852",
"_id" : "example/15852",
"_rev" : "15852",
"b" : {
"c" : 1
},
"text" : "the quick brown"
},
{
"_key" : "15865",
"_id" : "example/15865",
"_rev" : "15865",
"b" : {
"c" : 5
},
"text" : "jumps over the"
},
{
"_key" : "15868",
"_id" : "example/15868",
"_rev" : "15868",
"b" : {
"c" : 6
},
"text" : "over the lazy"
},
{
"_key" : "15871",
"_id" : "example/15871",
"_rev" : "15871",
"b" : {
"c" : 7
},
"text" : "the lazy dog"
}
]
[object ArangoQueryCursor, count: 4, hasMore: false]