Hi!
This is the first patch I create, so please be kind :)
I have already tested it and is working.
This patch performs the transliteration of the search strings and search index.
It implements the hook_search_preprocess() and then runs the text through the transliteration_get() function to do the job.
I also added a checkbox so that the user can choose to use this functionality or not.
This patch is quite useful for greek where users can perform searches with accented or not accented letters eg 'πλάνη' vs 'πλανη' or use a latin keybord to perform a search eg gata vs γάτα (=cat). Hopefully, it will solve similar problems with other languages.
You can refer to issue #1054956: Accented letters? from Search Lucene API project for more info.
Mike
Comment | File | Size | Author |
---|---|---|---|
#6 | transliteration-search-1058064-D6.patch | 2.7 KB | amateescu |
#6 | transliteration-search-1058064-D7.patch | 1.87 KB | amateescu |
#1 | transliteration-search-1058064.patch | 1.55 KB | smk-ka |
transliterate search-string-and-index.patch | 1.24 KB | msti |
Comments
Comment #1
smk-ka CreditAttribution: smk-ka commentedCool stuff! One change I've made was setting the $source_language parameter of the transliteration_get() call to the site default language, because transliteration is language specific. However, since we do not know the original input language of a piece of text passed to hook_search_preprocess(), we need to set it to the site default, otherwise the results may differ. The reason being that if unset, transliteration_get() falls back to the current display language, which may be different from the language used when indexing the same piece of text during a cron run or the like. Other than that I've applied only minor whitespace and some wording changes.
Comment #2
mstiI am glad it's useful.
Is this going to be applied to the dev release, or will you wait for people to test it first?
Comment #3
cpliakas CreditAttribution: cpliakas commentedI have tested the patch in #1, and it works perfectly for me. Great contribution, msti.
~Chris
Comment #4
dropbydrop CreditAttribution: dropbydrop commentedDid this patch got in latest dev or not yet?
thanks
Comment #5
dropbydrop CreditAttribution: dropbydrop commentedWill this possibility be integrated in module?
Comment #6
amateescu CreditAttribution: amateescu commentedI think this setting doesn't belong to the file system configuration form so I moved it to the search settings form.
Commited attached patches to 6.x-3.x and 7.x-3.x.
http://drupalcode.org/project/transliteration.git/commit/9130c70
http://drupalcode.org/project/transliteration.git/commit/26ae882
Comment #8
mgiffordCan this be added to the project page?
There's no indication that this module now corrects searches as well.
Comment #9
amateescu CreditAttribution: amateescu commentedReopening for #8. Would you mind giving me a hint at how this info should sound like? :)
Comment #10
mgiffordRight after the paragraph on transliteration for URLs, maybe something like.
Maybe something like that. Just a short paragraph so someone can quickly indicate that this functionality is addressed here.
Comment #11
amateescu CreditAttribution: amateescu commentedDone! Added this text:
Thanks Mike :)
Comment #12
mgiffordExcellent!