Answer the question
In order to leave comments, you need to log in
How to make the search on the site logical?
Good afternoon.
Can you tell me why the search might not work correctly?
An example on the site is the product Ridan HH No. 14.
When searching for Ridan nn 14 - everything is fine.
But when you enter Ridan 14 - writes that nothing was found.
Answer the question
In order to leave comments, you need to log in
Firstly, denormalize the database, create a search field where the name and description will be combined, and create an index on it.
Secondly, split the query by spaces and look for the final result as (conditionally)
select * from products as pd
where `searchname` like '%$words[0]%'
and `searchname` like '%$words[1]%'
and `searchname` like '%$words[2]%'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question