WordPress.org

Forums

[Plugin: Dave's WordPress Live Search] search results ordered by relevancy (29 posts)

  1. gcacar
    Member
    Posted 4 years ago #

    Hi everyone,
    Is there way to integrate Dave's WordPress Live Search Plugin to other search plugins (Better Search, Relevanssi etc.), or just hack it to display results ordered by relevancy?

  2. Mikko Saari
    Member
    Posted 4 years ago #

    Dave has added some Relevanssi compatibility to Live Search in version 1.10:

    Possible fix for compatibility with Relevanssi plugin (some concern this isn't working yet)

    Give it a go and see if it works.

  3. gcacar
    Member
    Posted 4 years ago #

    Thanks msaari,
    I already had Relevanssi installed but unfortunately live search results seem to be unaffected by this or any other search plugin I've tried.

    Dave's plugin calls WP_Query::query method; is Relevanssi expected to change the output of this method?

    Imho, integrating Relevanssi's search quality with the ease and speed of live search will take the wp search one step further.

  4. Dave Ross
    Member
    Posted 4 years ago #

    I never knew for sure if Relevanssi was working right and didn't want to spend the time to find out. The important issue at the time was that WordPress blew up when both plugins were activated and someone did a search, and once that was fixed, I left it.

    Here's the WordPress query process, along with notes on what hooks are called: http://codex.wordpress.org/Query_Overview

    Any plugin that implements the posts_where, posts_join, posts_groupby, posts_orderby, posts_distinct, posts_fields, post_limits, posts_where_paged, posts_join_paged, or posts_request filters should be able to alter the results shown in Dave's WordPress Live Search. That's the way I was hoping these search enhancing plugins would do it.

    Relevanssi is using the the_posts filter to throw out the lists of posts WordPress selects and substitute its own. This should be getting invoked at the bottom of WP_Query::get_posts(), which is called from WP_Query::query().

    I might get a chance to dig into this over the weekend, but you might want to check with the author of Relevanssi too and see if they have any idea why their code might not be getting called.

  5. Mikko Saari
    Member
    Posted 4 years ago #

    I think — and I am the author of Relevanssi — at least part of the problem lies in the fact that Relevanssi uses is_search() to choose whether to fetch search results or not (it's the only way to know if there's a search going or not, and a fairly unreliable at that, but I haven't come up with anything better). The live search won't trigger that one.

    With some changes to both Dave's Live Search and Relevanssi I managed to get Relevanssi active in the live search, with highlighting and all, but: it'll only show the best hit, and nothing else.

    To get the plugins work together would require lots of work on Relevanssi, as the current query function is based on using $wp and $wp_query global variables and won't work with custom WP_Query objects.

  6. Mike
    Member
    Posted 4 years ago #

    @msaari, not to hijack the thread, but could you get Relevanssi to work with Search Light, or would the same issue prevent that?

    http://wordpress.org/extend/plugins/search-light/

  7. Dave Ross
    Member
    Posted 4 years ago #

    @msaari - I kind of just came to the same conclusion. I got it working by shoving a reference to my WP_Query object into the global $wp_query (which is how it used to work before I added WP E-Commerce functionality). I'm actually getting multiple results with highlighting and everything now, but I could see issues cropping up with how closely your plugin interacts with WP_Query. I just can't guarantee they'll always work nicely together.

  8. Mikko Saari
    Member
    Posted 4 years ago #

    Search Light doesn't use WP_Query, but instead modifies the MySQL query directly. Relevanssi won't work with Search Light.

    I'll have to see what I can do to make Relevanssi more flexible. I do have some ideas.

  9. Mikko Saari
    Member
    Posted 4 years ago #

    I've got this now. Once I get a new version of Relevanssi out and Dave fixes Live Search, we've got something that should work just fine.

  10. Mike
    Member
    Posted 4 years ago #

    Great! When can we expect that?

    thanks,
    Mike

  11. Mikko Saari
    Member
    Posted 4 years ago #

    The new 2.5 version of Relevanssi supports it, so as soon as Dave releases a new version of Live Search, it'll work.

  12. Mike
    Member
    Posted 4 years ago #

    Awesome, can't wait. Dave?

    thanks,
    Mike

  13. Dave Ross
    Member
    Posted 4 years ago #

    The development version at http://downloads.wordpress.org/plugin/daves-wordpress-live-search.zip has the new Relevanssi code. Give it a try and let me know how it works for you. Seems ok on csixty4.com but I want confirmation from someone else.

  14. Mike
    Member
    Posted 4 years ago #

    Seems to work like a charm for me! Thanks, you guys rock!

  15. paulwillen
    Member
    Posted 4 years ago #

    Sadly it doesn't seem to work for me.

    When activating Both plugins I don't get to see any LIVE-search results.
    When activating ONLY Daves' plugin I get to see the live-search results and when activating ONLY Relevanssi I get to see better search results.

    I get to see the ajax-loading circle in the search-box. Just no results are shown.

    It doesn't seem to matter which theme I use twentyten & thematic framwork both don't show any results.

    Any thoughts how to solve this or what I can do to solve it?

  16. Mikko Saari
    Member
    Posted 4 years ago #

    Actually, it doesn't work for me either. It worked for me when I first tested the system with the modified previous version, and it looks pretty the same to me now, so I don't know what's going on.

  17. gcacar
    Member
    Posted 4 years ago #

    Unfortunately, it doesn't work for me too...

  18. Mike
    Member
    Posted 4 years ago #

    Hmmm. I have the Relevanssi / Live Search plugin combo installed on two WP blogs and they're both working fine. Weird

  19. Dave Ross
    Member
    Posted 4 years ago #

    I don't know what to tell you guys. It seems to be working on all of my blogs, and at least a couple other peoples'. Only advice I have is to make sure you're running the latest versions of Dave's WordPress Live Search and Relevanssi. My plugin relies on new functionality msaari added to support what I'm doing.

  20. art vandelay
    Member
    Posted 4 years ago #

    The problem is $maxResults in daves-wordpress-live-search-ajax.php. When it's set to 0 (all results) in the plugin's settings page, if($maxResults === 0) $maxResults = -1; sets it to -1, which then gets passed over to relevanssi and causes for ($i = $wpSearch_low; $i <= $wpSearch_high; $i++) to never loop, hence no results.

    So the easiest solution is to set $maxResults in the plugin's settings page to something other than 0.

  21. Dave Ross
    Member
    Posted 4 years ago #

    That is some AWESOME detective work. Thanks!

  22. Dave Ross
    Member
    Posted 4 years ago #

    I'll have to check msaari's code, but I can probably set it to PHP_INT_MAX and be safe. That's 9223372036854775807 on the computer I'm at right now. I think that's close enough to "unlimited" for our purposes.

  23. beezwings
    Member
    Posted 4 years ago #

    Thanks Art! That did if for me! Plus, who wants a drop-down list of anything beyond 1000?!

  24. johnny_n
    Member
    Posted 4 years ago #

    This is the solution... thanks!

    Couldn't get results to appear for two different blogs and couldn't figure it out...

  25. Mike
    Member
    Posted 4 years ago #

    The latest update to Dave's Live Search (2.1) make it no longer work with Relevanssi. IOW, the Dave's Live Search results no longer match the Relevanssi search results, and therefore are no longer sorted by relevance. I'm glad I kept a copy of an older version ... I'll revert back to that until it gets fixed.

  26. Mike
    Member
    Posted 4 years ago #

    Spoke too soon - the old version I have is really old (1.7) and doesn't work anymore. Is there anywhere I can download a working version before 2.1, or will this be fixed soon? (Dave, you out there?)

    thanks,
    Mike

  27. Dave Ross
    Member
    Posted 4 years ago #

    Try the latest dev version: http://downloads.wordpress.org/plugin/daves-wordpress-live-search.zip

    I had made a change to bring my use of WP_Query more in line with how it's "supposed" to be done, but that ended up bypassing the special case for when Relevanssi is installed.

    However, this is the *LAST* time I'm making a change for Relevanssi. I'm trying to bring my plugin more in line with standard APIs and best practices. If this break compatibility with another plugin, then I'm sorry, but that other plugin is broken. I'm sick of hearing about it. Go away.

  28. Mikko Saari
    Member
    Posted 4 years ago #

    Here's a simple solution: drop Dave's Live Search and switch to ThreeWP Ajax Search. It works perfectly with Relevanssi.

  29. titush
    Member
    Posted 4 years ago #

    Hi Dave,
    I totally understand your frustration of having to adjust a plugin to someone else's the whole time..

    However, do you have any suggestions of having your plugin return more RELEVANT search results? We all know the search function in WP is really poor... I really like your plugin (nice and slick, fast!) and wouldn't want to move to anything else..

    Appreciate your thoughts (I imagine others too!).
    Keep up the great work!

    Titus

Topic Closed

This topic has been closed to new replies.

About this Topic