Index table problem

This topic contains 42 replies, has 2 voices, and was last updated by Shaun Shaun 8 years, 5 months ago.

Viewing 15 posts - 1 through 15 (of 43 total)
  • Author
    Posts
  • #6069
    Shaun
    Shaun
    Participant

    Hello,

    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 8 years, 7 months ago by Shaun Shaun.
    #6070
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    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:

    
    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;
    }
    
    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #6072
    Shaun
    Shaun
    Participant

    Wow 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 8 years, 7 months ago by Shaun Shaun.
    #6075
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    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.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #6077
    Shaun
    Shaun
    Participant

    Thank you very much. Its looks like its working great.

    Great plugins, great support. I will recommend it!

    #6089
    Shaun
    Shaun
    Participant

    Hi 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,
    Shaun

    #6090
    Shaun
    Shaun
    Participant

    Nevermind, got it to work 🙂

    #6092
    Shaun
    Shaun
    Participant

    Hi 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.7

    Connection info is still the same.

    Thanks,
    Shaun

    #6093
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    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.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #6094
    Shaun
    Shaun
    Participant

    oh great, thanks alot

    #6095
    Shaun
    Shaun
    Participant

    Hmm its doesn’t look like it worked. I reactivated wpml et the search doesn’t find anything.

    #6096
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Interesting.

    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.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #6097
    Shaun
    Shaun
    Participant

    Great, thank again

    #6098
    Shaun
    Shaun
    Participant

    One 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?

    #6099
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Yep. 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.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


Viewing 15 posts - 1 through 15 (of 43 total)

You must be logged in to reply to this topic.