Not signed in (Sign In)

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

    •  
      CommentAuthorsidtheduck
    • CommentTimeJun 12th 2008
     
    •  
      CommentAuthorsidtheduck
    • CommentTimeJun 12th 2008 edited
     
    It should work. Are you searching with plus (+) signs? (i.e. "sports+college"). It's working on my setup -> http://www.sidtheduck.com/plogtest/
    • CommentAuthorthebluebus
    • CommentTimeJun 13th 2008
     
    i can confirm the above solution does work. its working well on my site :)
    • CommentAuthorthebluebus
    • CommentTimeJun 13th 2008
     
    http://www.scenemeup.com/index.php?level=search&searchterms=mk1
    http://www.scenemeup.com/index.php?level=search&searchterms=mk1%2Bgreen

    works for me
    •  
      CommentAuthorsidtheduck
    • CommentTimeJun 13th 2008
     
    This is my entire function for function plogger_init_search() in the file 'plog-functions.php':function plogger_init_search($arr) {
    $terms = explode(" ",$arr['searchterms']);
    $from = 0;
    $limit = 20;

    if (isset($arr['from']) && $arr['from'] > 0) {
    $from = $arr['from'];
    }

    // enforce hard-coded max limit
    if (isset($arr['limit']) && $arr['limit'] > 0 && $arr['limit'] <= 100) {
    $limit = $arr['limit'];
    }

    $query = " FROM `".TABLE_PREFIX."pictures` p LEFT JOIN `".TABLE_PREFIX."comments` c
    ON p.`id` = c.`parent_id` ";

    if ((count($terms) != 1) || ($terms[0] != '')){
    $query .= " WHERE ( ";
    foreach ($terms as $term) {
    $term = mysql_real_escape_string($term);
    $multi_term = explode("+",$term);
    if (count($multi_term)>1) {
    $path = implode("%' AND `path` LIKE '%",$multi_term);
    $description = implode("%' AND `description` LIKE '%",$multi_term);
    $comment = implode("%' AND `comment` LIKE '%",$multi_term);
    $caption = implode("%' AND `caption` LIKE '%",$multi_term);
    } else {
    $path = $description = $comment = $caption = $term;
    }
    $query .= "
    `path` LIKE '%$path%' OR
    `description` LIKE '%$description%' OR
    `comment` LIKE '%$comment%' OR
    `caption` LIKE '%$caption%' OR ";
    }

    $query = substr($query, 0, strlen($query) - 3) .") ";
    } else {
    // no search terms? no results either
    $query .= " WHERE 1 = 0";
    }

    $sort_fields = array('date_submitted','id');
    $sortby = 'date_submitted';

    if (isset($arr['sortby']) && in_array($arr['sortby'],$sort_fields)) {
    $sortby = $arr['sortby'];
    }

    $sortdir = ' DESC';

    if (isset($arr['sortdir']) && 'asc' == $arr['sortdir']) {
    $sortdir = ' ASC';
    }

    $result = run_query("SELECT COUNT(DISTINCT p.`id`) AS cnt " . $query);
    $row = mysql_fetch_assoc($result);

    $GLOBALS["total_pictures"] = $row["cnt"];
    // and I need sort order here as well
    // from and limit too
    $result = run_query("SELECT `caption`,`path`,p.`id`,c.`comment`,
    UNIX_TIMESTAMP(`date_submitted`) AS `unix_date_submitted` ".$query .
    " GROUP BY p.`id` ORDER BY `$sortby` $sortdir LIMIT $from,$limit");

    $GLOBALS["available_pictures"] = mysql_num_rows($result);
    $GLOBALS["picture_counter"] = 0;
    $GLOBALS["picture_dbh"] = $result;
    }
    •  
      CommentAuthorsidtheduck
    • CommentTimeJun 13th 2008
     
    Also, I was just re-reading your first post. Are you looking to have a search page that displays all images with either "sports" OR "collage" in it? If so, you would search for sports collage in your search box. If you are looking for images with BOTH "sports" AND "collage" listed for a single picture, then you would search for sports+collage.

    For example:
    http://www.sidtheduck.com/plogtest/?level=search&searchterms=mike+ruin = all images that have "mike" OR "ruin" in them (the '+' in the URL is the $_GET encoding for a space on the PHP side, so if you enter a space " " in the search box, a '+' shows up in the URL)
    http://www.sidtheduck.com/plogtest/?level=search&searchterms=mike%2Bruin = all images that have "mike" AND "ruin" in them (the '%2B' is the $_GET / URL encoding for a plus sign (+), so if you enter a '+' in the search box, '%2B' shows up in the URL)