Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Omit characters from search
- This topic has 5 replies, 2 voices, and was last updated 8 years, 3 months ago by
Ernest Marcinko.
-
AuthorPosts
-
February 16, 2018 at 10:29 am #16814
rickades
ParticipantHi WP-Dreams support,
Is there a way to omit characters in a search?
This should only be applicable for the search within a custom field, _sku to be specific.Best regards…Rick
February 16, 2018 at 11:02 am #16817Ernest Marcinko
KeymasterHi Rick,
It depends on what exactly are you looking for. If you want to simply remove certain characters/words from the search phrase, before the search query is executed, then these knowledge base tutorials may help you:
– Replace or remove characters from search phrase
– Replace search keywords (whole words)There are also two options on the back-end, that allow excluding words (or even single characters), but I don’t recommend those for other than alphanumeric values. In case you need to remove special characters, use the custom code in the examples above.
February 16, 2018 at 11:29 am #16818rickades
ParticipantHi Ernest,
Probably a mission impossible 😉
The difficult part is the sku’s come from different suppliers. Some use spaces or dashes between characters and others don’t. If a visitor leaves out a space or dash the product can’t be found. Same problem of course if a space or dash is used when there’s none in the sku.Plus the search is a combined one for posts/pages as well…
Best regards…Rick
February 16, 2018 at 11:50 am #16819Ernest Marcinko
KeymasterHi Rick,
Actually, I believe there might be a solution to this – using the index table engine.
It may not solve every case, but I designed the indexing process to recognize certain special characters – and words with dashes and dash-like characters are indexed both as a whole, as well as without the dashes, as well as words separated by space where the dashes were.
I highly recommend trying that, it may do the trick to some degree:
– 1. Generating the index table
– 2. Enabling the index tableI hope this helps 🙂
February 16, 2018 at 12:08 pm #16820rickades
ParticipantThanks for your quick reply. Should I generate the index for the sku’s only?
February 16, 2018 at 12:10 pm #16821Ernest Marcinko
KeymasterYou are welcome.
The index table is a replacement of the regular post type search query, so everything you need to search for should be selected there, not only the SKU-s. If you only searched for SKUs, then of course use the SKUs only.
-
AuthorPosts
- You must be logged in to reply to this topic.