Omit characters from search

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Omit characters from search

This topic contains 5 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 5 years, 3 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #16814
    rickades
    rickades
    Participant

    Hi 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

    #16817
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi 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.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #16818
    rickades
    rickades
    Participant

    Hi 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

    #16819
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi 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 table

    I hope this helps 🙂

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #16820
    rickades
    rickades
    Participant

    Thanks for your quick reply. Should I generate the index for the sku’s only?

    #16821
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    You 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.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.