tortoise / tortoise/tortoise-orm

Unaccent querys

Open
#1,359 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
5.6k
Forks
516
Avg merge
2d 21h
Merged PRs (30d)
9

Description

Hi, I'm trying to make queries to search words witout accents.

For example, I have model with field description and in a register someone put the word Opción so in a filter i want to search that word but the user put opcion witout accentuate in letter o.

I tried:

search_word = 'option' 

query = await Model.filter(Q(description__iexact=data['name']) | Q(description__icontains=data['name']))

#not works

query = await Model.filter(Q(description__search=data['name']) | Q(description__icontains=data['name']))

#not works

I have many option in filtering here https://tortoise.github.io/query.html?h=icontains#filtering, but none works for me.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the filtering documentation linked in the issue and the Model.filter/Q expressions shown in its examples. The issue names no source file or test; first determine whether accent-insensitive matching is intended and what supported database behavior should demonstrate that the work is complete.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, database
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.