Forum Replies Created
-
AuthorPosts
-
November 26, 2014 at 6:12 pm in reply to: No Results Being Returned For Custom Field Only Search #3044
Ernest Marcinko
KeymasterHi!
I see now. So the keywords are stored in the search_terms custom field as “keyword 1, keyword 2, keyword x” – thus comma+space separated.
I made a few modifications on the source code that should respect this rule, so only the whole keyword matches should be returned.
I think it should work now as you described.I’m attaching the changed lines here for future reference to myself. file search_content.class.php line 167 custom_field search related:
[php]
// NOTES: whole word, comma-space-WORD-comma, BOL-word-comma, comma-space-word-EOL
$parts[] = "($wpdb->postmeta.meta_key=’$cfield’ AND
(
lower($wpdb->postmeta.meta_value) LIKE ‘".$s."’
OR lower($wpdb->postmeta.meta_value) LIKE ‘%, ".$s.",%’
OR lower($wpdb->postmeta.meta_value) LIKE ‘".$s.",%’
OR lower($wpdb->postmeta.meta_value) LIKE ‘, ".$s."’
)
)";
[/php]Ernest Marcinko
KeymasterHi!
I think you are using an outdated version of the plugin. I believe the term title bug was fixed back in version 3.1. You can download version 3.2 from codecanyon. Please carefully follow the steps from the documentation when upgrading.
As for the taxonomies, there is indeed a limitation for 50 terms per taxonomy. (someone had like hundreds of thousands of them and the browser could not handle it)
You can disable it by disabling lines 109-110 in the ajax-search-pro/backend/settings/class/customtaxonomyterm.class.php.
[php]
if (is_array($terms[$taxonomy]))
$terms[$taxonomy] = array_slice($terms[$taxonomy], 0, 50, true);
[/php]Ernest Marcinko
KeymasterHi!
Ajax search pro offers numerous action and filter hooks. These hooks can be used to achieve such tasks. These actions/filters can be found in the actions.txt and filters.txt file. The asp_result_title_after_prostproc filter is what will possibly help.
Based on this knowledgebase article, I will try to implement some kind of solution: https://wp-dreams.com/knowledge-base/showing-the-post-type-name-in-post-title/
Try to paste this code to your themes functions.php file:
[php]
add_filter( "asp_result_title_after_prostproc", "asp_show_the_blog_title", 1, 1 );function asp_show_the_blog_title( $title ) {
$current_site = get_current_site();return $current_site->site_name . " – " . $title;
}
[/php]I have never tried this, but I think it will work.
Ernest Marcinko
KeymasterHi!
Sorry about the delay. I got no notification for some reason.
Could you please provide a bit more information:
- A link to a page where the search is visible
- The exact phrases on which this problem occurs
- Phrases on which the problems does not occur
- Expected results
Temporary admin/ftp access would also speed up my work in case I need to change the configuration or fix something regarding the plugin.
Ernest Marcinko
KeymasterHi!
I did a few adjustments regarding the relevance and disabled the “search in excerpt” option.
Since the “writing” keyword is very common on your site, it gave lots of results to the plugin. With these adjustments the results should be a bit more focused on the title without loosing relevant results.
The next search version (which is being uploaded tomorrow) will have a bit different approach exactly for these situations. You can check codecanyon in a few days for version 3.3 which will probably give you more relevant results.
Ernest Marcinko
KeymasterHi!
Those span elements are not part of the plugin.
I checked through the dev tools, and the following script is putting those elements after every single checkbox on the site: https://64.34.205.58/~apmpbok/wp-content/plugins/userpress/wiki/js/foundation.min.js?ver=1.2.3.7Since that code is minified I can’t tell exactly how and what to change. You should definitely notify the developer about this, because this can lead to other issues with other plugins using checkboxes. Randomly replacing items on the entire site with javascript is not a good idea. The event listeners attached to the checkbox parent elements can change this way.
Anyways I can suggest 2 possible solutions, that might work (I’m not 100% sure)
1. Custom CSS – might not work
Put this custom css code to any of your stylesheets or into the Custom css field on the search plugin Theme Options -> Custom CSS panel:
[html]
span.checked + label:after {
opacity: 1;
}
[/html]2. Javascript solution – probably work
Put this custom javascript inbetween script tags anywhere (prefer header or footer) on your site:
[html]
jQuery(document).ready(function () {
jQuery(".innericon, #ajaxsearchprosettings1_1 input[type=checkbox]").click(function(){$("#ajaxsearchprosettings1_1 span.custom").detach()});
});
[/html]November 24, 2014 at 5:32 pm in reply to: No Results Being Returned For Custom Field Only Search #3028Ernest Marcinko
KeymasterIt’s possible (on the “Cache settings” submenu), but on multisite setups that setting is ignored for various reasons. In your case I needed to make an exception and disable it programatically, because of the unexpected timthumb output.
November 24, 2014 at 5:08 pm in reply to: No Results Being Returned For Custom Field Only Search #3025Ernest Marcinko
KeymasterNo problem at all.
The tiny change is in wp-content/plugins/ajax-search-pro/includes/search_content.class.php on line 346. The old code was:
[php]
if ($use_timthumb == 0) {
[/php]and I replaced it with the bypass:
[php]
if (1) {
[/php]This will be overwritten by updates, however all you need to do is change this one line. The line number will probably change, but if you search for “if ($use_timthumb == 0) {“ in the file, you will find it, it only occures once.
If you can’t change it or something goes wrong, you can reply to this thread and I will do it for you.
November 24, 2014 at 4:41 pm in reply to: No Results Being Returned For Custom Field Only Search #3023Ernest Marcinko
KeymasterHi!
Thanks for the information. Somehow the image handling library reported that the image does not exists, while it was there, so I inserted a bypass code to use the internal image handler, now it should work fine 😉
Ernest Marcinko
KeymasterHi!
I’ve found the problem. By default the search tries to execute the shortcodes found in the content and run the though the “the_content” filter. That command was stuck for some reason. I’m guessing that a plugin or maybe the theme has another filter attached to the “the_content” hook and that made an infinite loop.
The solution was rather simple. I turned off the “Run shortcodes found in post content” and enabled the “Strip shortcodes from post content” option instead on the advanced options panel: http://i.imgur.com/r2Zrn8g.png
The search should work now on full speed 😉
Thank you for the proper details, it made my work much faster.
Ernest Marcinko
KeymasterOf course.
I will only output things to the search ajax response, which won’t be visible on the site layout.
If I can’t make any progress, I will ask for a dev site access 😉
Thank you for the details.
Ernest Marcinko
KeymasterHi!
I just examinded the search with multiple configurations, and indeed something is slowing it down. Interestingly, if I type in something that will surely not match anything, then I get results in under 0.2 seconds. It probably means, that the database query is all right, and it’s fast as well. But once the phrase matches something, it slows down. Based on this I concluded that something in the results post processing function delays this.
Could you please upgrade your ticket with temporary ftp details? I would like to run a line-to-line manual debugging to find out where the error comes from exactly.
November 22, 2014 at 4:18 pm in reply to: No Results Being Returned For Custom Field Only Search #3012Ernest Marcinko
KeymasterHi!
I ran throuhg some tests on the site. There were no results because the “Search in pages” option was disabled, thus there was nothing for the plugin to return.
I enabled this option, now it returns exactly the page you linked for the “grid flooring” search term.
Ernest Marcinko
KeymasterDo you still get results or not at all?
What you exactly described is not possible. Unfortunately there is no way to determine which keyword belongs to which custom field. One of the custom fields hold the ‘practice, the other one the ‘city’. So one of the words must had to match one field, and the other one the other field, and each word must have at least one match. It sounds easy enough, however the current architecture of the plugin and the wordpress database makes it impossible.
I’m currently writing the documentation to the next version, which is ready to get deployed. This version includes creation of fields related to custom fields: http://i.imgur.com/PYoWDZJ.png
As you can see on the screenshot, you will be able to create radio boxes, dropdowns, checkboxes, range sliders that are connected to custom field values. In your case you will be able to make a dropdown field that contains the cities or practices (or 2 dropdowns with both).
Ernest Marcinko
KeymasterHi!
I understand. This functionality was intentionally left out because of performance issues. Custom fields can make a huge difference. However if you want, you can still make it work.
I’ve made a code change, so it might work:
1. Open up the wp-content/plugins/ajax-search-pro/includes/search_content.class.php file
2. Make a backup of it’s content.
3. Replace it’s content with this: http://pastebin.com/raw.php?i=iQTh8jKc
4. Save it and try it.I’m not sure if ti will work, but it’s worth a try.
-
AuthorPosts