79611655

Date: 2025-05-08 02:56:26
Score: 3.5
Natty:
Report link

There is another way to do search using Full Text Search in MySQL which is the database I'm using. Although I need to do some testing to make sure I get what I want but seems like it might be possible to do search without breaking the string which is highly desirable as I want to use spring boot and jpa and query would be hardcoded. I found this video which shows how to use FTS on one table.

https://www.youtube.com/watch?v=WPMQdnwPJLc

using this I modified my query by indexing both tables like the video describes and made the following query. Need to test to make sure it returns what I want.

Note: watch video on how to create FTS index in MYSQL workbench queries don't work without indexes

Query using one table

select * from Product where

MATCH (productName, productDescription, about)

AGAINST ('Plain-woven Navy');

Query using multiple tables

select *
    from Product a
    inner join
    productItem b on (a.productId=b.productId)
    inner join
    ProductColor c on (b.productColorId=c.productColorId)
where 
MATCH (a.productName, a.productDescription, a.about)
AGAINST ('Plain-woven Navy')
and 
MATCH (c.colorName)
AGAINST ('Plain-woven Navy');
Reasons:
  • Blacklisted phrase (0.5): I need
  • Blacklisted phrase (1): youtube.com
  • Blacklisted phrase (1): this video
  • RegEx Blacklisted phrase (1): I want
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: user2043759