BaseIndexer
This project rocks and uses MIT-LICENSE.
Steps to hook the base_indexer engine in your app
-
Generate new rails app
<em>rails new my_indexer_app<em>
*Edit Gemfile and add the base_indexer gem name _gem ‘base_indexer’_
-
Run bundle install to download the gem
_bundle install_
-
Mount the engine in your favorite domain.
_mount BaseIndexer::Engine, at: ‘/items’_
Basic configuration
The engine is looking for the following values
_config.solr_config_file_path = “#configconfig.root/config/solr.yml”_ _DiscoveryIndexer::PURL_DEFAULT=‘purl.stanford.edu/’_
Advanced features The engine gives the developer the ability to extend any of its classes
To extend any of indexer features (purl-reader, mods-reader, mapper, solr-writer)
-
Create a new class that inherits from BaseIndexer::MainIndexerEngine
-
Create a new file named config/initializers/base_indexer.rb
-
In this file, add the following line. replace ‘MyIndexerClassName’ with the fully qualifed actual class name. The name should be between double qoutes
BaseIndexer.indexer_class = “MyIndexerClassName”
-
In the new indexer class, you can override any of the functions that you need to change its implementation. For example, if you need to use a new mapper, you will override map function.
To extend mapper functionality.
-
Create a new class e.g., MyMapper that inherits from GeneralMapper or IndexMapper.
-
Implement MyMapper.map to converts the input to solr doc hash.
-
Override MyIndexerClassName.map to call your new class instead of the default one.