latest d6.
Removed better select and it all worked again.
If user edited an item in that was in any other menu other then navigation it then was placed in navigation even if they did not have perms to edit a menu.
Also (see attached image) if you go to advanced search the search terms where a broken array.
Good luck,

CommentFileSizeAuthor
betterselecterror.png20.38 KByurtboy

Comments

Mark Theunissen’s picture

Title: Breaks menu and search system » Support for advanced search page

The first issue is a duplicate of #283768: Breaks menu system.

Secondly, the checkboxes will now not appear if the format of the options are invalid... see #362746: Check that #options are valid, else abort conversion to checkboxes.

We can enable support for the advanced search form by somehow supporting the method of having multiple vocabs in one multi-select box.Thoughts?

Mark Theunissen’s picture

Priority: Critical » Normal
broon’s picture

Status: Active » Needs work

IMHO it's not the vocabs that are breaking the advanced search but the conversion to checkboxes. Try searching for a term via the normal search box (best if you have a term which only yields a few results). You'll get the search results page where you could set advanced options. Instead just click the search button once more without changing anything. With better_select installed I'll suddenly get no results no more.

My explanation: w/o better_select the search operator "category:" only is fired when one or more tags (taxonomy terms) is selected. With better_select all options are converted to checkboxes which always return a value (even if unchecked a zero is returned). So, with 5 taxonomy terms in your vocab and none selected " category:0,0,0,0,0" is appended to search string.

In node.module, function node_search, the search query gets expanded if the operator is found:

      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');
      }

and the query will contain something like "tn.tid = 0". Since no term is selected this is the only condition for terms and since there is no term with id 0, no results will be returned (it actually works if at least one term is selected since the conditions are concatenated by OR). Altering node_search to

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

takes care of the problem and makes the advanced search working again.
But, if you have search_files installed this will still break the search in files/attachments because there no handling of keywords is given. A quick&dirty workaround would be to insert one line in search.modules function do_search to remove the serialized empty string of categories:

function do_search($keywords, $type, $join1 = '', $where1 = '1 = 1', $arguments1 = array(), $columns2 = 'i.relevance AS score', $join2 = '', $arguments2 = array(), $sort_parameters = 'ORDER BY score DESC') {
  $keywords = preg_replace('/category:(0,)+0/' , '', $keywords);
  $query = search_parse_query($keywords);

That way, I got advanced search working again for nodes, files (directories) and attachments. However, this is core module hacking and not safe for updates.

I don't know if this could be done by using some hooks or query altering mechanisms, I'm still looking for a better solution but I thought I'd still share my experience so far.

Best,
Paul