Opened 5 years ago

Closed 5 years ago

#31296 closed Cleanup/optimization (wontfix)

Document different config scenarios of full text search configuration.

Reported by: Baptiste Mispelon Owned by: nobody
Component: Documentation Version: 3.0
Severity: Normal Keywords:
Cc: ChillarAnand Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The documentation for full text search [1] explains that you can pass a config parameter to both SearchVector and SearchQuery but it's not clear to me if you need to pass the same configuration to both or what happens if you pass two different configurations to each object.

In other words, is there a difference between the following 3 scenarios:

# from the documentation
Entry.objects.annotate(
...     search=SearchVector('body_text', config='french'),
... ).filter(search=SearchQuery('œuf', config='french'))

Entry.objects.annotate(
...     search=SearchVector('body_text', config='french'),
... ).filter(search=SearchQuery('œuf'))

Entry.objects.annotate(
...     search=SearchVector('body_text'),
... ).filter(search=SearchQuery('œuf', config='french'))

And also, what happens when you try different configurations in the same query:

Entry.objects.annotate(
...     search=SearchVector('body_text', config='english'),
... ).filter(search=SearchQuery('œuf', config='french'))

[1] https://docs.djangoproject.com/en/3.0/ref/contrib/postgres/search/#changing-the-search-configuration

Change History (2)

comment:1 by ChillarAnand, 5 years ago

Cc: ChillarAnand added
Needs documentation: set
Summary: Clarify what happensDocument different config scenarios of full text search configuration

comment:2 by Mariusz Felisiak, 5 years ago

Needs documentation: unset
Resolution: wontfix
Status: newclosed
Summary: Document different config scenarios of full text search configurationDocument different config scenarios of full text search configuration.

Baptiste, thanks for this ticket, however it's an extensive topic and IMO the current explanation is sufficient for Django documentation. You should use PostgreSQL's docs for more complicated scenarios e.g. using different configs.

Note: See TracTickets for help on using tickets.
Back to Top