• Resolved Elliot Condon

    (@elliotcondon)


    Hey guys,

    Thanks for this great plugin. I’m currently using it on the resources page of the Advanced Custom Fields website.

    My problem is that a lot of my documentation has a title of ‘the_field’ or ‘get_field’ (contains an underscore).

    When someone searches for ‘the_field’, the resource article called ‘the_field’ is not being found. I have a feeling that the search is treating the ‘_’ as a like wildcard.

    Is there a way to disable the LIKE wildcard nature?

    The outcome is to have the article ‘the_field’ appear in the results.

    P.S. All other searches work great. Eg: ‘repeater’, ‘sort’

    Cheers
    Elliot

    http://wordpress.org/extend/plugins/relevanssi/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Elliot Condon

    (@elliotcondon)

    Hey guys,

    After some good old debugging, I found my issue!

    Relevanssi is treating ‘_’ as ‘ ‘ causing ‘the_field’ to become ‘the field’ and subsequently an array of terms (‘the’, ‘field’).

    My hack is to edit the lib/common.php file and comment out line 428:

    //$a = preg_replace('/:punct:+/u', ' ', $a);

    I wonder if it’s possible to set all these params as an array which is sent through a filter allowing devs like me to remove them?

    Cheers
    Elliot

    Plugin Author Mikko Saari

    (@msaari)

    Do not edit lib/common.php, but instead note that the punctuation removal function is called through a filter hook, so you can easily replace it with a new, edited version, without needing to modify Relevanssi core files.

    So yeah, I’ve already thought about this =)

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Underscore in title is not working in search’ is closed to new replies.