Adding a Handler¶
Expanding the coverage of the facet scanner involves adding the dataset to the collection map and creating a new handler class.
Collection Map (
facet_scanner/collection_handlers/utils/collection_map.pyHandler Class (
facet_scanner/collection_handlers/.)
All handler classes should inherit from :doc:`api/collection_handlers`
This base class provides abstract methods and properties which must be implemented in order to successfully implement a new handler.
Check the MRO to make sure that all the required methods are present. You are free to create additional methods to aide in generating the facet content.
Collection Map¶
A Python dictionary which contains the mapping from path to collection handler.py
The key pairs are formed:
'/path/to/dataset: dict(handler='facet_scanner.collection_handlers.<handler_module>.<handler_class>')
The <module>.<handler_class> variables are substituted to match the new collection handler.
Handler Class¶
The handler class does all the work of extracting the facets from the specified files in the COLLECTION_MAP
All handler classes should inherit from the Collection Handlers
MRO¶
When the facet_scanner is run, the methods are called in the following order:
Facet Scanner CMD MRO¶
facet_scanner.scripts.facet_scanner_cmd.FacetExtractor.process_path
facet_scanner.core.facet_scanner.FacetScanner.get_handler
facet_scanner.collection_handlers.utils.facet_factory.FacetFactory.get_handler
facet_scanner.collection_handlers.base.CollectionHandler.export_facets
facets_scanner.core.elasticsearch_connection.ElasticsearchConnection.get_query
facets_scanner.core.elasticsearch_connection.ElasticsearchConnection.get_hits
facet_scanner.collection_handlers.base.CollectionHandler.lotus_submit
Lotus Facet Scanner MRO¶
facet_scanner.scripts.lotus_facet_scanner.LotusFacetScanner.process_path
facet_scanner.core.facet_scanner.FacetScanner.get_handler
facet_scanner.collection_handlers.utils.facet_factory.FacetFactory.get_handler
facet_scanner.collection_handlers.base.CollectionHandler.update_facets
facet_scanner.collection_handlers.base.CollectionHandler._facet_generator
facet_scanner.collection_handlers.base.CollectionHandler.get_facets