Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Index table problem
- This topic has 42 replies, 2 voices, and was last updated 10 years, 6 months ago by
Shaun.
-
AuthorPosts
-
October 1, 2015 at 9:06 am #6069
Shaun
ParticipantHello,
I have just purchased the ajax search pro plugin and am having trouble with the index table.
I have followed the configuration instructions as in the provided PDF, created the index table and picked the “Index table engine” in the search engine field. After doing this i still have no results in the fronted search field.Giving the size of my shop, the “Regular engine” will not cut it.
One more question, is it possible to show the text “In stock” for products that have bigger than 0 in their stock. Im think it might be possible with “Advanced fields”? If so with variable must i use?
Thanks very much,
Shaun Mossop-
This topic was modified 10 years, 8 months ago by
Shaun.
October 1, 2015 at 9:34 am #6070Ernest Marcinko
KeymasterHi!
Can you please provide temporary back-end and FTP details to take a look at your configuration and debug through the search code?
If the configuration is correct, it might be a yet unknown issue.
To safely provide FTP and back-end access edit your first post in this thread, or upload a .txt file with the details. Both methods are safe and visible only to me an you.For the in-stock status I can only think of a custom code solution. I’ve quickly put together a small code snippet for you, that might work. Try putting this code somewhere into your themes functions.php file in your theme directory:
[php]
add_filter( ‘asp_pagepost_results’, ‘asp_stock_status_titles’, 1, 1 );function asp_stock_status_titles( $pageposts ) {
foreach ($pageposts as $k=>$v) {// Get the stock status
$stock_status = get_post_meta( $v->id, ‘_stock_status’, true);if ( $stock_status == "" ) continue;
// Add stock status string
if ( $stock_status == "instock" )
$pageposts[$k]->title .= " – In Stock";
else
$pageposts[$k]->title .= " – Out of Stock";}
return $pageposts;
}
[/php]October 1, 2015 at 9:42 am #6072Shaun
ParticipantWow thanks for the quick response. I must say, your support service is very good.
I have edited my first post for the access. On my site I have indexed just the posts so the index table is not to big.
-
This reply was modified 10 years, 8 months ago by
Shaun.
October 1, 2015 at 12:18 pm #6075Ernest Marcinko
KeymasterHi!
I managed to find the cause of the problem, it wasn’t easy 🙂
The queries work perfectly fast, even though there are over 1 million keywords, luckily this was not an issue. There were 3 problems:
1. On the search settings page the product custom post type was not selected, because woocommerce was disabled. After enabling the I was able to add the product custom post type, but there was still no response.
I enabled the debug mode in your wp-config.php file and temporary increased the memory limit to 1GB to see what error message is shown.
There was still no error, but after a step-by step debugging I found the cause, which is the second issue:2. The search tried to get the authors of the post, but most likely because of the database size, the wordpress internal function “get_users()” failed. It took over 60 seconds to get 10 users by IDs. I’m not sure if this is some kind of bug within wordpress Core, but it looks like it.
Anyways, to solve the problem, I simply disabled this part of the code, so the author is no longer shown in the results list.3. A minor issue was that the index table was build 25 post at a time (as default option) and at some point it failed. But since your server is extremely powerful, I increased this number 2000, so it build the index without issues in 2 minutes.
Now the search works without problems. Make sure you test ever single page before production, because the “get_users()” function is used widely by plugin developers – so it’s a potential source of failure in other plugins as well.
Plus one more suggestion: I recommend not using the frontend search settings at all with a database size like yours. The category filtering especially. It requires a table join operation, which is fine on smaller databases, but on yours it may cause performance spikes.
Let me know if you need any more help.
October 1, 2015 at 12:42 pm #6077Shaun
ParticipantThank you very much. Its looks like its working great.
Great plugins, great support. I will recommend it!
October 2, 2015 at 8:45 am #6089Shaun
ParticipantHi again,
Concerning the stock question i had earlier, I tried your function out with no success. I would like to debug it but can’t seem to get run it. I’ve tried doing a echo and var_dump from inside the function but get no results.
I’ve looked in the plugins function.php, hook.php and functions/general.php for the hook “asp_pagepost_results” but just can’t find it.
Any idea where i can find it?
Thanks,
ShaunOctober 2, 2015 at 9:02 am #6090Shaun
ParticipantNevermind, got it to work 🙂
October 2, 2015 at 12:50 pm #6092Shaun
ParticipantHi there,
I have a little problem with ajax search pro and the WPML Multilingual CMS plugin. There seems to be a conflict between the two.
Versions:
– Ajax search pro: 4.5.3
– WPML Multilingual CMS: 3.2.7Connection info is still the same.
Thanks,
ShaunOctober 2, 2015 at 1:05 pm #6093Ernest Marcinko
KeymasterHi!
Fortunately nothing big. The index table was generated before WPML was active, so the language was not set. I re-generated the index table to register the language as well, it should work now.
October 2, 2015 at 1:08 pm #6094Shaun
Participantoh great, thanks alot
October 2, 2015 at 1:17 pm #6095Shaun
ParticipantHmm its doesn’t look like it worked. I reactivated wpml et the search doesn’t find anything.
October 2, 2015 at 1:37 pm #6096Ernest Marcinko
KeymasterInteresting.
I did some debugging, and WPML reports that the language is not set for the products? (missing ID error or something like that)
Anyways, I changed the index table to register the default site language if there was no language returned. I will note this as a bug, but I will have to ask WPML devs why the WPML plugin is returning an error when asking for the language for items with unregistered language information.
The tables contain the proper information, it should work now.
October 2, 2015 at 1:39 pm #6097Shaun
ParticipantGreat, thank again
October 2, 2015 at 3:56 pm #6098Shaun
ParticipantOne more thing. I in general options -> behaviour, we have a “Redirect to url?” option. I would like to change the url to ?s={phrase}&post_type=product, but it does not accept the &. Is there a work around this?
October 2, 2015 at 4:06 pm #6099Ernest Marcinko
KeymasterYep. It’s a known bug with the current version, which I’m updating soon.
I’ll fixed it manually for you, the upcoming update will of course contain all the bugfixes I applied on your installation regarding the index table, so you dont’ have to worry about that.
It should be working now.
-
This topic was modified 10 years, 8 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.