Semprini / pyMDG

UML Model Driven Generation of schema, code, data and documentation.
Other
21 stars 10 forks source link

Django model performant full text search based on "searchable" stereotype #72

Closed Semprini closed 4 months ago

Semprini commented 6 months ago

` from django.db import models from django.db.models import F from django.contrib.postgres.search import SearchVector, SearchVectorField

class Blog(models.Model): body = models.TextField() title = models.TextField() search_vector = models.GeneratedField( expression=SearchVector("title", config="english") + SearchVector("body", config="english"), output_field=SearchVectorField(), db_persist=True, ) `