2017  Kodetalk | Feedback | Privacy Policy | Terms | About

How to use Fulltext search of ArangoDB using java code

i have created the fulltext search index in my collection called ITEM and my requirement is to search the item using java code and AQL of arangodb. How can i do this?

You can below code snippet to get the expected result :

Map<String, Object> bindVars = new MapBuilder().put("coll", "ITEM")
    .put("attribute", Use key name which you want to search).put("query", query)
    .put("limit", limit).get();
String searchResult = ArangoDBConnection.getDB()
    .executeAqlQueryJSON("FOR search IN FULLTEXT(@coll, @attribute, @query, @limit) RETURN {"ITEM": search.ITEM_NAME }",
            bindVars, null);

The return type is string array which you can convert to JSON object and process data based on your requirement.

Answer is