Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental: simple synonym list #581

Closed
wants to merge 2 commits into from

Conversation

lonvia
Copy link
Collaborator

@lonvia lonvia commented May 25, 2021

This adds a new command-line parameter -synonym-file which can be used to experiment with applying synonyms at query time. The synonym list is loaded when Photon is started. It is not necessary to reindex the existing database and will work against our precomputed database dumps.

The synonym file must be a simple text file. Each line contains a comma-separated list of mutual synonyms. Only single word
synonyms are allowed. To that end, the loader will reject any synonym file that contains spaces.

This PR is unlikely to make it into master as is. I just thought I put it out in public in case somebody else wants to experiment with using synonyms.

@hbruch

The synonyms are applied at query time. The list must be given at
runtime and may be modified in between runs.

The synonym file must be a simple text file. Each line contains
a comma-separated list of mutual synonyms. Only single word
synonyms are allowed.
@lonvia lonvia force-pushed the simple-synonyms branch from 7a8b26a to 49abf6f Compare June 5, 2021 08:10
Synonyms are applied after the lowercase filter, so make sure
they are in the right format.
@@ -72,7 +72,7 @@ public IndexSettings setSynonyms(String synonymFile) throws IOException {
if (line.indexOf(' ') >= 0) {
throw new RuntimeException("Synonym list must not contain any spaces or multi word terms.");
}
synonyms.put(line);
synonyms.put(line.toLowerCase());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line.toLowerCase(Locale.ROOT) ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be "whatever ES uses", to be precise.

@lonvia
Copy link
Collaborator Author

lonvia commented Jun 17, 2021

Now included in #585.

@lonvia lonvia closed this Jun 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants