I'm trying to write a search function for an e-commerce website and products have multiple properties like name, description, tags, etc. I'm using Typescript, Mysql, and Typeorm in Back-end.
What is the best way to query items by their name, description, tags, etc., preferably with priorities in Typeorm? After a little bit of research, I found these possible answers:
MATCH(name, description, ...) AGAINST ('${keywords}' IN NATURAL LANGUAGE MODE)
and adding Fulltext
index to searchable columns like name
Like %keywords%
REGEX
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…