Closed day009 closed 7 years ago
What database are you using?
On Sun, 20 Aug 2017 at 20:36, day009 notifications@github.com wrote:
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,) ...
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.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/etianen/django-watson/issues/214, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJFCEHt_OUg_gBUqj5y7uazWXPFJvh4ks5saIqwgaJpZM4O8tQA .
It is Postgresql 9.5
Can I have the full traceback of your exception?
On 21 August 2017 at 12:44, day009 notifications@github.com wrote:
It is Postgresql 9.5
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/etianen/django-watson/issues/214#issuecomment-323722820, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJFCEMofT5dbUov1iR2s7qpOGOgpBBaks5saW2KgaJpZM4O8tQA .
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
- 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
- response = get_response(request)
File "/home/yu/.virtualenvs/corcc_dev/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
- 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
- response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/yu/Documents/_projects/corcc_project/corcc/apps/item/views.py" in search
- for result in search_results:
File "/home/yu/.virtualenvs/corcc_dev/lib/python3.5/site-packages/django/db/models/query.py" in iter
- self._fetch_all()
File "/home/yu/.virtualenvs/corcc_dev/lib/python3.5/site-packages/django/db/models/query.py" in _fetch_all
- 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
- 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
- raise original_exception
File "/home/yu/.virtualenvs/corcc_dev/lib/python3.5/site-packages/django/db/models/sql/compiler.py" in execute_sql
- cursor.execute(sql, params)
File "/home/yu/.virtualenvs/corcc_dev/lib/python3.5/site-packages/debug_toolbar/panels/sql/tracking.py" in execute
- 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
- return method(sql, params)
File "/home/yu/.virtualenvs/corcc_dev/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
- 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
- return self.cursor.execute(sql, params)
File "/home/yu/.virtualenvs/corcc_dev/lib/python3.5/site-packages/django/db/utils.py" in exit
- 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
- raise value.with_traceback(tb)
File "/home/yu/.virtualenvs/corcc_dev/lib/python3.5/site-packages/django/db/backends/utils.py" in execute
- 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.
Thanks for the detailed info! I've just pushed a fix to master that may solve your issue. Please let me know.
Works like a charm! Many thanks!
Just released 1.4.1!
On 22 August 2017 at 14:07, day009 notifications@github.com wrote:
Closed #214 https://github.com/etianen/django-watson/issues/214.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/etianen/django-watson/issues/214#event-1215873281, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJFCCt4xrHJuwySe8J3TAIoEp0UBzo6ks5satKOgaJpZM4O8tQA .
Hi! It works great except using filter:
Exception is:
Sorry if it is trivial issue.