Closed frapell closed 3 years ago
In trying to understand the changes of PR #1132 I don't think that's how the __or
is intended to be used? According to the test, it seems the query is expected to be /db/guillotina/@search?__or=title%3DFirst item%26title%3DSecond item
However, I think it should be /db/guillotina/@search?title__or=First item,Second item
@bloodbare what do you think?
Any advice on where to fix this? I believe improving the process_compound_field method should be the way to go, what do you think?
I think this is the right place. Can you try if changing the L31-33 with this code solves the problem?
if isinstance(value, dict):
parsed_value = value.items()
else:
parsed_value = urllib.parse.parse_qsl(urllib.parse.unquote(value))
if not isinstance(parsed_value, list):
return None
@masipcat Yup, that works like a charm!
@masipcat Yup, that works like a charm!
Nice :) do you want to open a PR with this changes and if you don't mind, add a test for this case?
@masipcat Sure... How can I test against postgres? should I edit the TESTING_SETTINGS
manually?
Just set the env var DATABAES=postgres
:
$ DATABASE=postgres pytest guillotina/tests
you need to have docker installed and running. A pytest fixture will create the postgres container automatically
I've been trying to figure out how to fix this, and I can't quite make it... Searching by an attribute, like the title, works just fine
However searching by
SearchableText
failsWith the following Traceback
I believe this is related to this PR https://github.com/plone/guillotina/pull/1132 however trying guillotina from before that change also fails, but with a different Traceback
If I place a breakpoint in https://github.com/plone/guillotina/blob/master/guillotina/contrib/catalog/pg/parser.py#L50 I see
When searching using the
title
, however, when trying withSearchableText
I seeWhen using https://github.com/plone/guillotina-volto this looks like this
And
value
being adict
happens in https://github.com/plone/guillotina/blob/master/guillotina/catalog/parser.py#L25As you might have guessed, I am trying to fix the Search when using Volto + guillotina-volto, which uses
SearchableText
.Any advice on where to fix this? I believe improving the
process_compound_field
method should be the way to go, what do you think? https://github.com/plone/guillotina/blob/fb562308fb62e991560a8e6527353664ae3070ac/guillotina/contrib/catalog/pg/parser.py#L30-L44