The MU forums have moved to WordPress.org

WPMU Search (28 posts)

  1. ColinFilmJournal
    Member
    Posted 17 years ago #

    Two new additions which together will allow a site-wide search of blogs, posts or comments:

    http://wpmudevorg.wordpress.com/project/Search
    http://wpmudevorg.wordpress.com/project/Latest-Posts

  2. ColinFilmJournal
    Member
    Posted 17 years ago #

    Actually - these both will require some work to use on your site. There are still hard-coded links in there and it is coded to work just for directories as opposed to sub-domains

  3. ColinFilmJournal
    Member
    Posted 17 years ago #

    I've removed the hard-coded links.

    Will still need work for sub-domains though, however I don't have an environment to test this.

  4. andrea_r
    Moderator
    Posted 17 years ago #

    I can test it for subdomains (if I remember mostly :( )

  5. ColinFilmJournal
    Member
    Posted 17 years ago #

    If you could that would be useful - I'm 99% sure it won't work at the moment as I haven't considered catering for them, but if it does I'll be pleasantly surprised.

  6. suleiman
    Member
    Posted 17 years ago #

    I can also test Colin, let me know. (suleiman[at]hadithuna.com)

  7. ColinFilmJournal
    Member
    Posted 17 years ago #

    Go for it - just grab the latestposts and search items from the links above.

    You'll need a version of MySQL supporting Union statements (5 does, not sure about 4) and you'll also need to be able to schedule CRON jobs for the moment. I'm working on a version that doesn't need CRON or Union statements but that won't be ready for a while.

  8. wpmnl01
    Member
    Posted 17 years ago #

    Hi ColinFilmJournal,
    Is a great idea, I will try it.
    Have you think in the posibility to use tags to make search?
    Thanks
    Manuel

  9. wpmnl01
    Member
    Posted 17 years ago #

    Hello, I have install it and I get this error
    I have WP mu on subdomains

    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/.krupp/nubesraras/exdigital.net/blogs/wp-search.php on line 43
    No search results found

  10. ColinFilmJournal
    Member
    Posted 17 years ago #

    Are you using http://wpmudevorg.wordpress.com/project/Latest-Posts ?

    The query that it's failing on is looking for the tables that are set up when you install the above and that is why it's a requirement for Latest Posts to be running on the server.

  11. wpmnl01
    Member
    Posted 17 years ago #

    Hi,
    You are right, I have not installed Latest_post.
    Them what I made was:
    1.-Import in myphpadmin the 'latestposts.sql'. I get an error but the tables are there...¡¡¡¡¡¡¡
    2.-Upload to the wp-seach.php to the my root directory
    3.-Upload 'latestpost.php' to the plugin directory
    4.-Upload the sample.html
    I can make a seach, but no result.
    I have MySQL - 5.0.24a with subdomains
    I must tell you that I'm not an expert
    I don't know what I make wrong
    Thanks for your help

  12. ColinFilmJournal
    Member
    Posted 17 years ago #

    Nearly there.

    You need to schedule latestposts.php to run at a fixed interval (I do it every 10 minutes). Read up on CRON jobs or if you're able to schedule tasks via an admin interface do that.

    You need to do this to copy all of the posts over to an easily searchable table - otherwise the search would have to do a big UNION statement every time it runs which is far too inefficient and would cause problems on busy servers.

    Colin

  13. ColinFilmJournal
    Member
    Posted 17 years ago #

    I'm releasing v0.0.3 now which includes everything needed in one package with a README file :)

  14. wpmnl01
    Member
    Posted 17 years ago #

    Thanks, But there is a lot of thing that I don't know what they are and how to use. I Have to learn about:
    1.- 'CRON access or the ability to schedule scripts to run at fixed intervals'
    2.-'Run the SQL statements in the latestposts.sql file'
    3.-'Schedule latestposts.php to run every 10 minutes'
    Anyway thank so much I hope tto tell you soon that it is working
    Thanks for you work

  15. suleiman
    Member
    Posted 17 years ago #

    This works very well except that it is only placing my posts into the latest_posts table but not putting any comments into the latest_comments table. Aside from that I love it!

  16. ColinFilmJournal
    Member
    Posted 17 years ago #

    The latest_comments problem is now fixed.

    This also now definitely works on subdomains so if you haven't tried it yet, please give it a go and let me know what you think.

  17. suleiman
    Member
    Posted 17 years ago #

    Would just like to voice my support for this truly excellent solution.

    Many people in this community were harping on why MU didn't come bundled with enough "community-building" features. This, the tags solutions by deltakid and dr.mike, are all part and parcel of that initiative.

  18. nekt
    Member
    Posted 17 years ago #

    I have the same error when trying to search:
    "Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in wp-search.php on line 43
    No search results found "
    I installed Search from wpmudev, but I dont have latestpost plugin because I can't find it in wpmudev now.. How to fix it?

  19. SteveAtty
    Member
    Posted 17 years ago #

    "Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in wp-search.php on line 43
    No search results found "

    Have you ensured that at least one of your blogs is flagged as public. If they aren't then the code throws an error.

    I've got it up and running on a site I'm putting together and its working well. I also took the search code and replaced the normal search in the widgets.php file.

    Its a great plugin and now I've worked out how to handle the fact that templates are inconsistent in the number of div tags and where they open and close them it means that I can use a "common" wp-search file and the page layout isn't messed up.

  20. SteveAtty
    Member
    Posted 16 years ago #

    I've also found another "bug" in that the latest posts table uses the GUID from the posts tables as the permalink... which is fine until someone changes the date stamp which means the permalink is no longer the same as the GUID and so the search results dont point back to the original post

  21. SteveAtty
    Member
    Posted 16 years ago #

    OK thats fixed.

    Add post_id to all the tables,
    Alter the latest posts script to insert the post_ids
    Change the search code so that $link is created using:
    $link = get_blog_permalink( $row[blog_id], $row[post_id] ) ;

    So now permalinks are created on the fly rather than using the GUID

  22. suleiman
    Member
    Posted 16 years ago #

    steve, you may want to get in touch with Colin about releasing an updated version (with your chanes) to wpmudev.org.

  23. SteveAtty
    Member
    Posted 16 years ago #

    I will do.

    I'm also wondering if rather than doing a delete and then inserting everything again its better to do a REPLACE on the 3 tables?

    Its hard to tell, with only a few posts and a couple of blogs, which is the most efficient.

  24. SteveAtty
    Member
    Posted 16 years ago #

    And here's antother enhancement which interegrates wp-search into the search engine part of FF2 (and as its OpenSearch it should work with IE7 too)

    Create a file called blogsearch.xml in your root directory - it should contain the following code:

    
    <?xml version="1.0" encoding="UTF-8"?>
    <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
                           xmlns:moz="http://www.mozilla.org/2006/browser/search/">
      <!-- Created on Sat, 28 Apr 2007 20:42:45 GMT -->
      <ShortName>Blog Search</ShortName>
      <Description>Links to the wp-search </Description>
      <Url type="text/html" method="get" template="http://your.url.here/wp-search.php?term={searchTerms}"/>
      <Developer>Steve Atty</Developer>
      <InputEncoding>UTF-8</InputEncoding>
      <moz:SearchForm>http://your.url.here/wp-search.php</moz:SearchForm>
    </OpenSearchDescription>
    

    Make any code changes you want - you can add other things like an icon and a check for updates frequency

    Then add the following to your footer:

    echo '<link rel="search" type="application/opensearchdescription+xml" title="Blogs Search" href="blogsearch.xml">';
  25. Bloggproffs
    Member
    Posted 16 years ago #

    reviving an old thread here, this plugin does exactly what i have been looking for some time now. (im using the latest version: 0.0.4 - http://wpmudevorg.wordpress.com/project/Search. Im also using latest wpmu version: 1.3)

    Altough my cron interface emails this back to me

    ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order by comment_date desc' at line 1

    this is row 77-90 in the code at hand(latestposts.php).

    <code>

    $sql = $sql." order by comment_date desc";

    if (!$comments = mysql_query($sql)) {
    echo "\n\nERROR: ".mysql_error();
    }

    while ($comment = mysql_fetch_array($comments)) {
    $sql = "insert into latest_comments values ($comment[comment_ID], $comment[comment_post_ID], $comment[blog_id], '$comment[comment_date]', '".str_replace("'", "\'", $comment[comment_content])."', '".str_replace("'", "\'",$comment[post_title])."', '$comment[guid]', '".str_replace("'", "\'",$comment[comment_author])."')";
    if (!mysql_query($sql)) {
    echo "\n$sql\nERROR: ".mysql_error();
    }
    }

    </code>

    please help me with this, im desperate for a solution

  26. ColinFilmJournal
    Member
    Posted 16 years ago #

    I'd nearly forgotten about this plugin :D

    I'm not running the latest version of WPMU and I'm dreading doing a full upgrade as it'll most likely break a lot of things.

    I'm guessing the problem is something introduced in later WPMU releases.

    Can you add:

    echo $sql;

    Before:

    if (!$comments = mysql_query($sql)) {

    Post the output SQL here and I'll take a look to offer a suggestion.

    Alternatively, I'm planning to set up my dev server to do a test upgrade at some point and then I might be able to replicate this problem myself...

    SteveAtty - if you could send me over a list of improvements you've made I'll incorporate them into the next version with a full credit to you. They sound like ideal solutions to a few problems.

  27. SteveAtty
    Member
    Posted 16 years ago #

    Colin

    I'll tidy the code up and bit and shove it on my site and then let you have the urls. I've actually enhanced it so if you are using danalog wpmu site wide tags you can search those as well.

  28. Bloggproffs
    Member
    Posted 16 years ago #

    Hmm i added the line to the file outside of site root (the one that is being crond) altough that file has no output in the site, nor gives any output in the cron message from cpanel.

    (Cron message is still same as above)

    best regards.

About this Topic

  • Started 17 years ago by ColinFilmJournal
  • Latest reply from Bloggproffs