Given an arbitrary full text search (FTS) query, it's required to list keywords from the resulting document which match the query. For example, test or rest
produces list of 3 documents where 1st one contains only test
, 2nd one contains both of the words and the 3rd one has only rest
. The explanation should produce 3 lists: (test
) (test
, rest
) (rest
) for the end user to understand why the documents appeared in the query output.
The question is related to hit-highlighting and I've explored existing solutions (e.g. http://www.codeproject.com/Articles/623815/Hit-Highlight-for-SQL-Server-Full-Text-Search or How to do hit-highlighting of results from a SQL Server full-text query). Those solutions rely on sys.dm_fts_parser
fed with hard-coded FORMSOF (INFLECTIONAL
to produce all permutations of the search term.
Particularly, solutions relying on sys.dm_fts_parser
seem to stumble upon a prefix search. For example, given 2 queries test
and "test*"
select content from table where contains(content, @query, language 1033)
produces different result sets, but select * from sys.dm_fts_parser(@query, 1033, 0, 1)
yields 2 absolutely identical recordsets, which doesn't give any clue as to why query outputs are different.
Anyone has any experience with similar cases?