Get all related products based on their full-text search relationship
Posted
by MikeJ
on Stack Overflow
See other posts from Stack Overflow
or by MikeJ
Published on 2010-06-09T10:48:55Z
Indexed on
2010/06/09
10:52 UTC
Read the original article
Hit count: 325
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?
© Stack Overflow or respective owner