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

Add solr search engine #30

Merged
merged 15 commits into from
Nov 1, 2023
Merged

Add solr search engine #30

merged 15 commits into from
Nov 1, 2023

Conversation

BlazingRockStorm
Copy link
Owner

@BlazingRockStorm BlazingRockStorm commented Oct 9, 2023

At this point we can access to the Solr admin console on the URL: http://localhost:8983. On this console go to the sidebar at the bottom, select the core development, and then select Schema. This action will change the view of the body. Here click on the Add Field button., and in the popup that will appear, fill the name field with "type", select the "String" option in the field type, and make sure that only the indexed and multiValued options are checked. Finally, click on the Add Field button at the bottom of the popup.

Copy link
Owner Author

@BlazingRockStorm BlazingRockStorm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# rake sunspot:solr:reindex
Skipping progress bar: for progress reporting, add gem 'progress_bar' to your Gemfile
rake aborted!
RSolr::Error::Http: RSolr::Error::Http - 400 Bad Request
Error: undefined field type

URI: http://solr:8983/solr/development/update?wt=json
Request Headers: {"Content-Type"=>"text/xml"}
Request Data: "<?xml version=\"1.0\" encoding=\"UTF-8\"?><delete><query>type:Album</query></delete>"

Backtrace: /usr/local/bundle/gems/rsolr-2.5.0/lib/rsolr/client.rb:220:in `rescue in execute'
/usr/local/bundle/gems/rsolr-2.5.0/lib/rsolr/client.rb:208:in `execute'
/usr/local/bundle/gems/rsolr-2.5.0/lib/rsolr/client.rb:203:in `send_and_receive'
/usr/local/bundle/gems/sunspot_rails-2.6.0/lib/sunspot/rails/solr_instrumentation.rb:16:in `block in send_and_receive_with_as_instrumentation'
/usr/local/bundle/gems/activesupport-7.0.5/lib/active_support/notifications.rb:206:in `block in instrument'
/usr/local/bundle/gems/activesupport-7.0.5/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/usr/local/bundle/gems/activesupport-7.0.5/lib/active_support/notifications.rb:206:in `instrument'
/usr/local/bundle/gems/sunspot_rails-2.6.0/lib/sunspot/rails/solr_instrumentation.rb:15:in `send_and_receive_with_as_instrumentation'
(eval):2:in `post'
/usr/local/bundle/gems/rsolr-2.5.0/lib/rsolr/client.rb:98:in `update'
/usr/local/bundle/gems/rsolr-2.5.0/lib/rsolr/client.rb:169:in `delete_by_query'
/usr/local/bundle/gems/rsolr-2.5.0/lib/rsolr/client.rb:220:in `rescue in execute'
/usr/local/bundle/gems/rsolr-2.5.0/lib/rsolr/client.rb:208:in `execute'
/usr/local/bundle/gems/rsolr-2.5.0/lib/rsolr/client.rb:203:in `send_and_receive'
/usr/local/bundle/gems/sunspot_rails-2.6.0/lib/sunspot/rails/solr_instrumentation.rb:16:in `block in send_and_receive_with_as_instrumentation'
/usr/local/bundle/gems/activesupport-7.0.5/lib/active_support/notifications.rb:206:in `block in instrument'
/usr/local/bundle/gems/activesupport-7.0.5/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/usr/local/bundle/gems/activesupport-7.0.5/lib/active_support/notifications.rb:206:in `instrument'
/usr/local/bundle/gems/sunspot_rails-2.6.0/lib/sunspot/rails/solr_instrumentation.rb:15:in `send_and_receive_with_as_instrumentation'
(eval):2:in `post'
/usr/local/bundle/gems/rsolr-2.5.0/lib/rsolr/client.rb:98:in `update'
/usr/local/bundle/gems/rsolr-2.5.0/lib/rsolr/client.rb:169:in `delete_by_query'
/usr/local/bundle/gems/sunspot-2.6.0/lib/sunspot/indexer.rb:83:in `remove_all'
/usr/local/bundle/gems/sunspot-2.6.0/lib/sunspot/session.rb:197:in `block in remove_all'
/usr/local/bundle/gems/sunspot-2.6.0/lib/sunspot/session.rb:197:in `each'
/usr/local/bundle/gems/sunspot-2.6.0/lib/sunspot/session.rb:197:in `remove_all'
/usr/local/bundle/gems/sunspot-2.6.0/lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `remove_all'
/usr/local/bundle/gems/sunspot-2.6.0/lib/sunspot/session_proxy/retry_5xx_session_proxy.rb:17:in `method_missing'
/usr/local/bundle/gems/sunspot-2.6.0/lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `remove_all'
/usr/local/bundle/gems/sunspot-2.6.0/lib/sunspot.rb:510:in `remove_all'
/usr/local/bundle/gems/sunspot_rails-2.6.0/lib/sunspot/rails/searchable.rb:196:in `solr_remove_all_from_index'
/usr/local/bundle/gems/sunspot_rails-2.6.0/lib/sunspot/rails/searchable.rb:215:in `solr_reindex'
/usr/local/bundle/gems/sunspot_rails-2.6.0/lib/sunspot/rails/tasks.rb:59:in `block (4 levels) in <main>'
/usr/local/bundle/gems/sunspot-2.6.0/lib/sunspot/class_set.rb:16:in `each'
/usr/local/bundle/gems/sunspot-2.6.0/lib/sunspot/class_set.rb:16:in `each'
/usr/local/bundle/gems/sunspot_rails-2.6.0/lib/sunspot/rails/tasks.rb:58:in `block (3 levels) in <main>'
/usr/local/bundle/gems/sunspot_rails-2.6.0/lib/sunspot/rails/tasks.rb:70:in `with_session'
/usr/local/bundle/gems/sunspot_rails-2.6.0/lib/sunspot/rails/tasks.rb:19:in `block (2 levels) in <main>'

