summaryrefslogtreecommitdiff
path: root/django/contrib/postgres/search.py
AgeCommit message (Collapse)Author
2025-09-16Fixed #28041 -- Added Lexeme expression to contrib.postgres.search.GappleBee
This expression automatically escapes its input and allows fine-grained control over prefix matching and term weighting via logical combinations. Thanks Mariusz Felisiak, Adam Zapletal, Paolo Melchiorre, Jacob Walls, Adam Johnson, and Simon Charette for reviews. Co-authored-by: joetsoi <joetsoi@users.noreply.github.com> Co-authored-by: Karl Hobley <karl@kaed.uk> Co-authored-by: Alexandr Tatarinov <tatarinov1997@gmail.com>
2025-08-04Fixed #35972 -- Fixed lookup crashes after subquery annotations.Jacob Walls
2025-06-18Fixed #32770 -- Added system check to ensure django.contrib.postgres is ↵Clifford Gama
installed when using its features. Added postgres.E005 to validate 'django.contrib.postgres' is in INSTALLED_APPS when using: * PostgreSQL-specific fields (ArrayField, HStoreField, range fields, SearchVectorField), * PostgreSQL indexes (PostgresIndex and all subclasses), and * ExclusionConstraint The check provides immediate feedback during system checks rather than failing later with obscure runtime and database errors. Thanks to Simon Charette and Sarah Boyce for reviews.
2025-03-31Refs #28909 -- Simplified code using unpacking generalizations.Aarni Koskela
2024-01-26Applied Black's 2024 stable style.Mariusz Felisiak
https://github.com/psf/black/releases/tag/24.1.0
2023-04-06Fixed #34459 -- Fixed SearchVector() crash for parameters with % symbol.Mariusz Felisiak
Thanks Patryk Zawadzki for the report. Regression in 09ffc5c1212d4ced58b708cbbf3dfbfb77b782ca.
2022-12-15Fixed #33308 -- Added support for psycopg version 3.Daniele Varrazzo
Thanks Simon Charette, Tim Graham, and Adam Johnson for reviews. Co-authored-by: Florian Apolloner <florian@apolloner.eu> Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2022-12-12Refs #33308 -- Added DatabaseOperations.compose_sql() on PostgreSQL.Florian Apolloner
2022-06-17Fixed #33788 -- Added TrigramStrictWordSimilarity() and ↵Matt Brewer
TrigramStrictWordDistance() on PostgreSQL.
2022-03-31Fixed #33397 -- Corrected resolving output_field for ↵Luke Plant
DateField/DateTimeField/TimeField/DurationFields. This includes refactoring of CombinedExpression._resolve_output_field() so it no longer uses the behavior inherited from Expression of guessing same output type if argument types match, and instead we explicitly define the output type of all supported operations. This also makes nonsensical operations involving dates (e.g. date + date) raise a FieldError, and adds support for automatically inferring output_field for cases such as: * date - date * date + duration * date - duration * time + duration * time - time
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2021-09-17Fixed #32492 -- Added TrigramWordSimilarity() and TrigramWordDistance() on ↵Nikita Marchant
PostgreSQL.
2020-03-23Fixed #28194 -- Added support for normalization and cover density to SearchRank.Hannes Ljungberg
2020-03-16Fixed #31340 -- Allowed query expressions in SearchQuery.value and __search ↵Baptiste Mispelon
lookup.
2020-03-13Refs #31340 -- Simplified SearchQuery by making it subclass Func.Baptiste Mispelon
2020-03-13Removed unnecessary SearchQuery._combine().Baptiste Mispelon
Unnecessary since its introduction in 2d877da85526bad0dad7fd6b1d56b1f924c0116a.
2020-03-03Fixed #31147 -- Added SearchHeadline to django.contrib.postgres.Hannes Ljungberg
2020-02-26Simplified handling of weights in SearchRank.Simon Charette
2020-02-26Formalized SearchVector and SearchRank signatures.Simon Charette
2020-02-26Refs #31211 -- Prevented SearchConfig nesting in SearchVector and ↵Simon Charette
SearchQuery init. Passing a SearchConfig instance directly to SearchVector and SearchQuery would result in nested SearchConfig instance.
2020-02-26Refs #3254 -- Removed unnecessary truth check in SearchVectorExact.as_sql().Simon Charette
Direct usage of the @@ operator is perfectly allowed.
2020-02-06Fixed #28528 -- Allowed combining SearchVectors with different configs.adamb70
2020-02-04Simplified imports from django.db and django.contrib.gis.db.Nick Pope
2020-01-29Fixed #31211 -- Added SearchConfig expression.Hannes Ljungberg
Thanks Simon Charette for the review.
2020-01-27Improved SearchVectorCombinable and SearchQueryCombinable error messages.Hannes Ljungberg
2019-12-16Fixed #31088 -- Added support for websearch searching in SearchQuery.James Turk
2019-05-20Fixed #30488 -- Removed redundant Coalesce call in SQL generated by ↵Thomasina Lee
SearchVector. Regression in 405c8363362063542e9e79beac53c8437d389520.
2019-04-23Fixed #30385 -- Restored SearchVector(config) immutability.Simon Charette
Regression in 1a28dc3887e8d66d5e3ff08cf7fb0a6212b873e5. The usage of CONCAT to allow SearchVector to deal with non-text fields made the generated expression non-IMMUTABLE which prevents a functional index to be created for it. Using a combination of COALESCE and ::text makes sure the expression preserves its immutability. Refs #29582. Thanks Andrew Brown for the report, Nick Pope for the review.
2018-11-30Fixed #29997 -- Allowed combining SearchQuerys with different configs.Jaap Roes
Seems to be a needless restriction in 978a00e39fee25cfa99065285b0de88366710fad.
2018-09-17Fixed #27899 -- Added support for phrase/raw searching in SearchQuery.Claude Paroz
Thanks Tim Graham, Nick Pope, and Claude Paroz for contribution and review.
2018-08-15Fixed #29644 -- Made SearchQuery.__str__() reflect negation and grouping.Tom Forbes
2018-07-21Fixed #29582 -- Fixed a crash when using SearchVector with non text-fields.Simon Charette
The PostgreSQL concat() function handles nulls and non-text values better than the || operator.
2017-09-11Fixed #28492 -- Defined default output_field of expressions at the class level.Simon Charette
This wasn't possible when settings were accessed during Field initialization time as our test suite setup script was triggering imports of expressions before settings were configured.
2017-08-02Removed unused _combine() node argument from various combinable classes.Mariusz Felisiak
Unused since f59fd15c4928caf3dfcbd50f6ab47be409a43b01 (Combinable) and since its introduction in 2d877da85526bad0dad7fd6b1d56b1f924c0116a (SearchVectorCombinable/SearchQueryCombinable/SearchQuery).
2017-07-14Fixed #28394 -- Allowed setting BaseExpression.output_field (renamed from ↵Sergey Fedoseev
_output_field).
2017-02-01Refs #23919 -- Replaced kwargs.pop() with keyword-only arguments.Vytis Banaitis
2017-01-25Refs #23919 -- Replaced super(ClassName, self) with super().chillaranand
2017-01-19Refs #23919 -- Stopped inheriting from object to define new style classes.Simon Charette
2016-09-07Fixed #27143 -- Allowed combining SearchQuery with more than one & or | ↵Nicola Jordan
operators.
2016-05-13Fixed #24938 -- Added PostgreSQL trigram support.Matthew Somerville
2016-04-22Refs #3254 -- Added full text search to contrib.postgres.Marc Tamlyn
Adds a reasonably feature complete implementation of full text search using the built in PostgreSQL engine. It uses public APIs from Expression and Lookup. With thanks to Tim Graham, Simon Charettes, Josh Smeaton, Mikey Ariel and many others for their advice and review. Particular thanks also go to the supporters of the contrib.postgres kickstarter.