ckan/ckanext-showcase

Both logic functions `showcase_package_list` and `package_showcase_list` fail regarding their solr queries in some cases

sabinem opened this issue · 1 comments

Expected behaviour:

The logic functions bring back the expectected related datasets for a showcase / showcases for a dataset

Observed Behaviour:

The package / showcase ids are found in these functions, but the solr query that they then form to get the data back from solr is malformed in case of more then one id:

The fq parameter is formed in the following way:

fq=id:id1 OR id2

correct lucene syntax would be:

fq=id:(id1 OR id2)

The following PRs solve this problem:

On Lucene syntax, see: https://lucene.apache.org/core/2_9_4/queryparsersyntax.html#Grouping

As I understand the docs, adding parentheses around field queries is supported but not necessary, and since we're forming the q parameter like this, they shouldn't make a difference:

q = id:id1 OR id:id2

However, since it is making a difference in some cases, we should obviously make this change (and you're right that it's more robust this way).