If we want to have a framework that allows for pluggable search solutions we need to have the content and user searches provided by core be optional features. Right now there is no way to turn them off. For D5 there is the core searches module: http://drupal.org/project/coresearches which achieves this with a core patch (two new modules, contentsearch and usersearch are provided). A similar solution should be available in D7.

CommentFileSizeAuthor
#10 searchsettings.png5.38 KBjhodgdon
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

floretan’s picture

This is a great idea. I think that the search module's lack of configuration flexibility is one of the reason so few people use its search interface (in favor of contrib modules like views_fast_search).

robertDouglass’s picture

catch’s picture

Architecturally it makes sense to have this in separate modules - within the search folder two new ones? Would remove a lot of hard coded stuff from node module which can only be a good thing.

Damien Tournoud’s picture

Well actually they are already separated. There is nearly nothing "hardcoded" about the node module into the search module, except from the management of links between nodes, which is a completely different story.

The search interface for nodes is provided by the node module (via node_form_alter()), which the search logic is provided by node_search().

What you want is to separate the search logic from the user interface. That's look doable with the correct hook_form_alter(), hook_validate() and hook_submit() logic.

robertDouglass’s picture

@Damien: Actually, I want more than what you describe. I want to have the search module enabled and have no trace of Drupal's core content search in my installation. Since node is a required module it is impossible to have search module enabled and *not* have node search. Putting all of node module's search functionality in its own module solves this nicely, as can be seen with the coresearches module for D5.

catch’s picture

I think it's the hardcoding of search module into node module that's the issue rather than the other way 'round. node.module handles queries for search tables etc. Not directly related, but there's module_exists() for comment and statistics in node_search() for ranking as well. Any step to make all this a bit more loosely coupled is very welcome IMO.

David Lesieur’s picture

I'm wondering what the best approach would be here... Should we port Robert's coresearches module to D7, and then rip the equivalent functionality from the core modules when the community is ready for it? Or should we provide a huge patch that does all this at once? I'm afraid that a big patch won't be immediately accepted and will be a bit hard to maintain.

robertDouglass’s picture

+1 for porting core searches now.

catch’s picture

Title: Can't turn search/node and search/user off » Decouple core search module implementations from node and user module
Version: 7.x-dev » 8.x-dev
Category: bug » task
Priority: Normal » Critical

Bumping, also this should really be a critical task for Drupal 8.

jhodgdon’s picture

Version: 8.x-dev » 7.x-dev
Status: Active » Fixed
FileSize
5.38 KB

This has already been done for Drupal 7 actually. Here's a screen shot from the search settings page (note that I have a contrib search module installed as well).

catch’s picture

Version: 7.x-dev » 8.x-dev
Status: Fixed » Active

It's not quite done yet. We still have code in node module which relates directly to searching in SQL etc.

jhodgdon’s picture

That seems like a separate issue? The issue here is that search module does not allow you to turn off node/user, and that has been fixed.

catch’s picture

You can turn it off in the UI, but you still have the code slugging around in your install, same as #5, so it's not properly decoupled yet. We need some issue for doing this, can we leave this open until one of us finds the duplicate?

jhodgdon’s picture

Category: task » feature

Ah, I see what you are saying.

jhodgdon’s picture

Priority: Critical » Normal
Jody Lynn’s picture

#1019966: Rename hook_ranking (with BC layer) is related to this and kind of illustrates the problem as I see it.

Required module node is implementing hook_search_admin and then needs to invoke its own hook, hook_ranking. So then node module is defining this hook_ranking that has to do with search. This is the kind of thing that belongs in search module.

jhodgdon’s picture

The idea we're really thinking about for Drupal 8 is a modular approach, where the search module itself would be more of a framework, and other modules would be providers of preprocessing, items to index, indexing, retrieval, and UI. This is being discussed now:
http://groups.drupal.org/node/117274
Comments welcome!

klonos’s picture

Title: Decouple core search module implementations from node and user module » Decouple core search module implementations from node and user module (and turn search/node and search/user to views).

...coming from #233476: Add search by node creation date and the author

I think we should postpone this on #2083717: Convert Search Results to Views (or close it as a duplicate or even make the other issue a META and this one one of its sub-issues).

jhodgdon’s picture

Status: Active » Closed (works as designed)

Actually, the intent of this issue, as it is described in the summary, was satisfied a long time ago in Drupal 7 (and is still applicable in Drupal 8). You can turn on/off the different search modules(7) or plugins (8) to your heart's content, so just because you turn on the search module doesn't mean you have to have either node or user searches active.

jhodgdon’s picture

And as a note, the code for search in node/user is now off in a plugin class, so you don't have to incur the burden of loading it unless you have those modules turned on. I really do think the intent of this issue has been satisfied. Yes? The only other thing we could do is to split off node_search and user_search into separate modules, but I don't think it would buy us much in terms of efficiency.