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

operator does not exist: text = uuid #214

Closed
day009 opened this issue Aug 20, 2017 · 7 comments
Closed

operator does not exist: text = uuid #214

day009 opened this issue Aug 20, 2017 · 7 comments

Comments

@day009
Copy link

day009 commented Aug 20, 2017

Hi!
It works great except using filter:

class ItemConfig(AppConfig):
    name = 'item'

    def ready(self):
        Item = self.get_model("Item")
        watson.register(Item.objects.filter(is_published=True))

class Item(models.Model):

    id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
    item_nr = models.IntegerField(unique=True,)
    is_published = models.BooleanField(default=False)
    ...

Exception is:

operator does not exist: text = uuid
LINE 1: ...= 'default' AND ("watson_searchentry"."object_id" IN (SELECT...
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. ) was the direct cause of the following exception:

Sorry if it is trivial issue.

@etianen
Copy link
Owner

etianen commented Aug 21, 2017 via email

@day009
Copy link
Author

day009 commented Aug 21, 2017

It is Postgresql 9.5

@etianen
Copy link
Owner

etianen commented Aug 22, 2017 via email

@day009
Copy link
Author

day009 commented Aug 22, 2017

Please inform if I should put here request/settings/other info also.
views.py code is:

search_results = watson.search(search_term)
    for result in search_results:
print(result.title, result.url, result.meta.some_field)

Environment:

Request Method: POST
Request URL: http://127.0.0.1:8000/en/search/

Django Version: 1.11.3
Python Version: 3.5.2
Installed Applications:
['django.contrib.auth',
'django.contrib.contenttypes',
'modeltranslation',
'grappelli',
'django.contrib.admin',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'mptt',
'tinymce',
'sorl.thumbnail',
'django_cleanup',
'adminsortable2',
'taggit',
'taggit_selectize',
'geoip2',
'captcha',
'pure_pagination',
'watson',
'corcc.apps.order.apps.OrderConfig',
'corcc.apps.image.apps.ImageConfig',
'corcc.apps.sitesetting.apps.SitesettingConfig',
'corcc.apps.item.apps.ItemConfig',
'corcc.apps.partner.apps.PartnerConfig',
'corcc.apps.search.apps.SearchConfig',
'corcc.apps.migration.apps.MigrationConfig',
'debug_toolbar']
Installed Middleware:
['django.middleware.common.BrokenLinkEmailsMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.locale.LocaleMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware']

Traceback:

File "/home/yu/.virtualenvs/corcc_dev/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
65. return self.cursor.execute(sql, params)

The above exception (operator does not exist: text = uuid
LINE 1: ...= 'default' AND ("watson_searchentry"."object_id" IN (SELECT...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
) was the direct cause of the following exception:

File "/home/yu/.virtualenvs/corcc_dev/lib/python3.5/site-packages/django/core/handlers/exception.py" in inner
41. response = get_response(request)

File "/home/yu/.virtualenvs/corcc_dev/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
187. response = self.process_exception_by_middleware(e, request)

File "/home/yu/.virtualenvs/corcc_dev/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
185. response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/home/yu/Documents/_projects/corcc_project/corcc/apps/item/views.py" in search
423. for result in search_results:

File "/home/yu/.virtualenvs/corcc_dev/lib/python3.5/site-packages/django/db/models/query.py" in iter
250. self._fetch_all()

File "/home/yu/.virtualenvs/corcc_dev/lib/python3.5/site-packages/django/db/models/query.py" in _fetch_all
1118. self._result_cache = list(self._iterable_class(self))

File "/home/yu/.virtualenvs/corcc_dev/lib/python3.5/site-packages/django/db/models/query.py" in iter
53. results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)

File "/home/yu/.virtualenvs/corcc_dev/lib/python3.5/site-packages/django/db/models/sql/compiler.py" in execute_sql
886. raise original_exception

File "/home/yu/.virtualenvs/corcc_dev/lib/python3.5/site-packages/django/db/models/sql/compiler.py" in execute_sql
876. cursor.execute(sql, params)

File "/home/yu/.virtualenvs/corcc_dev/lib/python3.5/site-packages/debug_toolbar/panels/sql/tracking.py" in execute
164. return self._record(self.cursor.execute, sql, params)

File "/home/yu/.virtualenvs/corcc_dev/lib/python3.5/site-packages/debug_toolbar/panels/sql/tracking.py" in _record
106. return method(sql, params)

File "/home/yu/.virtualenvs/corcc_dev/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
80. return super(CursorDebugWrapper, self).execute(sql, params)

File "/home/yu/.virtualenvs/corcc_dev/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
65. return self.cursor.execute(sql, params)

File "/home/yu/.virtualenvs/corcc_dev/lib/python3.5/site-packages/django/db/utils.py" in exit
94. six.reraise(dj_exc_type, dj_exc_value, traceback)

File "/home/yu/.virtualenvs/corcc_dev/lib/python3.5/site-packages/django/utils/six.py" in reraise
685. raise value.with_traceback(tb)

File "/home/yu/.virtualenvs/corcc_dev/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
65. return self.cursor.execute(sql, params)

Exception Type: ProgrammingError at /en/search/
Exception Value: operator does not exist: text = uuid
LINE 1: ...= 'default' AND ("watson_searchentry"."object_id" IN (SELECT...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.

@etianen
Copy link
Owner

etianen commented Aug 22, 2017

Thanks for the detailed info! I've just pushed a fix to master that may solve your issue. Please let me know.

@day009
Copy link
Author

day009 commented Aug 22, 2017

Works like a charm!
Many thanks!

@day009 day009 closed this as completed Aug 22, 2017
@etianen
Copy link
Owner

etianen commented Aug 22, 2017 via email

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