persistent class %iFind.Synonym extends %Library.Persistent
SQL Table Name: %iFind.Synonym
To leverage the iFind synonym expansion functionality, users have to create the class which extends %iFind.Synonym .
Users could define the synonym pair by inserting (FromTerm,ToTerm) pair into the synonym table. Both FromTerm and ToTerm could be just single word or multuple words. If ToTerm consists of multiple word, it is implicitly treated as a iFind positional search phrase after expansion. For Japanese, user should ensure the ToTerm is always an single valid term, since iFind do not support positional search for Japanese
For synonym pair like (New York,NY), "NY" is automatically expanded into your query phrase. For (ISC, Inter*System* Corp),the iFind positional search phrase (Inter*System* Corp) get expanded into the original query.
So if the text contains a phrase like "InterSystems Corp", it is a match. One thing should be noted is that the minimum mathcing unit in the query is the single word or an valid positional search phrase. This means iFind won't try to perform query expanion for the single word of the positioal phrase. You have to explicitly specify the whole positional search phrase in the synonym table, (New York, NY) is an example here.
Users could use the default logic implemented in GetMatch() to decide where the term of the indexed text matches to FromTerm or not. Users could also overwrite the default implementation in GetMatch() to provide your own matching logic.
To supply the synonym tables during query, users should provide a comma seperated list which contain the full qualified name of those synonym tables to the fifth parameter of search_index().
Suppose users define two synonym tables called "iFind.Sym1" and "iFind.Sym2",
The query leveraing the single synonym table expansion could be like:
select * from Sample.Tab where %ID %FIND search_index(iFind_Index,'query terms',,,'iFind.Sym1')
The query leveraing multiple synonym tables expansion could be like:
select * from Sample.Tab where %ID %FIND search_index(iFind_Index,'query terms',,,'iFind.Sym1,iFind.Sym2')
This function returns all the ToTerm in the synonym table in which the FromTerm is exactly identical with Source The results are placed in Matches with the format Matches("ToTerm") = ""
The IndexParam should contain all the parameters defined for the specific iFind index in which you would like to perform synonym expansion. For example, if you define "LOWER" for this specific iFind index, the GetMatch() would also follow the "LOWER" setting to decide whether this match has be case sensitive or case insensitive.
Note: any wildcard in the Source would be treated as normal character. For example, if the FromTerm is "InterSystems" and the Source is "InterSystem*", the Source would not match this FromTerm. Also, GetMatch() performs language independent exact match, this implies each FromTerm could belong to different languages.