# No synonyms

**URL:** <https://discuss.codelibs.org/t/no-synonyms/1274>\
**Category:** English:Fess\
**Created:** [July 7, 2020, 1:58pm UTC](https://discuss.codelibs.org/t/no-synonyms/1274 "2020-07-07T13:58:40Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Philip\_Colmer](https://discuss.codelibs.org/user_avatar/discuss.codelibs.org/philip_colmer/32/270_2.png) [@Philip\_Colmer](https://discuss.codelibs.org/u/Philip_Colmer)\
**Post date:** [July 7, 2020, 1:58pm UTC](https://discuss.codelibs.org/t/no-synonyms/1274/1 "2020-07-07T13:58:40Z")

</div>

On our system (fess 13.6.0), System \> Dictionaries does not have any synonym entry:

 ![image](https://discuss.codelibs.org/uploads/default/original/1X/a996b9522c1fb64222766c8ce6f4042bcd6647cd.png)

What do I need to do in order to add synonyms to our system?

---

<div class="post-metadata">

**Author:** ![shinsuke](https://discuss.codelibs.org/user_avatar/discuss.codelibs.org/shinsuke/32/6_2.png) [@shinsuke](https://discuss.codelibs.org/u/shinsuke)\
**Post date:** [July 7, 2020, 9:14pm UTC](https://discuss.codelibs.org/t/no-synonyms/1274/2 "2020-07-07T21:14:09Z")

</div>

To upload a dictionary file, see [configsync](https://github.com/codelibs/elasticsearch-configsync#register-file).

```
$ curl -XPOST -H 'Content-Type:application/json' localhost:9200/_configsync/file?path=en/synonym.txt --data-binary @synonym.txt

```

and then update [english\_analyzer](https://github.com/codelibs/fess/blob/fess-13.6.0/src/main/resources/fess_indices/fess.json#L801).

---

<div class="post-metadata">

**Author:** ![Philip\_Colmer](https://discuss.codelibs.org/user_avatar/discuss.codelibs.org/philip_colmer/32/270_2.png) [@Philip\_Colmer](https://discuss.codelibs.org/u/Philip_Colmer)\
**Post date:** [July 8, 2020, 11:37am UTC](https://discuss.codelibs.org/t/no-synonyms/1274/3 "2020-07-08T11:37:23Z")

</div>

@shinsuke thank you.

What format does the dictionary file need to be in for synonyms? Do you have an example?

To update english\_analyzer, what do I add? Do I add `synonym` to the filter list or `synonym_filter` or something else?

Thanks.

---

<div class="post-metadata">

**Author:** ![shinsuke](https://discuss.codelibs.org/user_avatar/discuss.codelibs.org/shinsuke/32/6_2.png) [@shinsuke](https://discuss.codelibs.org/u/shinsuke)\
**Post date:** [July 8, 2020, 1:21pm UTC](https://discuss.codelibs.org/t/no-synonyms/1274/4 "2020-07-08T13:21:57Z")

</div>

To edit analysis settings, knowledge of [Text Analysis](https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis.html) is required.

---

<div class="post-metadata">

**Author:** ![Philip\_Colmer](https://discuss.codelibs.org/user_avatar/discuss.codelibs.org/philip_colmer/32/270_2.png) [@Philip\_Colmer](https://discuss.codelibs.org/u/Philip_Colmer)\
**Post date:** [July 8, 2020, 2:20pm UTC](https://discuss.codelibs.org/t/no-synonyms/1274/5 "2020-07-08T14:20:10Z")

</div>

I don’t understand. Your original reply said that I had to do two things:

1. Upload a dictionary file and
2. Update english\_analyzer

I **think** that all I need to be told is:

1. What format the dictionary file needs to be in, preferably with an example and
2. What changes I need to make to english\_analyzer.

The documentation says that synonyms are supported but fess doesn’t have any built in, so I’m struggling to get that feature working.

Thank you.

---

<div class="post-metadata">

**Author:** ![shinsuke](https://discuss.codelibs.org/user_avatar/discuss.codelibs.org/shinsuke/32/6_2.png) [@shinsuke](https://discuss.codelibs.org/u/shinsuke)\
**Post date:** [July 8, 2020, 10:12pm UTC](https://discuss.codelibs.org/t/no-synonyms/1274/6 "2020-07-08T22:12:55Z")

</div>

As for English, you can edit `synonym.txt`.  
If you want to add it to english\_analyzer, 1 and 2 are needed.

The [synonym](https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-synonym-graph-tokenfilter.html) information is included in the text analysis.  
So, you can add a synonym graph token filter to [filter](https://github.com/codelibs/fess/blob/fess-13.6.0/src/main/resources/fess_indices/fess.json#L38), and then also add the name to [filter](https://github.com/codelibs/fess/blob/fess-13.6.0/src/main/resources/fess_indices/fess.json#L804) of english\_analyzer.

If you need more supports, please contact [Commercial Support](https://www.n2sm.net/en/support/fess_support.html) .

---

<div class="post-metadata">

**Author:** ![Philip\_Colmer](https://discuss.codelibs.org/user_avatar/discuss.codelibs.org/philip_colmer/32/270_2.png) [@Philip\_Colmer](https://discuss.codelibs.org/u/Philip_Colmer)\
**Post date:** [July 9, 2020, 7:05am UTC](https://discuss.codelibs.org/t/no-synonyms/1274/7 "2020-07-09T07:05:31Z")

</div>

@shinsuke Thank you for the additional information.

It looks like fess supports the Solr format of synonyms ([https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-synonym-graph-tokenfilter.html#\_solr\_synonyms\_2](https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-synonym-graph-tokenfilter.html#_solr_synonyms_2)) and I’ve successfully added a synonym file to Elasticsearch. I’ve also added the synonym filter to english\_analyzer.

One final question: when the synonym list changes, do I have to wait for fess to recrawl everything or is there a way to speed up the process of getting the synonyms to work?

---

<div class="post-metadata">

**Author:** ![shinsuke](https://discuss.codelibs.org/user_avatar/discuss.codelibs.org/shinsuke/32/6_2.png) [@shinsuke](https://discuss.codelibs.org/u/shinsuke)\
**Post date:** [July 9, 2020, 7:22am UTC](https://discuss.codelibs.org/t/no-synonyms/1274/8 "2020-07-09T07:22:57Z")

</div>

To apply changes on dictionary files, reopening index is needed.  
To reopen an index, please click Reload button on System Info \> Maintainace page.

---

<div class="post-metadata">

**Author:** ![Philip\_Colmer](https://discuss.codelibs.org/user_avatar/discuss.codelibs.org/philip_colmer/32/270_2.png) [@Philip\_Colmer](https://discuss.codelibs.org/u/Philip_Colmer)\
**Post date:** [July 24, 2020, 7:39am UTC](https://discuss.codelibs.org/t/no-synonyms/1274/9 "2020-07-24T07:39:22Z")

</div>

I still don’t have synonyms working on my system ☹

I want to share multiple screenshots to make it clear what the system is doing at the moment but I can only post one image at a time, so it will require multiple posts, I’m afraid.

I’ve got the synonyms defined:

 ![image](https://discuss.codelibs.org/uploads/default/original/1X/c602a603defb2f5fcd7939d3ad0dc731adf86d42.png)

---

<div class="post-metadata">

**Author:** ![Philip\_Colmer](https://discuss.codelibs.org/user_avatar/discuss.codelibs.org/philip_colmer/32/270_2.png) [@Philip\_Colmer](https://discuss.codelibs.org/u/Philip_Colmer)\
**Post date:** [July 24, 2020, 7:40am UTC](https://discuss.codelibs.org/t/no-synonyms/1274/10 "2020-07-24T07:40:07Z")

</div>

Here are the actual synonyms:

 ![image](https://discuss.codelibs.org/uploads/default/original/1X/3d5f387a710fbd312bb6fae52ddd91d9c67fbdeb.png)

---

<div class="post-metadata">

**Author:** ![Philip\_Colmer](https://discuss.codelibs.org/user_avatar/discuss.codelibs.org/philip_colmer/32/270_2.png) [@Philip\_Colmer](https://discuss.codelibs.org/u/Philip_Colmer)\
**Post date:** [July 24, 2020, 7:40am UTC](https://discuss.codelibs.org/t/no-synonyms/1274/11 "2020-07-24T07:40:58Z")

</div>

If I search using Bennée, it finds 29 results:  
 ![image](https://discuss.codelibs.org/uploads/default/original/1X/d43cb143d7580913b88daa17466389e145d61cd0.png)

---

<div class="post-metadata">

**Author:** ![Philip\_Colmer](https://discuss.codelibs.org/user_avatar/discuss.codelibs.org/philip_colmer/32/270_2.png) [@Philip\_Colmer](https://discuss.codelibs.org/u/Philip_Colmer)\
**Post date:** [July 24, 2020, 7:42am UTC](https://discuss.codelibs.org/t/no-synonyms/1274/12 "2020-07-24T07:42:44Z")

</div>

If I search using Bennee, it finds 6 results:  
 ![image](https://discuss.codelibs.org/uploads/default/original/1X/b9400a1e199a87d149f438ef342103386df4fa3d.png)

We want to use synonyms to handle the wider differences in US and UK language (e.g. virtualise vs virtualize) but using Bennee and Bennée is an easy test of the system.

I would expect _all_ of the search results to be the same, regardless of which spelling I use to search with.

What can I do next to either troubleshoot this or resolve it, please?

Thank you.

---

<div class="post-metadata">

**Author:** ![shinsuke](https://discuss.codelibs.org/user_avatar/discuss.codelibs.org/shinsuke/32/6_2.png) [@shinsuke](https://discuss.codelibs.org/u/shinsuke)\
**Post date:** [July 24, 2020, 9:54pm UTC](https://discuss.codelibs.org/t/no-synonyms/1274/13 "2020-07-24T21:54:56Z")

</div>

en/\*.txt is for English documents.  
A language which documents has is detected automatically.  
You can check it on Admin [Search](https://fess.codelibs.org/13.8/admin/searchlist-guide.html) page.

---

<div class="post-metadata">

**Author:** ![Philip\_Colmer](https://discuss.codelibs.org/user_avatar/discuss.codelibs.org/philip_colmer/32/270_2.png) [@Philip\_Colmer](https://discuss.codelibs.org/u/Philip_Colmer)\
**Post date:** [July 25, 2020, 11:25am UTC](https://discuss.codelibs.org/t/no-synonyms/1274/14 "2020-07-25T11:25:18Z")

</div>

I can confirm that the first result for Bennée and the first result for Bennee are both classified as “en”.

---

<div class="post-metadata">

**Author:** ![shinsuke](https://discuss.codelibs.org/user_avatar/discuss.codelibs.org/shinsuke/32/6_2.png) [@shinsuke](https://discuss.codelibs.org/u/shinsuke)\
**Post date:** [July 26, 2020, 1:47am UTC](https://discuss.codelibs.org/t/no-synonyms/1274/15 "2020-07-26T01:47:52Z")

</div>

Did you delete docs in the index and crawl them again?

---

<div class="post-metadata">

**Author:** ![Philip\_Colmer](https://discuss.codelibs.org/user_avatar/discuss.codelibs.org/philip_colmer/32/270_2.png) [@Philip\_Colmer](https://discuss.codelibs.org/u/Philip_Colmer)\
**Post date:** [July 26, 2020, 7:59am UTC](https://discuss.codelibs.org/t/no-synonyms/1274/16 "2020-07-26T07:59:49Z")

</div>

> [@shinsuke](#):
>
> Did you delete docs in the index and crawl them again?

I haven’t. So far, I have followed these instructions:

> [@shinsuke](#):
>
> To apply changes on dictionary files, reopening index is needed.  
> To reopen an index, please click Reload button on System Info \> Maintainace page.

I have also tried Maintenance \> Reindex but that doesn’t seem to have made any difference. It is difficult to tell as I cannot find any logs or other indication that the reindexing has finished.

Should I be deleting the indexes? If so, which ones?

 ![image](https://discuss.codelibs.org/uploads/default/original/1X/089e1c135ce80bfa57907212ec1166ffcbb9f9e8.png)

---

<div class="post-metadata">

**Author:** ![Philip\_Colmer](https://discuss.codelibs.org/user_avatar/discuss.codelibs.org/philip_colmer/32/270_2.png) [@Philip\_Colmer](https://discuss.codelibs.org/u/Philip_Colmer)\
**Post date:** [July 26, 2020, 8:00am UTC](https://discuss.codelibs.org/t/no-synonyms/1274/17 "2020-07-26T08:00:26Z")

</div>

or

 ![image](https://discuss.codelibs.org/uploads/default/original/1X/09f3cf71d455db486195922129166536e30e756e.png)

---

<div class="post-metadata">

**Author:** ![Philip\_Colmer](https://discuss.codelibs.org/user_avatar/discuss.codelibs.org/philip_colmer/32/270_2.png) [@Philip\_Colmer](https://discuss.codelibs.org/u/Philip_Colmer)\
**Post date:** [July 26, 2020, 8:01am UTC](https://discuss.codelibs.org/t/no-synonyms/1274/18 "2020-07-26T08:01:04Z")

</div>

and do I use the “delete index” menu option on the Dashboard?  
 ![image](https://discuss.codelibs.org/uploads/default/original/1X/e3fd110bcacefa1c6773de93e46edad4f3c1778e.png)

---

<div class="post-metadata">

**Author:** ![Philip\_Colmer](https://discuss.codelibs.org/user_avatar/discuss.codelibs.org/philip_colmer/32/270_2.png) [@Philip\_Colmer](https://discuss.codelibs.org/u/Philip_Colmer)\
**Post date:** [July 26, 2020, 8:04am UTC](https://discuss.codelibs.org/t/no-synonyms/1274/19 "2020-07-26T08:04:04Z")

</div>

Previously, I had asked:

> [@Philip\_Colmer](#):
>
> One final question: when the synonym list changes, do I have to wait for fess to recrawl everything or is there a way to speed up the process of getting the synonyms to work?

to which you replied

> [@shinsuke](#):
>
> To apply changes on dictionary files, reopening index is needed.  
> To reopen an index, please click Reload button on System Info \> Maintainace page.

Does your question:

> [@shinsuke](#):
>
> Did you delete docs in the index and crawl them again?

mean that if the synonyms change but the documents don’t, the documents have got to be removed from the index (somehow) and re-crawled?

Hopefully your answers to my screenshots will help me to better understand how to get this working.

Thank you.

---

<div class="post-metadata">

**Author:** ![Philip\_Colmer](https://discuss.codelibs.org/user_avatar/discuss.codelibs.org/philip_colmer/32/270_2.png) [@Philip\_Colmer](https://discuss.codelibs.org/u/Philip_Colmer)\
**Post date:** [July 27, 2020, 2:58pm UTC](https://discuss.codelibs.org/t/no-synonyms/1274/20 "2020-07-27T14:58:40Z")

</div>

I’ve got it working.

I made a mistake in the modifications to the `fess.json` file. I thought that because there was already a synonym filter there, I could point the english analyzer at that, but that then wasn’t picking up the english synonym file.

Thank you for your assistance.
