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.

AttachmentSize
blog.module.patch427 bytes
blog.pages_.inc_.patch487 bytes
node.module.patch506 bytes

#1

Roxpace - March 23, 2008 - 13:52

Thanks, this is most welcome, strange that not many else has reflected this huge problem,

#2

Jose Reyero - March 24, 2008 - 19:11
Title:Records doesn't filtered with language switcher» Add language filter to search form
Category:bug report» feature request
Status:needs review» needs work

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

Andrew Answer - March 25, 2008 - 19:27

Added new version patch for blogs. Now 1) blogs with urls like blog\1 filtered too 2) RSS feeds language-specific too.

AttachmentSize
blog.pages_.inc_.patch 2.08 KB

#4

asw20pilot - April 11, 2008 - 08:02

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

Andrew Answer - April 20, 2008 - 19:32

Drupal 6.2 is out, so this is a new patches for core modules.

AttachmentSize
node.module.patch 504 bytes
blog.module.patch 458 bytes
blog.pages_.inc_.patch 2.08 KB

#6

Roxpace - July 17, 2008 - 09:47

Are these patches working with D6.3 and is it now a part of the beta release of this module ?

#7

qbicdesign - July 19, 2008 - 15:54

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

Roxpace - July 22, 2008 - 14:35

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

nedjo - January 25, 2009 - 20:37

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

Jose Reyero - April 28, 2009 - 09:16

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

hass - April 28, 2009 - 15:41

+

#12

areaten - May 2, 2009 - 11:40

subscribing

#13

Andrew Answer - May 6, 2009 - 05:21

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.

AttachmentSize
blog.module.patch 458 bytes
blog.pages_.inc_.patch 2.08 KB
node.module.patch 505 bytes

#14

Andrew Answer - May 6, 2009 - 05:23
Status:needs work» needs review

#15

hass - May 6, 2009 - 06:50

Please provide unified patches, http://drupal.org/patch/create

#16

Jose Reyero - May 19, 2009 - 10:08
Status:needs review» active

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

boran - October 27, 2009 - 14:51

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?

 
 

Drupal is a registered trademark of Dries Buytaert.