[Bugs] #3588 sugar UNSP: Search in home view should be done in normalized strings

Sugar Labs Bugs bugtracker-noreply at sugarlabs.org
Wed May 9 09:00:36 EDT 2012


#3588: Search in home view should be done in normalized strings
------------------------------------------+---------------------------------
    Reporter:  manuq                      |          Owner:             
        Type:  defect                     |         Status:  new        
    Priority:  Unspecified by Maintainer  |      Milestone:  0.98       
   Component:  sugar                      |        Version:  Unspecified
    Severity:  Unspecified                |       Keywords:             
Distribution:  Unspecified                |   Status_field:  Unconfirmed
------------------------------------------+---------------------------------
Description changed by manuq:

Old description:

> TestCase:
>
>  * switch your Sugar to Spanish
>  * install Abacus, which is named Ábaco in Spanish
>  * search for "aba" in the home view
>  * Ábaco should be in the selected activities
>
> This is pretty standard search functionality.  Currently, you have to
> type matching even the character cases.  Would be nice to ignore case
> sensitiveness, and normalize to ASCII equivalents, like 'á' -> 'a'.  This
> can be easily done with the following function:
>
> {{{
> from unicodedata import normalize
>
> def normalize_string(unicode_string):
>     u"""Return unicode_string normalized for searching.
>
>     >>> normalize_string(u'Mónica Viñao')
>     'monica vinao'
>
>     """
>     return normalize('NFKD', unicode_string).encode('ASCII',
> 'ignore').lower()
> }}}

New description:

 TestCase:

  * switch your Sugar to Spanish
  * install Abacus, which is named Ábaco in Spanish
  * search for "aba" in the home view
  * Ábaco should be in the selected activities

 This is pretty standard search functionality.  Currently, you have to type
 matching even the character cases.  Would be nice to ignore case
 sensitiveness, and normalize to ASCII equivalents, like 'á' -> 'a'.  This
 can be easily done with the following function:

 {{{
 from unicodedata import normalize

 def normalize_string(unicode_string):
     u"""Return unicode_string normalized for searching.

     >>> normalize_string(u'Mónica Viñao')
     'monica vinao'

     """
     return normalize('NFKD', unicode_string).encode('ASCII',
 'ignore').lower()
 }}}

 (stolen from
 http://python.org.ar/pyar/Recetario/NormalizarCaracteresUnicode)

--

-- 
Ticket URL: <http://bugs.sugarlabs.org/ticket/3588#comment:1>
Sugar Labs <http://sugarlabs.org/>
Sugar Labs bug tracking system


More information about the Bugs mailing list