superspeedyplugins / issue-tracker

Submit bugs and feature requests for any of our plugins
0 stars 0 forks source link

SSS code to exclude from search is not coded properly #163

Open dhilditch opened 3 months ago

dhilditch commented 3 months ago

image

When you coded up the solution to fix the issue with items that are marked as 'shop only' appearing in search results and items marked as 'search results only' not appearing in search results, you added code like this:

AND (/* wp_superspeedysearch.product_hidden = 0
AND */wp_superspeedysearch.taxonomydescriptions NOT LIKE '%exclude-from-search%')

I do not like this approach at all. I would like you to go back and fix this as a matter of priority please.

  1. We should avoid wherever possible using LIKE '%...%' - it's slow and it's opposite to the idea of Super Speedy Search
  2. We should especially avoid using NOT LIKE as depending on how many other items have been filtered already, this could cause a table scan

So - please can you:

  1. Remove your taxonomydescriptions NOT LIKE '%exclude-from-search%' code
  2. Re-add the commented out code above for product_hidden = 0
  3. To implement the functionality, please update the 2 pieces of code which calculate product_hidden - it is at THIS point that any checks for exclude-from-search should be checked, i.e. you can set product_hidden to 1 if exclude-from-search is present, but AGAIN - please do not use NOT LIKE - you can use the taxonomy ID or something instead.
dhilditch commented 3 months ago

This is related to #145 which was the original bug report. Technically you fixed it, but I do not like the code or the placement of the logic. Please put the logic into the existing 'product_hidden' field, i.e. calculate at table build and table rebuild whether the product should be hidden from search or not.