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

Contributor type facet check indexing logic #123

Open
ghost opened this issue Dec 5, 2018 · 0 comments
Open

Contributor type facet check indexing logic #123

ghost opened this issue Dec 5, 2018 · 0 comments

Comments

@ghost
Copy link

ghost commented Dec 5, 2018

Current method in DogBiscuits::IndexesCommon:

# Index different contributor types (relators, eg. editor, advisor) into contributor
    # Index the contributor type itself
    def solr_doc_for_contributors(solr_doc)
      if respond_to? :contributors_to_index
        contributors_to_index.each do |v|
          labels = object.send(v).to_a
          # If there is anything in the solr_doc, add to it
          if solr_doc["contributor_combined_tesim"]
            solr_doc[ActiveFedora.index_field_mapper.solr_name("contributor_combined", :stored_searchable)].push(*labels).uniq!
            solr_doc[ActiveFedora.index_field_mapper.solr_name("contributor_combined", :facetable)].push(*labels).uniq!
          else
            solr_doc[ActiveFedora.index_field_mapper.solr_name("contributor_combined", :stored_searchable)] = labels
            solr_doc[ActiveFedora.index_field_mapper.solr_name("contributor_combined", :facetable)] = labels
          end
          # @todo I don't think the logic is quite right here as there will only ever be one result
          labels.each do |_label|
            if solr_doc['contributor_type_sim']
              solr_doc[ActiveFedora.index_field_mapper.solr_name("contributor_type", :facetable)] << v
            else
              solr_doc[ActiveFedora.index_field_mapper.solr_name("contributor_type", :facetable)] = [v]
            end
          end
        end
      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
Development

No branches or pull requests

0 participants