First time here? Check out the FAQ!
0

DatabaseError while searching for people

For instance I want to execute a search query by name:

example.com/users/by-group/2/everyone/?search=&t=user&query=john

It throws this error:

Traceback (most recent call last):

File "/rest/u/apps/askbot_face/ve/lib/python2.6/site-packages/django/core/handlers/base.py", line 111, in get_response response = callback(request, callback_args, *callback_kwargs)

File "/rest/u/apps/askbot_face/ve/lib/python2.6/site-packages/askbot/views/users.py", line 159, in show_users users_page = objects_list.page(page)

File "/rest/u/apps/askbot_face/ve/lib/python2.6/site-packages/django/core/paginator.py", line 37, in page number = self.validate_number(number)

File "/rest/u/apps/askbot_face/ve/lib/python2.6/site-packages/django/core/paginator.py", line 28, in validate_number if number > self.num_pages:

File "/rest/u/apps/askbot_face/ve/lib/python2.6/site-packages/django/core/paginator.py", line 60, in _get_num_pages if self.count == 0 and not self.allow_empty_first_page:

File "/rest/u/apps/askbot_face/ve/lib/python2.6/site-packages/django/core/paginator.py", line 48, in _get_count self._count = self.object_list.count()

File "/rest/u/apps/askbot_face/ve/lib/python2.6/site-packages/django/db/models/query.py", line 351, in count return self.query.get_count(using=self.db)

File "/rest/u/apps/askbot_face/ve/lib/python2.6/site-packages/django/db/models/sql/query.py", line 418, in get_count number = obj.get_aggregation(using=using)[None]

File "/rest/u/apps/askbot_face/ve/lib/python2.6/site-packages/django/db/models/sql/query.py", line 384, in get_aggregation result = query.get_compiler(using).execute_sql(SINGLE)

File "/rest/u/apps/askbot_face/ve/lib/python2.6/site-packages/django/db/models/sql/compiler.py", line 818, in execute_sql cursor.execute(sql, params)

File "/rest/u/apps/askbot_face/ve/lib/python2.6/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 52, in execute return self.cursor.execute(query, args)

DatabaseError: column "language_code" does not exist LINE 1: ...text_search_vector @@ plainto_tsquery('john') AND language_c... ^ Why this column is missing and how it can be properly restored?

Thank you.

Kirill's avatar
11
Kirill
asked 2013-09-23 10:04:02 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

1

Hi

This is solved with the following command:

python manage.py init_postgresql_full_text_search

Please note that this command was updated recently due to a bug, so please update your code before executing.

Fitoria's avatar
1.1k
Fitoria
answered 2013-09-23 11:03:53 -0500
edit flag offensive 0 remove flag delete link

Comments

Thank you! Could you share the recipe of Askbot updating in production environment?

Kirill's avatar Kirill (2013-09-23 11:06:31 -0500) edit

@Kirill, update the Askbot version, there are a number of issues fixed and some new features. Make a staging environment to test-updated and then apply the real update, there is always some risk in updating on the live server.

Evgeny's avatar Evgeny (2013-09-23 11:26:12 -0500) edit
add a comment see more comments