vespa-engine / vespa

AI + Data, online. https://vespa.ai
https://vespa.ai
Apache License 2.0
5.47k stars 584 forks source link

Synonym enrichment implementation using semantic rules language #20386

Closed romanhwix closed 2 years ago

romanhwix commented 2 years ago

Is your feature request related to a problem? Please describe. It's very useful for full text search system to have synonym enrichment for searching terms. The most suitable vespa standard tool for that is semantic rules. Synonym is symmetric relation, that's why i want to have possibility to describe this using vespa semantic rules in clean way.

Describe the solution you'd like Now to achieve symmetric relation using semantic rules i must to duplicate words synonym list in condition and in production clauses, for example: index:[synonyms] -> index:foo?index:baz?index:bar; [synonyms] :- foo, baz, bar; I want to avoid this redundant duplication as for single and for compound words as well.

romanhwix commented 2 years ago
Screenshot 2021-12-06 at 18 56 01
bratseth commented 2 years ago

From 7.532 onwards you can write

index1:[synonyms1] -> =index1:[synonyms1*];

[synonyms1] :- foo, baz, bar;

to do this (the new syntax is the star, to produce all items of the condition).

https://github.com/vespa-engine/vespa/pull/20866 https://github.com/vespa-engine/documentation/pull/1764