• Resolved russclem

    (@russclem)


    I have 17,000 posts on my website of custom post type ‘postcode’, and each one is titled a different postcode, for example ‘DT1 1TW’.

    But when people search for ‘DT11TW’, they get no returned results.

    Is there a way to solve this?

    • This topic was modified 4 years, 1 month ago by russclem.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Mikko Saari

    (@msaari)

    Yes. You need to index the titles both ways, with and without the space. Add this to your theme functions.php and rebuild the index:

    add_filter( 'relevanssi_post_title_before_tokenize', 'rlv_titles_without_spaces' );
    function rlv_titles_without_spaces( $title ) {
        return $title . ' ' . str_replace( ' ', '', $title );
    }
    Thread Starter russclem

    (@russclem)

    Thanks for this, but I added it to functions.php, rebuilt the index, and I’m still having the same problem?

    Thread Starter russclem

    (@russclem)

    Actually, does Relevanssi work with the AJAX Jetsearch from Crocoblock?

    Plugin Author Mikko Saari

    (@msaari)

    Can’t tell since it’s a premium plugin, but likely not unless they explicitly mention it.

    You can test the Relevanssi admin search (Dashboard > Admin search) to see if Relevanssi is working as expected.

    Thread Starter russclem

    (@russclem)

    This works great, thanks very much.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Returning matches when the search term has no spaces?’ is closed to new replies.