Get all related products based on their full-text search relationship
- by MikeJ
I have a Product table with the fields Id, Title, Description, Keywords (just comma separated list of keywords).
Table is full-text indexed.
When I view one product, I do a query and search the full-text catalog for any related products based on the Keywords field.
select * from Products where Contains(Products.*, @keywordsFromOneProduct)
Works like a charm.
Now I would like to list all products and all their related products in a big list and I want to avoid calling this method for each item.
Any ideas how could I do it? I was thinking about a job that would go through products one by one and build a one-many mapping table (fields ProductId, RelatedProductId), but I wonder is there a better way?