Ticket #2559: django-search_fields-operators-docs_pre_magic_removal.diff

File django-search_fields-operators-docs_pre_magic_removal.diff, 1.3 KB (added by eric@…, 9 years ago)

The same patch back-ported to the pre-magic-removal tag (changeset r2808)

  • docs/model-api.txt

     
    13861386    WHERE (first_name ILIKE '%john%' OR last_name ILIKE '%john%')
    13871387    AND (first_name ILIKE '%lennon%' OR last_name ILIKE '%lennon%')
    13881388
     1389For faster and/or more restrictive searches, prefix the field name
     1390with an operator:
     1391
     1392`^`
     1393    Matches the beginning of the field. For example, if
     1394    ``search_fields`` is set to ``['^first_name', '^last_name']`` and
     1395    a user searches for ``john lennon``, Django will do the equivalent
     1396    of this SQL ``WHERE`` clause::
     1397
     1398        WHERE (first_name ILIKE 'john%' OR last_name ILIKE 'john%')
     1399        AND (first_name ILIKE 'lennon%' OR last_name ILIKE 'lennon%')
     1400
     1401`=`
     1402    Matches exactly, case-insensitive. For example, if
     1403    ``search_fields`` is set to ``['=first_name', '=last_name']`` and
     1404    a user searches for ``john lennon``, Django will do the equivalent
     1405    of this SQL ``WHERE`` clause::
     1406
     1407        WHERE (first_name ILIKE 'john' OR last_name ILIKE 'john')
     1408        AND (first_name ILIKE 'lennon' OR last_name ILIKE 'lennon')
     1409
     1410`@`
     1411    Performs a full-text match. This is like the default search but
     1412    uses an index. Currently this is only available for MySQL.
     1413
    13891414Managers
    13901415========
    13911416
Back to Top