Hi, I'm marking this as a bug report but I'm not sure if the behaviour I found is by design: I was playing with an experimental view exposing a Search: Index filter and I couldn't get an empty result set even if I entered text absolutely not existing in my test nodes (for example _unfindable_): any unfindable text led to a list of the whole set of test nodes.

I gave a look to modules/views_search.inc and found that inserting the following line in the code fixed the problem


--- views/modules/views_search.inc	Sat Mar 03 23:59:33 2007
+++ views/modules/views_search.inc	Wed Sep 12 19:03:26 2007
@@ -39,7 +39,8 @@
 
       // Calculate maximum relevance, to normalize it
       $normalize = db_result(db_query('SELECT MAX(relevance) FROM temp_search_sids'));
-      if (!$normalize) {
+      if (!$normalize) {
+      	$query->add_where("0");
         return;
       }
       $select2 = str_replace('i.relevance', '('. (1.0 / $normalize) .' * i.relevance)', $select2);

Could you give me a feedback?

CommentFileSizeAuthor
view_export.php_.txt2.57 KBplach

Comments

plach’s picture

Status: Needs review » Closed (works as designed)

cdo

Zoologico’s picture

I got around this using:

http://drupal.org/project/views_fastsearch

Instead of the default Search Index.