Ruby 3 Rails 7 Solr 9 docker-compose无法重新索引

cgh8pdjw  于 2023-10-18  发布在  Solr
关注(0)|答案(1)|浏览(112)

在我的项目中,我遇到了Ruby 3 Rails 7 Solr 9(使用Sunspot gem)的重索引问题。
这是我的docker-compose.yml文件

version: '3'

services:
  db:
    image: postgres
    volumes:
      - ./tmp/db:/var/lib/postgresql/data
    environment:
      POSTGRES_PASSWORD: password

  solr:
    image: solr:9.3.0
    ports:
      - "8983:8983"
    volumes:
      - search-data:/opt/solr/server/solr/mycores
    entrypoint:
      - docker-entrypoint.sh
      - solr-precreate
      - development
    depends_on:
      - db

  app:
    build: .
    command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails assets:precompile && bundle exec rails s -p 3000 -b '0.0.0.0'"
    volumes:
      - .:/app
      - bundle:/usr/local/bundle
      - tmp-data:/app/tmp
      - public-data:/app/public
    ports:
      - "3000:3000"
    depends_on:
      - db
      - solr

volumes:
  bundle:
  tmp-data:
  public-data:
  search-data:

我的config/sunspot.yml

production:
  solr:
    hostname: solr
    solr_home: solr
    port: 8983
    log_level: WARNING
    path: /solr/production
    # read_timeout: 2
    # open_timeout: 0.5

development:
  solr:
    hostname: solr
    solr_home: solr
    port: 8983
    log_level: INFO
    path: /solr/development

test:
  solr:
    hostname: solr
    solr_home: solr
    port: 8983
    log_level: WARNING
    path: /solr/test

app容器中运行rake sunspot:solr:start时:

# rake sunspot:solr:start
rake aborted!
Sunspot::Solr::Server::JavaMissing: You need a Java Runtime Environment to run the Solr server
/usr/local/bundle/gems/sunspot_solr-2.6.0/lib/sunspot/solr/java.rb:11:in `ensure_install!'
/usr/local/bundle/gems/sunspot_solr-2.6.0/lib/sunspot/solr/server.rb:27:in `initialize'
/usr/local/bundle/gems/sunspot_solr-2.6.0/lib/sunspot/solr/tasks.rb:38:in `new'
/usr/local/bundle/gems/sunspot_solr-2.6.0/lib/sunspot/solr/tasks.rb:38:in `server'
/usr/local/bundle/gems/sunspot_solr-2.6.0/lib/sunspot/solr/tasks.rb:10:in `block (3 levels) in <main>'
Tasks: TOP => sunspot:solr:start
(See full trace by running task with --trace)

当我运行rake sunspot:solr:reindex

# rake sunspot:solr:reindex
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>"
...

谁能帮我补充一下我需要补充的内容?

v8wbuo2f

v8wbuo2f1#

错误消息清楚地表明,Java没有安装,而执行太阳能启动命令。

相关问题