• We are using Ajax Search Lite with Advanced Custom Fields and set ASL to search in specific custom post type fields. The search results for autocomplete suggestions find some custom posts, but fail to find all posts that should match. ASL behaves as if it does not search postmeta custom fields at all and only searches in the regular post data.

    After researching existing posts, I already tried to deactivate and reactivate the plugin. Nothing changed. I also tried activating the setting Search all custom fields but that yields too many unrelated results. Our custom posts are generated by an import script. We don’t use external Google functionality.

    The error occurs consistently on two instances, but it does not occur in a third instance that I have set up on localhost.

    These are our ASL settings (without nonces and visual frontend preferences):

    wp option get asl_options
    array (
    'theme' => 'underline',
    'override_search_form' => '1',
    'override_woo_search_form' => 0,
    'keyword_logic' => 'and',
    'mob_auto_focus_menu_selector' => '#menu-toggle',
    'trigger_on_facet_change' => '1',
    'click_action' => 'results_page',
    'return_action' => 'results_page',
    'click_action_location' => 'same',
    'return_action_location' => 'same',
    'custom_redirect_url' => '?s={phrase}',
    'results_per_page' => '9',
    'triggerontype' => '1',
    'trigger_update_href' => '0',
    'customtypes' => '_decode_WyJjb3Vyc2UiLCJwYWdlIiwicG9zdCJd',
    'searchintitle' => '1',
    'searchincontent' => '1',
    'searchinexcerpt' => '1',
    'search_in_permalinks' => '0',
    'post_password_protected' => '1',
    'search_in_ids' => '0',
    'search_all_cf' => '0',
    'customfields' => 'title|subtitle|description|content|keywords',
    'post_status' => 'publish',
    'override_default_results' => '1',
    'override_method' => 'get',
    'res_live_search' => '0',
    'res_live_selector' => '#main',
    'res_live_trigger_type' => '1',
    'res_live_trigger_facet' => '1',
    'res_live_trigger_click' => '0',
    'res_live_trigger_return' => '0',
    'exactonly' => '0',
    'exact_match_location' => 'anywhere',
    'searchinterms' => '0',
    'charcount' => '0',
    'maxresults' => '10',
    'itemscount' => '4',
    ...
    'autocomplete' => '0',
    'kw_suggestions' => '0',
    'kw_length' => '60',
    'kw_count' => '10',
    'kw_google_lang' => 'de',
    'shortcode_op' => 'remove',
    'striptagsexclude' => '',
    'runshortcode' => 1,
    'stripshortcode' => 0,
    'pageswithcategories' => 0,
    'primary_titlefield' => '0',
    'primary_titlefield_cf' => '',
    'primary_descriptionfield' => '0',
    'primary_descriptionfield_cf' => '',
    'secondary_titlefield' => -1,
    'secondary_titlefield_cf' => '',
    'secondary_descriptionfield' => -1,
    'secondary_descriptionfield_cf' => '',
    'advtitlefield' => '{titlefield}',
    'advdescriptionfield' => '{descriptionfield}',
    'woo_exclude_outofstock' => '0',
    'exclude_woo_hidden' => '1',
    'exclude_woo_catalog' => '0',
    'excludecategories' => '',
    'excludeposts' => '',
    'wpml_compatibility' => '1',
    'polylang_compatibility' => '1',
    'kw_exceptions' => 'JavaScript, Java, PHP ',
    'kw_exceptions_e' => '',
    ...
    'classname-excludecategories' => 'wpdreamsCategories',
    'sett_tabid' => '1',
    'selected-customfields' =>
    array (
    0 => 'title',
    1 => 'subtitle',
    2 => 'description',
    3 => 'content',
    4 => 'keywords',
    ),
    'selected-showcustomtypes' =>
    array (
    0 =>
    array (
    0 => 'post',
    1 => 'Search in posts',
    ),
    1 =>
    array (
    0 => 'page',
    1 => 'Search in pages',
    ),
    ),
    'selected-exsearchincategories' =>
    array (
    ),
    'selected-excludecategories' =>
    array (
    ),
    'asl_cf_search_nonce' => 'REMOVED_SECRET_DATA',
    'asl_sett_nonce' => 'REMOVED_SECRET_DATA',
    'wdcfs_15' => '',
    'selected-customtypes' =>
    array (
    0 => 'course',
    1 => 'page',
    2 => 'post',
    ),
    )

    How to make sure ASL searches in the custom postmeta fields and lists all relevant posts?
    Or is there a filter hook to override / replace ASL search logic with our own WP query?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author wpdreams

    (@wpdreams)

    Hi,

    Thank you very much for the details! From the configuration I see a few custom fields are selected:

    title,subtitle,description,content,keywords

    I suspect that is correct, so I guess that is not the issue.

    One possible problem might be the maximum number of results set, which is 10 by default. Make sure to increase that here: https://i.imgur.com/HeF4dSO.png

    Let me know if that changes anything.

    All the best,
    Ernest

    Thread Starter Ingo Steinke (openmindculture)

    (@openmindculture)

    Thanks Ernest, that solved our problem!

    For everyone who wants to change the setting programmatically, we can also use the WP CLI, e.g.

    wp option patch update asl_options maxresults '20'
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.