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

GBL Harvest and Index - Fails due to solr_bboxtype__ fields #100

Closed
ewlarson opened this issue Feb 24, 2021 · 0 comments · Fixed by #101
Closed

GBL Harvest and Index - Fails due to solr_bboxtype__ fields #100

ewlarson opened this issue Feb 24, 2021 · 0 comments · Fixed by #101
Assignees

Comments

@ewlarson
Copy link
Contributor

Since GeoBlacklight v2.0.0, and the introduction of our bbox overlap ratio feature, Solr will automatically generate fields and values for these four coordinates:

  • solr_bboxtype__minX
  • solr_bboxtype__minY
  • solr_bboxtype__maxX
  • solr_bboxtype__maxY

These fields are returned during the GeoBlacklightHarvester's harvesting. But, you cannot pass these fields/values back into Solr during the index, without seeing Solr errors like:

RSolr::Error::Http (RSolr::Error::Http - 400 Bad Request)
Error: {
  "responseHeader":{
    "status":400,
    "QTime":869},
  "error":{
    "metadata":[
      "error-class","org.apache.solr.common.SolrException",
      "root-error-class","java.lang.IllegalArgumentException"],
    "msg":"Exception writing document id stanford-cg357zz0321 to the index; possible analysis error: DocValuesField \"solr_bboxtype__minX\" appears more than once in this document (only one value is allowed per field)",
    "code":400}}

The fix is simple. We just need to delete these fields via the document_transformer.

      def document_transformer
        @document_transformer || ->(document) do
          document.delete('_version_')
          document.delete('score')
          document.delete('timestamp')
          document.delete('solr_bboxtype__minX')
          document.delete('solr_bboxtype__minY')
          document.delete('solr_bboxtype__maxX')
          document.delete('solr_bboxtype__maxY')
          document
        end
      end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant