Vanilla 1.0.1 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorJesesHeap
    • CommentTimeJan 25th 2007
     
    After enabling UW 3 in wordpress 2.07 I noticed that my search post function through the admin interface is not operating properly. It now only returns results from the last month. If I disable the plugin, then search performs fine. Case in point, a search for bridal returns 0 results with the plugin enabled. If I go and disable the plugin and do the same search I get several months of results.

    ...Update - Also tried normal search through blog interface and it appears this bug affects that search as well. Presumably both searches use the same hook.

    Anyone have this issue? What is the filter hook used by UW for search? Presumably I can try disabling that filter hook to see if that fixes the issue.

    Great plugin by the way.

    Jesse
  1.  
    Hi to all,

    I have the same problem in wordpress 2.1. The results shows only post with tags.

    Christine wrote about a new function in 3.1415926: "And if you do a search, posts with tags that are like your search term will be included. This is probably the neatest addition (:"

    Any solution?

    Markus
    • CommentAuthorJesesHeap
    • CommentTimeJan 27th 2007
     
    Markus,

    I was able to get around the problem by commenting out the following in ultimate-tag-warrior-actions.php:

    <code>
    //add_filter('posts_join', array('UltimateTagWarriorActions','ultimate_search_join'));
    //add_filter('posts_where', array('UltimateTagWarriorActions','ultimate_search_where'));
    </code>

    This disables the ability to search for tags through the regular wordpress search, but will allow you to normally search through posts and pages.

    It appears the join that the ultimate_search_join creates is causing the search to bring back 0 rows:

    <code>select * from wp_posts left join wp_post2tag p2t on wp_posts.id = p2t.post_id = p2t.post_id inner join wp_tags on p2t.tag_id = wp_tags.tag_id ...snip</code>

    What's puzzling to me is the join appears fine when executed against wp_post2tag:

    <code>select * from wp_post2tag p2t inner join wp_tags on p2t.tag_id = wp_tags.tag_id</code>

    It returns:

    <code>

    +--------+--------+---------+------------+--------+------------------+
    | rel_id | tag_id | post_id | ip_address | tag_ID | tag |
    +--------+--------+---------+------------+--------+------------------+
    | 1 | 1 | 218 | | 1 | baby-shower-cake |
    | 2 | 1 | 216 | | 1 | baby-shower-cake |
    | 3 | 1 | 210 | | 1 | baby-shower-cake |
    | 4 | 1 | 209 | | 1 | baby-shower-cake |
    | 5 | 1 | 207 | | 1 | baby-shower-cake |
    +--------+--------+---------+------------+--------+------------------+
    </code>

    And similarly a join against wp_posts and wp_post2tag works fine:

    <code>select * from wp_posts left join wp_post2tag p2t on wp_posts.id = p2t.post_id = p2t.post_id ...</code>

    <b> I must be missing something here...maybe someone can help out</b> I can rewrite the inner join as a inline query and it does work, but since the original query appears fine, I'm not clear why it's not working.

    Original query rewritten as a inline query produces results:

    <code>select * from wp_posts left join (select p2t.* from wp_post2tag p2t, wp_tags where p2t.tag_id = wp_tags.tag_id) p2t on wp_posts.id = p2t.post_id ...</code>
    • CommentAuthorLoreen
    • CommentTimeJan 28th 2007
     
    It worked for me.
    Thanks :)
    • CommentAuthorJesesHeap
    • CommentTimeJan 28th 2007
     
    To the admin:

    I believe you need to change the join criteria for wp_tags and wp_post2tag:

    Line 883: $join .= " LEFT JOIN $tablepost2tag p2t on $wpdb->posts.ID = p2t.post_id LEFT JOIN $tabletags on p2t.tag_id = $tabletags.tag_id ";

    Otherwise the inner join is filtering out any posts that have no tags assigned. This fix appears to be working fine for me.

    Jesse
    • CommentAuthorJesesHeap
    • CommentTimeJan 28th 2007
     
    Also another note:

    It appears you aren't structuring the user search input in the same format you store it in the wp_tags table. In other words you need to cleanse the user search input in order to ensure a proper match against wp_tags:

    function ultimate_search_where($where)
    ...<snip>
    $searchInput = $wp_query->query_vars['s'];
    $searchInput = str_replace(' ', '-', $searchInput);
    $searchInput = str_replace('"', '', $searchInput);
    $searchInput = str_replace("'", '', $searchInput);
    $where .= " OR $tabletags.tag like '%" . $searchInput . "%'";


    This fix above structures the user input to ensure proper matches against tags. If you already have a cleanse tag function available, or if I'm missing any str_replaces let me know.

    Jesse
    • CommentAuthorfruityoaty
    • CommentTimeJan 31st 2007
     
    Hi, I've got the same problem too - after installing UTW 3.1415926 on both WordPress 2.07 and 2.1, the search function for both POSTS and PAGES are now broken - NO RESULTS ARE RETURNED at all.

    I tried to follow the above, but it didn't work for me. I'll look it over again - maybe I mistyped something.
    • CommentAuthorbyosko
    • CommentTimeFeb 1st 2007
     
    Jesse's fix commenting out those two lines worked for me. Now it's back to searching old posts.
  2.  
    This is a major problem that is affecting every user of the latest version. A fixed version needs to be released. JesesHeap seems to have identified a workable solution a month ago but a fix hasn't been released. What gives? Does UTW need to be open sourced to allow more developers to work the code?
  3.  
    Any idea how to fix this in 3.14159265?
    • CommentAuthorFarmGrrl
    • CommentTimeMar 28th 2007 edited
     
    I tried commenting out those lines and my search is still broken. The only things that are returned are tagged posts. Not many of my posts are tagged right now, so search is basically useless. To put it into perspective, I have 7 years of blog posts. It will take me a long time to tag them all.

    NEVERMIND. Rewriting the query to use LEFT JOIN instead of INNER JOIN worked, just as the poster said above. This is an easy easy fix but I think it requires a new release because most people are not comfortable with editing the code of plugins.
    • CommentAuthorKorak
    • CommentTimeApr 18th 2007
     
    I had the same thing. The search won't work on posts posted prior to the UTW activation.

    Commenting out those two lines worked for me too.
    • CommentAuthorcocoyu113
    • CommentTimeAug 6th 2009 edited
     
    lol