I am trying to figure out how to use the recently added image modules for version 4.5, but when I search on "adding images" from the main Drupal.org search box, the results are not sorted.

Most of these results are from 2003, which is not useful to me as Drupal has changed. The default sort order should simply be by Date, Descending.

-rich

Comments

heather’s picture

you ain't said 'snackbar' there, mister.

i think the issues with the search are well-known at this point, but i'm sure another vote for modifications is always good.

*in the meantime* google is your friend:

do a search for
site:drupal.org "your phrase in quotes"

comme ca:

http://www.google.ie/search?hl=en&q=site%3Adrupal.org+%22adding+images%22

Zach Harkey’s picture

It's now 2005 and some of us could still really use this feature. I would really like the ability to filter out some of the 2003 posts. Sure, google is great, but I feel this is something that should be built into a forum. Is it because this is difficult functionality to add, or that only a few people care about sorting search results by date?

: z

jozef’s picture

I would like to have results ordered by date too; plus filter, e.g. I only want to search in Sub-Forum "How do I". Can drupal.org use trip_search module?

dman’s picture

Gawd, a search that worked at all in that forum would be good alright.
So much of it is the same stuff, but the subject lines (as is usual with newbies) are totally un-specific.
There must be something good in there, but it needs weeding badly.

How can such a righ database with such an emphasis on organisation have such problems just searching?

Yeah Google it is. You can even narrow it down to subdirectories :-)
Google: <a href="http://www.google.com/search?q=site%3Adrupal%2Eorg%2Fforum%2F22+taxonomy">site:drupal.org/forum/22 taxonomy</a>

jozef’s picture

Many thanks for google tutorial. Are there any other useful advanced search tips?

dman’s picture

Um ... yeh.

heaps in fact

But my tip is just get the Google toolbar and configure it to show the "search this site" button ALWAYS.

.dan.

Rhino’s picture

Still, wouldn't it be nice if a vibrant community with a great CMS had a decent search engine, sorting by date is standard in most other CMS searches. Look at PHPNuke and Postnuke for examples. Drupal needs this.

esmailzadeh’s picture

(in drupal 5)
in file node.module placed in node module folder at line 925 you must change this code :
/modules/node/node.module line 925:

<?php
      // Do search
      $find = do_search($keys, 'node', 'INNER JOIN {node} n ON n.nid = i.sid '. $join1 .' INNER JOIN {users} u ON n.uid = u.uid', $conditions1 . (empty($where1) ? '' : ' AND '. $where1), $arguments1, $select2, $join2, $arguments2);
?>

to this code:

<?php
    // Do search
   $find = do_search($keys, 'node', 'INNER JOIN {node} n ON n.nid = i.sid '. $join1 .' INNER JOIN {users} u ON n.uid = u.uid', $conditions1 . (empty($where1) ? '' : ' AND '. $where1), $arguments1, $select2, $join2, $arguments2,'ORDER BY n.created DESC, score DESC');
?>
Rhino’s picture

Nice hack, thank you.

