Git Product home page Git Product logo

django-tsvector-field's People

Contributors

eukreign avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

django-tsvector-field's Issues

tsvector Field Already Exists

Following along with the tutorial I've added a 'search' field to an existing model and generated the migration file. But when I run 'migrate' the migrations fails with a ProgrammingError 'name-of-the-field_tsvector' already exists.

Running django-tsvector-field 0.9.3, django 1.11, and PostgreSQL 9.5.6

Support for indexing fields of related models?

Hey, awesome library! I was disappointed to see that Django does not offer any support out of the box for FTS for real applications - using triggers and store procedures instead of indexing on the fly - which obviously does not scale on even a modest level of traffic.

For our use case, we'd like to index fields on related models through joins. One simple example to allude to is the ability to search for orders by line item descriptions. Briefly digging into the codebase, it does not look like this is currently supported.

I'd be happy to contribute something to make this work. Has this feature been thought about before? Any recommendations for how this should be tackled?

tsvector not recomputed when a NULL column is set to a value.

I believe there is a bug in the generated trigger logic. If a NULL column is given a non-NULL value, this won't trigger an update to the tsvector field to include the new text.

The issue is with logic like:

     ELSIF (NEW."some_indexed_field" <> OLD."some_indexed_field") THEN do_update = true;

Since NULL <> 'something' is not true in SQL. The simplest solution I could come up with is to replace the <> tests with IS DISTINCT FROM.

Let me know if you'd like a pull request.

add to README tutorial something on Headline

Update the README with some instructions on how to use the Headline class and present matched excerpts from the result set....

https://github.com/damoti/django-tsvector-field/blob/master/tsvector_field/query.py#L5

from django.db.models.expressions import F
from django.contrib.postgres.search import SearchRank, SearchQuery
import tsvector_field

query = SearchQuery(self.form['text'].value())
qs = (
  qs.filter(text__search=query)
    .annotate(
      match_title=tsvector_field.Headline(F('text__title'), query),
      match_text=tsvector_field.Headline(F('text__text'), query)
    )
    .annotate(rank=SearchRank(F('text__search'), query))
    .order_by('-rank')
)

field should be deferred by default

The contents of the tsvector is an implementation detail in postgres, it's kind of pointless to keep shuttling this back and forth between Postgres and Django.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.