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

Incorrect Solr URI #2177

Open
laritakr opened this issue Apr 4, 2024 · 0 comments
Open

Incorrect Solr URI #2177

laritakr opened this issue Apr 4, 2024 · 0 comments
Labels

Comments

@laritakr
Copy link
Collaborator

laritakr commented Apr 4, 2024

Descriptive summary

Screenshot 2024-04-04 at 3 26 52 PM

The issue appears to originate in Hyrax's post method. This method calls Hyrax's connection definition. As use_valkyrie is true, we aren't getting the correct connection url.

    # Wraps rsolr post
    # @return [Hash] the hash straight form rsolr
    def post(query = nil, **args)
      # Make Hyrax.config.solr_select_path the default SOLR path
      solr_path = args.delete(:path) || Hyrax.config.solr_select_path
      args = args.merge(additional_solr_get_and_post_params.merge(q: query)) if query.present?
      connection.post(solr_path, data: args)
    end
    def connection
      return self.class.instance.conn unless use_valkyrie
      valkyrie_index.connection
    end
(byebug) valkyrie_index
#<Valkyrie::Indexing::Solr::IndexingAdapter:0x0000ffff800b3850 @connection=#<RSolr::Client:0x0000ffff6314df30 @uri=#<URI::HTTP http://solr:SolrRocks@solr:8983/solr/hyrax-valkyrie/>, @proxy=nil, @connection=nil, @update_format=RSolr::JSON::Generator, @update_path="update", @options={:url=>"http://solr:SolrRocks@solr:8983/solr/hyrax-valkyrie"}>>
(byebug) use_valkyrie
true
(byebug) self.class.instance.conn
DEPRECATION WARNING: Calls to Hyrax::SolrService.instance are deprecated and support will be removed from Hyrax 4.0. Use methods in Hyrax::SolrService instead. (called from instance at /app/samvera/hyrax-webapp/vendor/gems/hyrax/app/services/hyrax/solr_service.rb:56)
#<RSolr::Client:0x0000ffff7792db10 @uri=#<URI::HTTP http://solr:SolrRocks@solr:8983/solr/fca34cf3-87f3-4056-9678-23b7a108e5ae/>, @proxy=nil, @connection=nil, @update_format=RSolr::JSON::Generator, @update_path="update", @options={"timeout"=>120, "open_timeout"=>120, "url"=>"http://solr:SolrRocks@solr:8983/solr/fca34cf3-87f3-4056-9678-23b7a108e5ae", "collection"=>"fca34cf3-87f3-4056-9678-23b7a108e5ae", "core"=>"fca34cf3-87f3-4056-9678-23b7a108e5ae"}>

Related work

Prior attempt at fixing the issue does not work and should probably be removed:

# Because of code in Valkyrie::Indexing::Solr::IndexingAdapter we may want
# to include the 'core' key in this hash.
#
# https://github.com/samvera/hyrax/blob/a5a0ae9e56df857a92fc53ae86216cbb007db47a/lib/valkyrie/indexing/solr/indexing_adapter.rb#L83-L101
base_options['core'] ||= switchable_options['collection']

@laritakr laritakr added the bug label Apr 4, 2024
laritakr added a commit that referenced this issue Apr 5, 2024
laritakr added a commit that referenced this issue Apr 5, 2024
* Fix solr endpoint default issue

#2177

* Fix spec
laritakr added a commit that referenced this issue Apr 8, 2024
* Fix solr endpoint default issue

#2177

* Fix spec

* Override default connection

Ideally we probably need to define our own valkyrie indexing adapter, but
this should work as a temporary fix.
laritakr added a commit that referenced this issue Apr 12, 2024
laritakr added a commit that referenced this issue Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant