The advanced search form loads all the taxonomy terms. All of them. I was wondering why my site with 10,000+ terms was taking so long to do searches. Turns out, the search isn't slow, just loading and moving 10,000 <option> tags.

A finer variation of this would remove the taxonomy element from the advanced search, but that seemed too complicated. This just removes the advanced search, configurable from the admin/settings/search page.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rbrooks00’s picture

I had a slightly different take on this and filed it here: http://drupal.org/node/42466 perhaps allowing administrators to decide which taxonomy terms to use would be the better way to go? Some of them might not even be relevant for searching.

robertDouglass’s picture

rbrooks00: they're really separate issues, and if desired, could both be implemented. My patch adds one checkbox to the settings and turns the whole thing off.

Ian Ward’s picture

I agree turning off advanced search should be in core, as well as excluding node types and vocabularies. I made a patch which will exclude node types and vocabularies. Do these have any chance at getting into 4.7? Pretty late in the game now, but they're usability, esp. if a huge vocab slows your search down, or for Robert's patch, if having an advanced search just is not appropriate for your site.

Ian

Ian Ward’s picture

Sorry, here's the link to my patch http://drupal.org/node/42466 , which I should express does something different from Robert's patch, but I think both patches are very useful.

ac’s picture

This patch is a great idea but i think node.module has changed to account for the forms api. The code from line 733 is not there anymore, rather it is around line 2100 in the new forms api format. I don't have the skills necessary to modify it to work but i'm sure someone can :)
Alex

chx’s picture

Status: Needs review » Closed (won't fix)

I think non-free tagging vocabularies with 10K terms are rare enough to say that this should go to a contrib module. (I checked code, free tagging vocabs are skipped).

ac’s picture

Thats not the only reason to turn off advanced search chx. Some people would prefer not to have it. I think it is a good patch

ac’s picture

Status: Closed (won't fix) » Needs work

Id like to see this in. all that needs to be changed is the node.module patch to fall inline with form api

DriesK’s picture

+1 for having the possibility to turn advanced search off. Last weekend, I did about the same as Robert on a site I'm working on. In my case, the reason was not the complexity of the site's taxonomy, but simply the internet skills/experience of the target group of the site. After some quick usability testing, it turned out that the advanced search box was confusing that particular group of users, so it was suggested to remove it.

So, after reading the other comments in this thread, I think there are several possible reasons why a site admin would want to turn advanced search off.

I think it may even be better to create a separate permission for this (allow advanced search) instead of one single on/off switch, to be able to restrict advanced search to certain roles.

DriesK’s picture

FileSize
1.19 KB

Here is my version, based on latest cvs. Only problem with this patch is that in Robert's case, advanced search will always be available for user 1.

robertDouglass’s picture

+1 for a permission based approach.... very Drupal like. I'll have to wait until tomorrow to test this. Thanks Dries.

chx’s picture

Status: Needs work » Reviewed & tested by the community

DriesK, you need to live up to a very famous name here -- and this patch proves that you do. Nicely done.

ac’s picture

horray

killes@www.drop.org’s picture

Version: 4.7.0-beta4 » x.y.z

I don't think we should commit this for 4.7. It introduces a new permission which by default defaults to off. But I leave the decision to Steven.

DriesK’s picture

I thought about that as well. But on the other hand, the 'search content' permission itself is also off by default. So when someone enables the search module and goes to set that permission, he/she will see the 'use advanced search' permission right below. I don't think it's a major drawback.

robertDouglass’s picture

I would argue for putting this into 4.7 for the following reason: advanced search is a new feature as of 4.7 and the way it is now, it introduces usability problems. It isn't a finished feature without this patch because the very presence of the feature can be problematic in several circumstances, as noted in the discussion above.

Furthermore, people upgrading from 4.6 to 4.7 will see their search behavior change dramatically and won't have any control over it. This will be fine in the majority of cases, but in DriesK's case, this would have made target users very unhappy.

Finally, if we agree that this is a good feature and that it should go into Drupal core, we save ourselves some work doing it now rather than later. If we do it later, then we have to also provide the upgrade path to not break people's 4.7 sites when they upgrade to the next version.

drumm’s picture

This is a nice solution, for permissioning advanced search. But that seems like a strange solution for taxonomy terms taking too long to populate. Since development is opened up for CVS and we have a nice autocomplete form, maybe that can be put to use instead.

Dries’s picture

Title: Give admin ability to turn off advanced search » Advanced search form doesn't scale with mega vocabularies.
Status: Reviewed & tested by the community » Needs work

I committed this patch. Dealing with "mega vocabularies" is a separate issues. I updated the title to reflect this.

kmillecam’s picture

+1 for adding the ability to limit which vocabularies show up in the advanced search box.

We use a certain vocabulary to categorize content for internal purposes. We would rather not expose this vocabulary to the public.

Kevin

somes’s picture

Finally got around to having a look at this one yesterday

Couldnt get the patch working directly with 4.7 (couldnt patch the file that is something about failing hunks) so ended up resorting back to the cvs files defined in the patch file .... works fine

now when u try and import these file into the current release candidate I'm getting a

user warning: Unknown column 'n.sid' in 'where clause' query: SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.moderate, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM node n INNER JOIN users u ON u.uid = n.uid INNER JOIN node_revisions r ON r.vid = n.vid WHERE n.type = 'node' AND n.sid = '23' AND n.score = '9.99971454137434' in /home/martin/public_html/site/moor47/includes/database.mysql.inc on line 120.

looks like im going to have to sit down and add each line by hand to trace the problem

any ideas
M

robertDouglass’s picture

Dries committed this patch. That would explain why it doesn't apply. I think the separate issue of dealing with mega-vocabularies in general is why it was left open, but I vote we close this issue. Will wait a bit for comments before proceeding.

rbrooks00’s picture

If the patch has been committed why don't we close this issue and then open a new issue or forum topic to discuss things that haven't been resolved yet.

robertDouglass’s picture

Status: Needs work » Fixed

agree

Anonymous’s picture

Status: Fixed » Closed (fixed)