Caused by:
Faraday::BadRequestError: the server responded with status 400
/usr/local/bundle/gems/faraday-2.7.11/lib/faraday/response/raise_error.rb:16:in `on_complete'
/usr/local/bundle/gems/faraday-2.7.11/lib/faraday/middleware.rb:18:in `block in call'
/usr/local/bundle/gems/faraday-2.7.11/lib/faraday/response.rb:42:in `on_complete'
/usr/local/bundle/gems/faraday-2.7.11/lib/faraday/middleware.rb:17:in `call'
/usr/local/bundle/gems/faraday-2.7.11/lib/faraday/rack_builder.rb:153:in `build_response'
/usr/local/bundle/gems/faraday-2.7.11/lib/faraday/connection.rb:444:in `run_request'
/usr/local/bundle/gems/faraday-2.7.11/lib/faraday/connection.rb:280:in `post'
/usr/local/bundle/gems/rsolr-2.5.0/lib/rsolr/client.rb:209:in `execute'
/usr/local/bundle/gems/rsolr-2.5.0/lib/rsolr/client.rb:203:in `send_and_receive'
/usr/local/bundle/gems/sunspot_rails-2.6.0/lib/sunspot/rails/solr_instrumentation.rb:16:in `block in send_and_receive_with_as_instrumentation'
/usr/local/bundle/gems/activesupport-7.0.5/lib/active_support/notifications.rb:206:in `block in instrument'
/usr/local/bundle/gems/activesupport-7.0.5/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/usr/local/bundle/gems/activesupport-7.0.5/lib/active_support/notifications.rb:206:in `instrument'
/usr/local/bundle/gems/sunspot_rails-2.6.0/lib/sunspot/rails/solr_instrumentation.rb:15:in `send_and_receive_with_as_instrumentation'
(eval):2:in `post'
/usr/local/bundle/gems/rsolr-2.5.0/lib/rsolr/client.rb:98:in `update'
/usr/local/bundle/gems/rsolr-2.5.0/lib/rsolr/client.rb:169:in `delete_by_query'
/usr/local/bundle/gems/sunspot-2.6.0/lib/sunspot/indexer.rb:83:in `remove_all'
/usr/local/bundle/gems/sunspot-2.6.0/lib/sunspot/session.rb:197:in `block in remove_all'
/usr/local/bundle/gems/sunspot-2.6.0/lib/sunspot/session.rb:197:in `each'
/usr/local/bundle/gems/sunspot-2.6.0/lib/sunspot/session.rb:197:in `remove_all'
/usr/local/bundle/gems/sunspot-2.6.0/lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `remove_all'
/usr/local/bundle/gems/sunspot-2.6.0/lib/sunspot/session_proxy/retry_5xx_session_proxy.rb:17:in `method_missing'
/usr/local/bundle/gems/sunspot-2.6.0/lib/sunspot/session_proxy/abstract_session_proxy.rb:11:in `remove_all'
/usr/local/bundle/gems/sunspot-2.6.0/lib/sunspot.rb:510:in `remove_all'
/usr/local/bundle/gems/sunspot_rails-2.6.0/lib/sunspot/rails/searchable.rb:196:in `solr_remove_all_from_index'
/usr/local/bundle/gems/sunspot_rails-2.6.0/lib/sunspot/rails/searchable.rb:215:in `solr_reindex'
/usr/local/bundle/gems/sunspot_rails-2.6.0/lib/sunspot/rails/tasks.rb:59:in `block (4 levels) in <main>'
/usr/local/bundle/gems/sunspot-2.6.0/lib/sunspot/class_set.rb:16:in `each'
/usr/local/bundle/gems/sunspot-2.6.0/lib/sunspot/class_set.rb:16:in `each'
/usr/local/bundle/gems/sunspot_rails-2.6.0/lib/sunspot/rails/tasks.rb:58:in `block (3 levels) in <main>'
/usr/local/bundle/gems/sunspot_rails-2.6.0/lib/sunspot/rails/tasks.rb:70:in `with_session'
/usr/local/bundle/gems/sunspot_rails-2.6.0/lib/sunspot/rails/tasks.rb:19:in `block (2 levels) in <main>'
Tasks: TOP => sunspot:solr:reindex => sunspot:reindex
(See full trace by running task with --trace)

@BlazingRockStorm
Copy link
Owner Author

At this point we can access to the Solr admin console on the URL: http://localhost:8983. On this console go to the sidebar at the bottom, select the core development, and then select Schema. This action will change the view of the body. Here click on the Add Field button., and in the popup that will appear, fill the name field with "type", select the "String" option in the field type, and make sure that only the indexed and multiValued options are checked. Finally, click on the Add Field button at the bottom of the popup.

Trong managed-schema của Solr không có field type nên xảy ra lỗi. Đã lưu riêng 1 cái managed-schema hỗ trợ

@BlazingRockStorm BlazingRockStorm merged commit d7948f7 into main Nov 1, 2023
1 check passed
@BlazingRockStorm BlazingRockStorm deleted the add-solr-search-engine branch November 1, 2023 03:57
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

Successfully merging this pull request may close these issues.

1 participant