So I take it that the core search in Drupal 6 is the same as it ever was? (This hack works in Drupal 6 as well, the search line is just further down, I've tested it.)

As If’s picture

I had to more than that to get this *truly* working under Drupal 6. Of course it's always wrong to hack core - buildings are burning and people are dying - unless you have a client who insists on it ;-)

This is from function node_search() in node.module version 6.10...

1. COMMENT OUT TERM HITS - I didn't need them so I commented out the following IF statement...

      /*
      if ($category = search_query_extract($keys, 'category')) {
        $categories = array();
        foreach (explode(',', $category) as $c) {
          $categories[] = "tn.tid = %d";
          $arguments1[] = $c;
        }
        $conditions1 .= ' AND ('. implode(' OR ', $categories) .')';
        $join1 .= ' INNER JOIN {term_node} tn ON n.vid = tn.vid';
        $keys = search_query_insert($keys, 'category');
      }
      */

2. CHANGE RANKING TO CREATED DATE ONLY - Changed this line:
$ranking[] = '%d * POW(2, (GREATEST(MAX(n.created), MAX(n.changed), MAX(c.last_comment_timestamp)) - %d) * 6.43e-8)';

To this:
$ranking[] = '%d * POW(2, MAX(n.created) - %d) * 6.43e-8';

3. COMMENT OUT JOIN ON node_comment_statistics - I didn't care about that either...

      if ($weight = (int)variable_get('node_rank_recent', 5)) {
        // Exponential decay with half-life of 6 months, starting at last indexed node
        $ranking[] = '%d * POW(2, MAX(n.created) - %d) * 6.43e-8';
        $arguments2[] = $weight;
        $arguments2[] = (int)variable_get('node_cron_last', 0);
        // $join2 .= ' LEFT JOIN {node_comment_statistics} c ON c.nid = i.sid'; <- THIS LINE
        $stats_join = TRUE;
        $total += $weight;
      }

4. DROP ALL OTHER WEIGHT FACTORS - Commented out this entire chunk...

      /* 
	  if ($weight = (int)variable_get('node_rank_relevance', 5)) {
        // Average relevance values hover around 0.15
        $ranking[] = '%d * i.relevance';
        $arguments2[] = $weight;
        $total += $weight;
      }
      if (module_exists('comment') && $weight = (int)variable_get('node_rank_comments', 5)) {
        // Inverse law that maps the highest reply count on the site to 1 and 0 to 0.
        $scale = variable_get('node_cron_comments_scale', 0.0);
        $ranking[] = '%d * (2.0 - 2.0 / (1.0 + MAX(c.comment_count) * %f))';
        $arguments2[] = $weight;
        $arguments2[] = $scale;
        if (!$stats_join) {
          $join2 .= ' LEFT JOIN {node_comment_statistics} c ON c.nid = i.sid';
        }
        $total += $weight;
      }
      if (module_exists('statistics') && variable_get('statistics_count_content_views', 0) &&
          $weight = (int)variable_get('node_rank_views', 5)) {
        // Inverse law that maps the highest view count on the site to 1 and 0 to 0.
        $scale = variable_get('node_cron_views_scale', 0.0);
        $ranking[] = '%d * (2.0 - 2.0 / (1.0 + MAX(nc.totalcount) * %f))';
        $arguments2[] = $weight;
        $arguments2[] = $scale;
        $join2 .= ' LEFT JOIN {node_counter} nc ON nc.nid = i.sid';
        $total += $weight;
      }
	  */

5. CHANGE DISPLAYED DATE TO node.created INSTEAD OF node.changed - Or else the dates may appear in a different order than your readers expect them. Change this...

        $results[] = array(
          'link' => url('node/'. $item->sid, array('absolute' => TRUE)),
          'type' => check_plain(node_get_types('name', $node)),
          'title' => $node->title,
          'user' => theme('username', $node),
          'date' => $node->changed,
          'node' => $node,
          'extra' => $extra,
          'score' => $item->score / $total,
          'snippet' => search_excerpt($keys, $node->body),
        );

To this... (note the 'date' item)...

        $results[] = array(
          'link' => url('node/'. $item->sid, array('absolute' => TRUE)),
          'type' => check_plain(node_get_types('name', $node)),
          'title' => $node->title,
          'user' => theme('username', $node),
          'date' => $node->created,
          'node' => $node,
          'extra' => $extra,
          'score' => $item->score / $total,
          'snippet' => search_excerpt($keys, $node->body),
        );

6. (OPTIONAL) REMOVE FALLBACK RELEVANCE - I decided not to, but you might want to. In this IF statement...

      if ($total == 0) {
        $select2 = 'i.relevance AS score';
        $total = 1;
      }
      else {
        $select2 = implode(' + ', $ranking) . ' AS score';
      }

Comment out EVERYTHING except this...

        $select2 = implode(' + ', $ranking) . ' AS score';

Now you're dancin' like a pirate!

LVX
TF

-------------------------------------------
Interactive Worlds and Immersive Obsessions
http://www.asifproductions.com

esmailzadeh’s picture

it hacks search module instead of node module and don't use any api for solve this problem.

As If’s picture

Of course it is a hack.

What were you saying about search.module?

-------------------------------------------
Interactive Worlds and Immersive Obsessions
http://www.asifproductions.com

esmailzadeh’s picture

sorry i have a mistake it is a hack for node module
but i still cant find what make this hack preferable from Previous hack? this hack is more difficult than ,Previous hack,

As If’s picture

The original hack is incomplete and may not provide the results you expect, due to other variables. The second set of hacks eliminates those variables.

-------------------------------------------
Interactive Worlds and Immersive Obsessions
http://www.asifproductions.com