Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#3588 closed defect (fixed)

Search in home view should be done in normalized strings

Reported by: manuq Owned by: manuq
Priority: Unspecified by Maintainer Milestone:
Component: Sugar Version: 0.97.x
Severity: Unspecified Keywords: olpc-test-passed
Cc: garycmartin Distribution/OS: Unspecified
Bug Status: Unconfirmed

Description (last modified by manuq)

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)

Attachments (1)

0001-Improve-search-in-views-normalizing-the-strings-SL-3.patch (9.9 KB) - added by manuq 11 years ago.
Candidate patch

Download all attachments as: .zip

Change History (8)

comment:1 Changed 12 years ago by manuq

  • Description modified (diff)

comment:2 follow-up: Changed 11 years ago by erikos

  • Cc garycmartin added
  • Owner set to manuq
  • Status changed from new to assigned
  • Version changed from Unspecified to 0.97.x

@gary: do you agree with the postulation above?

@manuq: do you have a working patch based on the snippet above or in reach in a few minutes?

comment:3 in reply to: ↑ 2 Changed 11 years ago by garycmartin

Replying to erikos:

@gary: do you agree with the postulation above?

@manuq: do you have a working patch based on the snippet above or in reach in a few minutes?

+1 I agree it's a much better behaviour.

Changed 11 years ago by manuq

Candidate patch

comment:4 Changed 11 years ago by manuq

  • Keywords r? added

The attached patch covers the three zoom views. Please test.

comment:5 Changed 11 years ago by manuq

  • Keywords olpc-test-pending added; r? removed
  • Resolution set to fixed
  • Status changed from assigned to closed

Pushed with better message and util function in jarabe/util directory as per Simon feedback. Commit number is 6d72b348 .

comment:6 Changed 11 years ago by greenfeld

  • Keywords olpc-test-passed added; olpc-test-pending removed

We search based on a normalized version of the input search string and a normalized version of the activity name in OLPC 13.1.0 os7. Searches ignore accents and letter casing in both the Favorites and List views.

Tested with Sugar set to use German and Spanish.

comment:7 Changed 11 years ago by dnarvaez

  • Milestone 0.98 deleted

Milestone 0.98 deleted

Note: See TracTickets for help on using tickets.