Wrong Search Results while typing

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Wrong Search Results while typing

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

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1230
    Xarf
    Xarf
    Participant

    Hi,

    I’ve tried to integrate the Search Plugin in our Site. The Sites uses Pods to generate Events, Events can be grouped in a “Eventgroup” these are 2 Custom Post Types. I tried to insert the Search and it failes to load the results sometimes. But when I check the option that the Magnifier links to Search Page that works fine I can search and get good results. Now I looked what the AJAX Request gets and there are 2 AJAX Requests First result is empty and second is: [{“title”:”Hallo Welt!”,”id”:”1″,”date”:”2014-02-20 21:21:53″,”content”:”Willkommen zur deutschen Version von WordPress. Dies ist der erste Beitrag. Du kannst ihn bearbeiten oder l\u00f6schen. Um Spam zu ver…”,”excerpt”:””,”author”:”admin”,”term_id”:”1″,”post_type”:”post”,”relevance”:”4″,”image”:null,”link”:”http:\/\/CENSORED_DUE_TO_NDA\/2014\/02\/20\/hallo-welt\/”},{“title”:”Beispiel-Seite”,”id”:”2″,”date”:”2014-02-20 21:21:53″,”content”:”Dies ist eine Beispiel-Seite. Sie unterscheidet sich von Beitr\u00e4gen, weil sie stets an der selben Stelle bleibt und (bei den meist…”,”excerpt”:””,”author”:”admin”,”term_id”:””,”post_type”:”page”,”relevance”:”4″,”image”:null,”link”:”http:\/\/CENSORED_DUE_TO_NDA\/beispiel-seite\/”}]

    These results are the two default entries from WordPress. If I click on the magnifier on the right I get a perfect result but no result while typing in Searchbar.

    Due to NDA I can’t provide a login to the Development Platform. I think something is weird with the ajax. Thanks for the help. I posted the Response Codes down below.

    <pre class=”lang:default decode:true ” title=”Response 1″ >Request URL:http://CENSORED_DUE_TO_NDA/wp-content/plugins/ajax-search-pro/ajax_search.php
    Request Method:POST
    Status Code:200 OK
    Request Headersview source
    Accept:*/*
    Accept-Encoding:gzip,deflate,sdch
    Accept-Language:de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
    Connection:keep-alive
    Content-Length:81
    Content-Type:application/x-www-form-urlencoded; charset=UTF-8
    Cookie:PHPSESSID=hdgjd7ug51o7sqa4i0jtp5j3l0; wordpress_test_cookie=WP+Cookie+check; bid_3_password_protected_auth=bid_3%7C1393687002%7C0425348e11ecaa48fd61a02ce7520cda; bp-activity-oldestpage=1
    Host: CENSORED_DUE_TO_NDA
    Origin:http://CENSORED_DUE_TO_NDA
    Referer:http://CENSORED_DUE_TO_NDA
    User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36
    X-Requested-With:XMLHttpRequest
    Form Dataview sourceview URL encoded
    action:ajaxsearchpro_autocomplete
    asid:1
    sauto:Hinter den Kulissen der Finanzwelt
    Response Headersview source
    Cache-Control:no-cache
    Connection:keep-alive
    Content-Encoding:gzip
    Content-Length:20
    Content-Type:text/html
    Date:Thu, 27 Feb 2014 16:00:41 GMT
    Expires:Thu, 19 Nov 1981 08:52:00 GMT
    Pragma:no-cache
    Server:nginx
    Vary:Accept-Encoding
    X-Content-Type-Options:nosniff
    X-Powered-By:PleskLin

    <pre class=”lang:default decode:true ” title=”Response 2″ >Request URL:http://CENSORED_DUE_TO_NDA/wp-content/plugins/ajax-search-pro/ajax_search.php
    Request Method:POST
    Status Code:200 OK
    Request Headersview source
    Accept:application/json, text/javascript, */*; q=0.01
    Accept-Encoding:gzip,deflate,sdch
    Accept-Language:de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
    Connection:keep-alive
    Content-Length:496
    Content-Type:application/x-www-form-urlencoded; charset=UTF-8
    Cookie:PHPSESSID=hdgjd7ug51o7sqa4i0jtp5j3l0; wordpress_test_cookie=WP+Cookie+check; bid_3_password_protected_auth=bid_3%7C1393687002%7C0425348e11ecaa48fd61a02ce7520cda; bp-activity-oldestpage=1
    Host:wz.kunesto.org
    Origin:http://CENSORED_DUE_TO_NDA
    Referer:http://CENSORED_DUE_TO_NDA/veranstaltung/hinter-den-kulissen-der-finanzwelt/
    User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36
    X-Requested-With:XMLHttpRequest
    Form Dataview sourceview URL encoded
    action:ajaxsearchpro_search
    aspp:Hinter den Kulissen der Finanzwelt
    asid:1
    options:set_intitle=None&set_incontent=None&set_inexcerpt=None&set_inposts=None&set_inpages=None&set_inbpgroups=None&set_inbpusers=None&customset%5B%5D=themenreihe&customset%5B%5D=veranstaltung&customset%5B%5D=themenreihe&customset%5B%5D=veranstaltung&categoryset%5B%5D=7&categoryset%5B%5D=1&categoryset%5B%5D=6&categoryset%5B%5D=5
    Response Headersview source
    Cache-Control:no-cache
    Connection:keep-alive
    Content-Encoding:gzip
    Content-Length:387
    Content-Type:text/html
    Date:Thu, 27 Feb 2014 16:00:42 GMT
    Expires:Thu, 19 Nov 1981 08:52:00 GMT
    Pragma:no-cache
    Server:nginx
    Vary:Accept-Encoding
    X-Content-Type-Options:nosniff
    X-Powered-By:PleskLin

    #1232
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    From the responses it appears to me, that the search is only searching the standard posts right now (for some reason). Are you sure, that you have configured it correctly? Please check the “Search in custom post types” option on the general options tab, and that you have corretly selected which post types do you want to search.

    From the ajax call’s post head

    set_intitle=None&amp;set_incontent=None&amp;set_inexcerpt=None&amp;
    set_inposts=None&amp;set_inpages=None&amp;set_inbpgroups=None&amp;
    set_inbpusers=None&amp;customset%5B%5D=themenreihe&amp;
    customset%5B%5D=veranstaltung&amp;customset%5B%5D=themenreihe&amp;
    customset%5B%5D=veranstaltung&amp;categoryset%5B%5D=7&amp;
    categoryset%5B%5D=1&amp;categoryset%5B%5D=6&amp;categoryset%5B%5D=5

    I’m guessing you have seelected the “verastaltung” and the “themenreihe” post type?
    If so, then could you please check the status of these posts? (are they published, drafts, thrashed or anything else)

    All I can think of is that the status of the post types is maybe different from “published”, thus the SQL query is ignoring them from the results. I’m not sure πŸ™‚

    Let me know!

    Best,
    Ernest Marcinko

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


    #1234
    Xarf
    Xarf
    Participant

    I’ve added a Screenshot to show you the options from the Search Generals Tab. I’ve looked into the Custom Posts and they are all visible.

    Attachments:
    You must be logged in to view attached files.
    #1236
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Okay, thank you, it looks ok.
    Can you attach the SQL export file of the posts table (or a few records containing these posts of these post types)? I think there is something differently stored in the database and the search is missing them πŸ™‚

    Best,
    Ernest Marcinko

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


    #1239
    Xarf
    Xarf
    Participant

    It bothers me to say that but the NDA denies that >.< Maybe its a problem how Pods (pods.io) Stores the Custom Post Types? Or is there a Debug Option where I can see the SQL Query then I can check it and find the error maybe. πŸ™‚

    #1241
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    No problem. The query is built dinamically respecting the options you choose on the backend. The file you are looking for is the plugins/ajax-search-pro/includes/search_content.class.php. The significant lines are 186-230. You will see a part of a huge query there.

    What I think you should try first is to eleminate the non-published posts from not being searched. I still think the problem is related to that. So, try to edit the line 220:

    ($wpdb->posts.post_status='publish' $searchin) AND

    to

    ($wpdb->posts.post_status='publish' OR 1) AND

    Save the file, refresh your browser on the frontend and do a search. I’m almost sure, that you will see results from the custom post type πŸ™‚

    Best,
    Ernest Marcinko

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


    #1244
    Xarf
    Xarf
    Participant

    tried it. Same response. But I found your debug code *hehe* I found out that it searched in wp_post so my bad was I had to say it is a multiside. So I changed the multisite Options and dragged the blog to the right side and now it seems to work.

    If I have multiple Networking Sites the Search only needs to search the currently used blog. In the Multisite Options is a Notice: If you not choose any site, then the currently active blog will be used! Also, you can use the same search on multiple blogs!

    If this is true then why it choosed wp_post instead of wp_3_post (in my case)

    #1245
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Well that’s a good question. Strange thing, it works differently on my multisite test server. Perhaps I should change that section (force it to use the correct site somehow) in the upcoming version. I’m glad you figured this one out, I was running out of options πŸ™‚

    Best,
    Ernest Marcinko

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


    #1246
    Xarf
    Xarf
    Participant

    πŸ™‚ so I need to create a Searchform for every Networking Site? Because the Search shouldn’t search networkwide only in the blog and if the auto select don’t work this would be the solution I think?

    #1247
    Xarf
    Xarf
    Participant

    *edit* my bad Whole Words Highlight Option was checked

    • This reply was modified 8 years, 5 months ago by Xarf Xarf.
Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.