Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
180 views
in Technique[技术] by (71.8m points)

sql - What is the best way to search items by their name, description, tags, etc., in TypeORM (MySQL)?

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:

  1. MATCH(name, description, ...) AGAINST ('${keywords}' IN NATURAL LANGUAGE MODE) and adding Fulltext index to searchable columns like name
  2. Like %keywords%
  3. REGEX

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...