• Resolved coderchris

    (@jonandchris)


    Hello,
    I am trying to make sure the search results from this dropdown search are exact matches. For example, when you search for “mail.com”, it returns “Anythingemail.com”, “rocketmail.com”, etc. whereas I’d just like it to show the “Mail.com” entry.

    I have the Strict User Searching checkbox checked, but it isn’t making a difference. Is there something I can add to the shortcode, which currently looks like this?

    [pdb_list template=isp suppress=true search=true]

    Thank you!

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author xnau webdesign

    (@xnau)

    You’re correct, the “strict search” setting will only return matches to the conplete contents of the field. The partial matches you’re seeing indicate it’s not working like that.

    I’m not seeing this problem in my tests here, so what I suggest you do is turn plugin debugging on (this is under the advanced tab in the plugin settings) and then try a search that is giving unexpected results. In the debugging log will be the database query that was used.

    That will tell you why you’re getting the results. Post the query from the log (no need to post thw whole log!) here if you have questions about how it’s working.

    Thread Starter coderchris

    (@jonandchris)

    Thank you for your quick response! Ok here is the query in question:

    PDb_List::_setup_iteration list query: SELECT p.id, p.display_name, p.company, p.first_name, p.last_name, p.title, p.attn, p.address, p.city, p.state, p.zip, p.country, p.phone, p.ext, p.mobile, p.fax, p.email, p.www, p.referred, p.notes, p.last_updated FROM wp_participants_database p WHERE p.display_name LIKE “%Mail.com%” ORDER BY p.display_name ASC

    It looks like I need to change the “LIKE” to “=” to make it work correctly, but I’m not sure where to do that.

    Plugin Author xnau webdesign

    (@xnau)

    That’s what the “Strict User Searching” setting does…are you sure you have that setting checked? Do you have any custom code or plugin that modifies the search query?

    Plugin Author xnau webdesign

    (@xnau)

    Also, check to make sure the page is not cached.

    Thread Starter coderchris

    (@jonandchris)

    I was able to fix it. I had forgotten that when creating the template, I added this field:

    <input name=”operator” type=”hidden” class=”search-item” value=”LIKE” />

    ..which took the place of this:

    $output[] = ‘<input name=”operator” type=”hidden” class=”search-item” value=”‘ . ( Participants_Db::plugin_setting_is_true( ‘strict_search’ ) ? ‘=’ : ‘LIKE’ ) . ‘” />’;

    So I just changed the “LIKE” to “=”, and it works now. My bad. Your plugin works beautifully, thanks again!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Strict Search not working’ is closed to new replies.