ckan / ckanext-showcase

A ckan extension to showcase datasets in use
GNU Affero General Public License v3.0
43 stars 77 forks source link

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

Closed sabinem closed 3 years ago

sabinem commented 3 years ago

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

bellisk commented 3 years ago

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).