You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I installed 0.9.3 following the instructions in the README in an app using Django 1.5 with a PostgreSQL 9.3 backend.
However, when I ran ./manage update_search_field myapp mymodel it runs without error but nothing gets populated into the new search_index column on mymodel.
One possible problem may be that mymodel exists on a non-default database, and the command update_search_field doesn't support a --database attribute like many commands do. However, even when I patch the command to use the correct database connection, still nothing populates.
This is the SQL being run by the command:
UPDATE "myapp_mymodel" SET "search_index" = setweight(to_tsvector('pg_catalog.english', coalesce("myapp_mymodel"."account_number", '')), 'D');
If I run:
SELECT account_number FROM myapp_mymodel;
I see a non-blank value for every record, but when I run:
SELECT search_index FROM myapp_mymodel;
it returns nothing but blank values.
If I manually run that UPDATE statement, it populates correctly, so I'm assuming I didn't properly patch the code to use the correct connection.
What am I doing wrong?
The text was updated successfully, but these errors were encountered:
I think I figured out how to properly patch the code. Changing the using isn't necessary. All I had to do to get this working was to change line 163 of models.py from:
sql = "UPDATE %s SET %s = %s %s;" % (
to:
sql = "UPDATE %s SET %s = %s %s; COMMIT;" % (
I see that line was already under an atomic() context manager, so I'm not sure why this was required. Is this a bug or is it possibly something strange in my configuration? Should I submit a pull request?
I installed 0.9.3 following the instructions in the README in an app using Django 1.5 with a PostgreSQL 9.3 backend.
However, when I ran
./manage update_search_field myapp mymodel
it runs without error but nothing gets populated into the newsearch_index
column onmymodel
.One possible problem may be that mymodel exists on a non-default database, and the command
update_search_field
doesn't support a--database
attribute like many commands do. However, even when I patch the command to use the correct database connection, still nothing populates.This is the SQL being run by the command:
If I run:
I see a non-blank value for every record, but when I run:
it returns nothing but blank values.
If I manually run that UPDATE statement, it populates correctly, so I'm assuming I didn't properly patch the code to use the correct connection.
What am I doing wrong?
The text was updated successfully, but these errors were encountered: