Add language filter to search form
Andrew Answer - March 23, 2008 - 07:39
| Project: | Internationalization |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Description
Blog, search and node records doesn't filtered with language switcher. It avoids duplicate entries on pages. I made patch for blog and node modules, but search still have duplicates.
| Attachment | Size |
|---|---|
| blog.module.patch | 427 bytes |
| blog.pages_.inc_.patch | 487 bytes |
| node.module.patch | 506 bytes |

#1
Thanks, this is most welcome, strange that not many else has reflected this huge problem,
#2
These patches work. However, by applying them I'm sure some other feature request like 'Seach in all languages' will pop up, which btw makes a lot of sense, as searches are text based thus search terms have some language by themselves.
So about the search form, I think we should try to add a language field to the search form that defaults to current language and that would be it.
Feedback/suggestions welcomed, and patches more welcomed yet :-)
#3
Added new version patch for blogs. Now 1) blogs with urls like blog\1 filtered too 2) RSS feeds language-specific too.
#4
Thanks a lot for the node patch! I applied it and it seems to work fine.
I wonder how a bug like that (duplicate stories on the front page!) was allowed to pass through testing of drupal version 6.
#5
Drupal 6.2 is out, so this is a new patches for core modules.
#6
Are these patches working with D6.3 and is it now a part of the beta release of this module ?
#7
i have this patch installed in 6.3 and seems ok so far
in fact i just grabbed my patched files from 6.2 and overwrote the 6.3 original files - probably not recommended but seems to work ok.
I only did that cos i hate the drupal's patching method, which is not exactly simple.
#8
Yes, but what can you do when the Drupal core development team doesn't solve things that is important fast enough even with contributions from the community, a lot of patches are waiting to get added and never does.
#9
Yes, this should be done as a new 'language' search operand, but this is very difficult to do.
The issue is that it's not enough to add checkboxes to the search form and then read them in and turn that into hook_db_rewrite_sql() clauses. Full core search support requires that all search criteria be treated as operands that can be contained in the url of the search. So in this case we would need e.g. "language:en,fr" in the search string.
See #69595: Node search operands should be extsnsible and moved out of node.module for some of the problems involved in trying to add custom search operands to Drupal's core search. If we want to keep operand support, the approaches open to us are (in the order of what seems best):
* Solve #69595: Node search operands should be extsnsible and moved out of node.module
* Hard-code a new "language" operand into core's search, alongside the existing hard-coded operands
* Write an API contrib module for handling custom search operands
* Add a ton of code to i18n to handle custom search operands.
If we limit ourselves to what would amount to a partially broken search, we could just:
* Add checkboxes and check for the $_REQUEST and rewrite search sql without adding operand support.
#10
Merging the thread in #316147: Multilingual Search for Multilanguage site
We should also add some content selection options specific for search if we find the way to add some fields to the search form.
#11
+
#12
subscribing
#13
Drupal 6.11 is out, so this is a new patches for core modules. Seems like nobody build multilingual sites without huge 18n module. I prefer little patch, and think what this language filter should be even integrated into core, because this is not break any functionality, only apply multilanguage feature in more logical way.
#14
#15
Please provide unified patches, http://drupal.org/patch/create
#16
Again, we are not including core patches as part of i18n module. So this is still open till we find a module-only approach that needs no core patching.
#17
But this patch does not change the search form, or the resulting listing?
The idea is to allow search for items in the current language, or all languages?