ArangoSearch with custom analyser

33 views
Skip to first unread message

stephane leroi

unread,
Jun 8, 2021, 6:55:31 AM6/8/21
to ArangoDB
I've tried to create a custom analyser to have French encoding, not stem, keep the case
But I didn't succed to Search on it....
I did'nt get what I've missed
Any help would be very apreciated




Document  Collection TEST :

[

  {

    "_key": "2",

    "_id": "TEST/2",

    "_rev": "_ccqwnQO---",

    "FIELD1": "LE SAINT",

    "FIELD2": "test"

  }

]

 

Analyser creation :  French encoding, not to stem, keep the case

var analyzers = require("@arangodb/analyzers");

  analyzers.save("text_fr_exact", "text", {locale: "fr.utf-8", case: "none", accent: true, stemming: false, stopwords: []})

 

Text Search

vueTest = db._createView("vueTest", "arangosearch", {});

vueTest.properties({links: {'TEST':{includeAllFields: true,fields:{FIELD1:{analyzers: ["text_fr_exact"]}, FIELD2:{analyzers: ["text_fr_exact"]}}}}});

 

Query

FOR t IN vueTest

SEARCH ANALYZER( PHRASE(t.NOMVISITEUR, "LE SAINT"), 'text_fr_exact')

RETURN t

 

The query didn’t return anything…

Simran Spiller

unread,
Jun 8, 2021, 11:56:55 AM6/8/21
to ArangoDB
In your query, you try to search in the field "NOMVISITEUR", but that field isn't indexed with the "text_fr_exact" Analyzer. Only "FIELD1" and "FIELD2" are.
Update the View with fields:{NOMVISITEUR:{analyzers: ["text_fr_exact"]}, ... } or perhaps index all fields with that Analyzer:

vueTest.properties({links: {"TEST":{includeAllFields: true, analyzers: ["text_fr_exact"]}}});

Reply all
Reply to author
Forward
0 new messages