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

Solr integration #153

Open
etj opened this issue Feb 14, 2018 · 2 comments
Open

Solr integration #153

etj opened this issue Feb 14, 2018 · 2 comments

Comments

@etj
Copy link
Member

etj commented Feb 14, 2018

The code removed in this commit made the plugin compatible again vs solr 6.x.

Where does the code come from? Is it a backport from latest ckan? Is it needed for some special solr version?

@etj
Copy link
Member Author

etj commented Feb 14, 2018

The code does work with Solr 4.5.0 (for instnace on dcatapit.geo-solutions.it)

@cezio cezio added in progress and removed ready labels Feb 15, 2018
@cezio
Copy link
Contributor

cezio commented Feb 15, 2018

The change was because otherwise facet filtering from #87 and #86 wouldn't work correctly with ckan 2.5.7 + solr 7.0.

Solr uses OR operator for fields in fq as default. I found that ckan will prepend value of fq with capacity:"public" in https://github.com/ckan/ckan/blob/ckan-2.5.7/ckan/logic/action/get.py#L1920
causing whole query returning all datasets when used with facet search:

capacity:"public" organization_region:"sardegna" +dataset_type:dataset -dataset_type:harvest

which translates roughtly into

capacity:"public" OR organization_region:"sardegna" AND dataset_type:dataset NOT dataset_type:harvest

This will produce invalid query result, returning all datasets instead of one:

<?xml version="1.0" encoding="UTF-8"?>
<response>

<lst name="responseHeader">
  <int name="status">0</int>
  <int name="QTime">0</int>
  <lst name="params">
    <str name="q">*:*</str>
    <str name="fq">capacity:"public" organization_region:"sardegna" +dataset_type:dataset -dataset_type:harvest</str>
    <str name="_">1518709559156</str>
  </lst>
</lst>
<result name="response" numFound="251" start="0">

When my fix was in use, query was with additional +, so query params were joined with AND

capacity:"public" +organization_region:"sardegna" +dataset_type:dataset -dataset_type:harvest

capacity:"public" AND organization_region:"sardegna" AND dataset_type:dataset NOT dataset_type:harvest

<?xml version="1.0" encoding="UTF-8"?>
<response>

<lst name="responseHeader">
  <int name="status">0</int>
  <int name="QTime">0</int>
  <lst name="params">
    <str name="q">*:*</str>
    <str name="fq">capacity:"public" +organization_region:"sardegna" +dataset_type:dataset -dataset_type:harvest</str>
    <str name="_">1518709559156</str>
  </lst>
</lst>
<result name="response" numFound="1" start="0">

I'm not sure why this didn't work with solr 6.x. Do I understand correctly, my change is working correctly with solr 4.5? which ckan version you were using?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants