Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pg_catalog tuple does not work #73

Open
LennyLip opened this issue Feb 18, 2016 · 3 comments
Open

pg_catalog tuple does not work #73

LennyLip opened this issue Feb 18, 2016 · 3 comments

Comments

@LennyLip
Copy link

Django 1.8.3
config = ('pg_catalog.english')
works ok

config = ('pg_catalog.english', 'pg_catalog.simple'),

raise

  File "D:\project\src\testproj\apps\item\views\baseviews.py", line 170, in get
    qs = qs.search(str(request.query_params['q']))
  File "D:\project\src\testproj\apps\djorm_pgfulltext\models.py", line 315, in search
    "%s('%s', %s)" % (function, config, adapt(query))
  File "D:\project\src\testproj\apps\djorm_pgfulltext\utils.py", line 9, in adapt
    a.prepare(connection.connection)
TypeError: must be psycopg2._psycopg.connection, not None
@LennyLip
Copy link
Author

Hm seems it not work and with
config = ('pg_catalog.english')

It works while i have breakpoint and it works after resume program (after breakpoint pause). Seems django connection is not aviable at that time.

ps. May be it is Windows issue?
python 3.4.

@LennyLip
Copy link
Author

Ok, fix it with

def adapt(text):
    a = psycopg2.extensions.adapt(force_text(text))
    a.prepare(connection.connection)
    return a

replace with:

def adapt(text):
    connection.cursor()
    a = psycopg2.extensions.adapt(force_text(text))
    a.prepare(connection.connection)
    return a

now, single catalog works ok, but tuple is none:

django.db.utils.ProgrammingError:

@@ (plainto_tsquery('('pg_catalog

@vilisov
Copy link

vilisov commented Oct 14, 2016

Someone decided this issue?

ProgrammingError: syntax error at or near "pg_catalog"
LINE 1: ...ct" SET "search_index" = setweight(to_tsvector('('pg_catalog...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants