WordPress.org

Ready to get started?Download WordPress

Forums

A better search? (17 posts)

  1. Brak
    Member
    Posted 9 years ago #

    I tried searching on these forums, but I can't seem to find one. Is there a plugin/hack of sorts that returns some kind of useful search function? No offense, but unless you know the title of a blog post, WP's search function is pretty useless.

  2. Mark (podz)
    Support Maven
    Posted 9 years ago #

  3. Brak
    Member
    Posted 9 years ago #

    Hmm, thanks for pointing it out - that's what I remembered seeing a while ago. Unfortunately, this doesn't do much to solve the problems I was encountering. Seems like this hack just adds FULLTEXT search capabilities. I think I'll go ahead and write my own little function to encorperate the stuff that I want in it :) If I get somewhere with it, I might just release it as a plugin.
    If anyone's wondering what I'm looking for, I wrote down a few notes last night:

    • Support for "+" (must have) and "-" (must not have)
    • Search title, content, excerpt, or comments (or any combination thereof)
    • Search within a date
    • Search for at least one word in phrase
    • Search exact phrase
    • Search for combinations of exact phrase and any words

    Mostly, the basic functionality of google searches. And of course, relevancy scoring (going to have to think about this one for a while).

  4. Mumble
    Member
    Posted 9 years ago #

    @Brak, not sure if you'll see this, but I'm currently looking for a search function that does what you're describing (esp. AND searches), and I was just wondering if you're still thinking of working on this. Or anyone else, for that matter.

  5. bobob21
    Member
    Posted 9 years ago #

    Same here. I am badly in need of a more sophisticated search engine. It should also be able to combine keywords (AND / + operator). It would also be nice if it could search the Category titles as well.

    If someone knows some code/plug-in that could achieve this, could you send me a note to bobob21 at zonnet.nl?

    Thanks

  6. Michael Heilemann
    Member
    Posted 9 years ago #

    WordPress is so in need of a new search function, it's not even funny...

  7. ColdForged
    Member
    Posted 9 years ago #

    Thanks, Michael, let us know when it's ready :D.

  8. Michael Heilemann
    Member
    Posted 9 years ago #

    Hey, I do design. Trust me when I say you don't want me to write core code for WP :)

  9. Lorelle
    Member
    Posted 9 years ago #

    Related to this subject, I'm finding that searches on my site put the "best" results at the bottom of the search returns rather than at the top. This is strange. Has anyone experienced this same backwards results?

  10. ColdForged
    Member
    Posted 9 years ago #

    I don't believe they're sorted by relevance, Lorelle. MySQL ain't that good that I know of.

  11. Lorelle
    Member
    Posted 9 years ago #

    Well, at least my searcher is consistent. The unrelated documents are consistently at the top and the most relevant documents are at the bottom of the results page. Consistently reversed. <sigh>

  12. Jinsan
    Member
    Posted 9 years ago #

    livesearch integrated? or perhaps something more robust? Would be good to see more thorough, detailed, and specific searches being included, so this plugin might just do the job (if it is released as a plugin)

  13. DarkCryst
    Member
    Posted 9 years ago #

    the problem is with how WP constructs the search query... it's bloody awful. It's basically a glorified substring search.

    If I search for "rdp" I'll get everything I posted where I mention WordPress because it contains that string (WordPress)

    I'm working on another search for my new theme, but it's one of those back burner issues...

  14. Denis de Bernardy
    Member
    Posted 9 years ago #

    http://www.semiologic.com/projects/search-reloaded/

    * Support for "+" (must have) and "-" (must not have) => not yet, but planned
    * Search title, content, excerpt, or comments (or any combination thereof) => title and content; and excerpt in upcoming version (tomorrow)
    * Search within a date => that would be a filter post functionality, rather than a search post functionality
    * Search for at least one word in phrase => by default
    * Search exact phrase => exact word and exact phrase
    * Search for combinations of exact phrase and any words => yep, that too

    Cheers,
    D.

  15. DarkCryst
    Member
    Posted 9 years ago #

    A simple fix to improve it slightly is to simply add a leading space to the SQL "LIKE" statement in wp/includes/classes.php around like 357:

    <code style="white-space: pre;">
    if (!$q['sentence']) {
    $s_array = explode(' ',$q['s']);
    $q['search_terms'] = $s_array;
    $search .= '((post_title LIKE ''.$n." ".$s_array[0].$n.'') OR (post_content LIKE ''.$n." ".$s_array[0].$n.''))';
    for ( $i = 1; $i < count($s_array); $i = $i + 1) {
    $search .= ' AND ((post_title LIKE ''.$n." ".$s_array[$i].$n.'') OR (post_content LIKE ''.$n." ".$s_array[$i].$n.''))';
    }
    $search .= ' OR (post_title LIKE ''.$n." ".$q['s'].$n.'') OR (post_content LIKE ''.$n." ".$q['s'].$n.'')';
    $search .= ')';
    } else {
    $search = ' AND ((post_title LIKE ''.$n." ".$q['s'].$n.'') OR (post_content LIKE ''.$n." ".$q['s'].$n.''))';
    }

    It's not exactly perfect, but it certainly makes the results more like what you would expect.

  16. DarkCryst
    Member
    Posted 9 years ago #

    Denis - that's a great addition!

  17. apoorv
    Member
    Posted 9 years ago #

    If your blog's on public domain, why not use Google or Atomz or some other such search engine?
    How about using Lucene. It can index database but this will require some work before it can be integrated to WP.

    /a
    http://apoorv.info

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.