Class: MartSearch::DataSource Abstract
- Inherits:
-
Object
- Object
- MartSearch::DataSource
- Includes:
- Utils
- Defined in:
- lib/martsearch/data_source.rb
Overview
Subclass and override #fetch_all_terms_for_indexing, #search to implement a custom DataSource class.
DataSource class for modelling a source for data.
Direct Known Subclasses
Instance Method Summary (collapse)
-
- (String) data_origin_url(query, conf)
abstract
Abstract method - Function to provide a link URL to the original datasource given a dataset query.
-
- (Hash) fetch_all_terms_for_indexing(conf)
abstract
Abstract method - Function to query a datasource and return all of the data terms to be indexed.
-
- (DataSource) initialize(conf)
constructor
A new instance of DataSource.
-
- (Boolean) is_alive?
abstract
Abstract method - simple heartbeat function to check that the datasource is online.
-
- (String) name
Helper function to return the 'internal_name' for this DataSource instance.
-
- (Array) search(query, conf)
abstract
Abstract method - Function to search a datasource given an appropriate configuration.
Methods included from Utils
#build_http_client, #convert_array_to_hash
Constructor Details
- (DataSource) initialize(conf)
A new instance of DataSource
16 17 18 19 |
# File 'lib/martsearch/data_source.rb', line 16 def initialize( conf ) @conf = conf @url = @conf[:url] end |
Instance Method Details
- (String) data_origin_url(query, conf)
Abstract method - Function to provide a link URL to the original datasource given a dataset query.
67 68 69 |
# File 'lib/martsearch/data_source.rb', line 67 def data_origin_url( query, conf ) raise_error end |
- (Hash) fetch_all_terms_for_indexing(conf)
Abstract method - Function to query a datasource and return all of the data terms to be indexed.
44 45 46 |
# File 'lib/martsearch/data_source.rb', line 44 def fetch_all_terms_for_indexing( conf ) raise_error end |
- (Boolean) is_alive?
Abstract method - simple heartbeat function to check that the datasource is online.
33 34 35 |
# File 'lib/martsearch/data_source.rb', line 33 def is_alive? raise_error end |
- (String) name
Helper function to return the 'internal_name' for this DataSource instance
24 25 26 |
# File 'lib/martsearch/data_source.rb', line 24 def name @conf[:internal_name] end |
- (Array) search(query, conf)
Abstract method - Function to search a datasource given an appropriate configuration.
55 56 57 |
# File 'lib/martsearch/data_source.rb', line 55 def search( query, conf ) raise_error end |