Skip to content

SOLR Documentation

Thomas Scherz edited this page Mar 15, 2023 · 40 revisions

SOLR 8 Guide :

https://solr.apache.org/guide/8_11/about-this-guide.html

SOLR 8 Configuration : /var/solr

solr.xml

https://solr.apache.org/guide/8_11/format-of-solr-xml.html

core.properties

https://solr.apache.org/guide/8_11/defining-core-properties.html

log4j.properties :

https://solr.apache.org/guide/8_11/configuring-logging.html

solrconfg.xml :

https://solr.apache.org/guide/8_11/configuring-solrconfig-xml.html

schema.xml :

https://solr.apache.org/guide/8_11/overview-of-documents-fields-and-schema-design.html

Admin Web interface

https://solr.apache.org/guide/8_11/overview-of-the-solr-admin-ui.html

Blacklight Integration

https://github.com/projectblacklight/blacklight/wiki/Indexing-your-data-into-solr

class MyModel < ActiveRecord::Base
      after_save :index_record
      before_destroy :remove_from_index

      attr_accessible :field_i_want_to_index

      def to_solr
        # *_texts here is a dynamic field type specified in solrconfig.xml
        {'id' => id,
         'field_i_want_to_index_texts' => field_i_want_to_index}
      end

      def index_record
        SolrService.add(self.to_solr)
        SolrService.commit
      end

      def remove_from_index
        SolrService.delete_by_id(self.id)
        SolrService.commit
      end
    end

Catalog Controller

https://github.com/projectblacklight/blacklight/wiki/Configuration---Solr-fields

Steps to Update

  1. Set a FREEZE on Scholar content.
  2. Deploy cap deploy prod
  3. Login into Web Server
  4. Change Login Route /login /error (both web servers)
  5. Run rake hyrax:count RAILS_ENV=Production to get a count of all works in each work type.
  6. Run rake scholar:pidsout RAILS_ENV=Production
  7. Login into Solr Server 

  8. As the root user, stop solr with service solr stop

  9. Back up /var/solr to ... tar -cvf solr.tar solr
  10. CD /opt
  11. Delete the existing /opt/solr symlink... rm solr

  12. Download solr-8.11.1.tgz from https://solr.apache.org/downloads.html

  13. Uncompress solr-8.11.1.tgz to /opt/solr-8.11.1

  14. Create a new symlink for /opt/solr-8.11.1 to /opt/solr.... ln -s solr-8.11.1 solr
  15. As the root user, start solo with service solr start
  16. Delete everything from SOLR using the CURL command
  17. curl http://localhost:8983/solr/collection1/update?commit=true -H "Content-Type: text/xml" --data-binary ':'

  18. Login into Web Server

  19. bundle exec rails console production on web server

  20. Run solr reindex (ActiveFedora::Base.reindex_everything)
  21. If reindex doesn’t run than you need to create a new core on solr with the existing name pointing to the correct xml files
  22. If there is anything wrong with the results, then run rake scholar:resave
  23. Run rake hyrax:count to get a count of all works in each work type and compare results.
  24. Confirm upgrade was successful and release the FREEZE.

Steps to ReIndex

  • Connect to DTS Jump Server.
  • Use tmux to connect to web server.
  • bundle exec rails console production
  • ActiveFedora::Base.reindex_everything

Steps to Configure

  • On the mysql server : /etc/my.cnf.d/mariadb-server.cnf and under the [mysqld] section add max_allowed_packet=128M restart mysqld service

  • On the mysql server : /etc/my.cnf.d/mariadb-server.cnf and under the [mysqld] section add wait_timeout=XXXX restart mysqld service

  • On the SOLR server : Add more RAM from 6 GB to 12 GB

  • On the SOLR server : Increase the HEAP size from 4GB to 10GB.

  • Update the HEAP Memory in the in /etc/default/solr.in.sh

  • SOLR_JAVA_MEM="-Xms4000m -Xmx4000m"

  • SOLR_JAVA_MEM="-Xms10000m -Xmx10000m"

  • RECOMMEND 8000m - 16000m

  • https://solr.apache.org/guide/8_11/jvm-settings.html

  • On the SOLR server : /etc/default/solr.in.sh

  • open file limit to 65000

  • max processes limit to 65000

  • GC_TUNE="-XX:-UseLargePages" JVM /etc/default/solr.in.sh

Tutorials