Class: BlacklightIiifSearch::IiifSearch

Inherits:
Object
  • Object
show all
Includes:
SearchBehavior
Defined in:
app/models/blacklight_iiif_search/iiif_search.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SearchBehavior

#object_relation_solr_params

Constructor Details

#initialize(params, iiif_search_config, parent_document) ⇒ IiifSearch

Returns a new instance of IiifSearch.

Parameters:

  • params (Hash)
  • iiif_search_config (Hash)
  • parent_document (SolrDocument)


12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/models/blacklight_iiif_search/iiif_search.rb', line 12

def initialize(params, iiif_search_config, parent_document)
  @id = params[:solr_document_id]
  @iiif_config = iiif_search_config
  @parent_document = parent_document
  @q = params[:q]
  @page = params[:page]
  @rows = 50

  # NOT IMPLEMENTED YET
  # @motivation = params[:motivation]
  # @date = params[:date]
  # @user = params[:user]
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'app/models/blacklight_iiif_search/iiif_search.rb', line 6

def id
  @id
end

#iiif_configObject (readonly)

Returns the value of attribute iiif_config.



6
7
8
# File 'app/models/blacklight_iiif_search/iiif_search.rb', line 6

def iiif_config
  @iiif_config
end

#pageObject (readonly)

Returns the value of attribute page.



6
7
8
# File 'app/models/blacklight_iiif_search/iiif_search.rb', line 6

def page
  @page
end

#parent_documentObject (readonly)

Returns the value of attribute parent_document.



6
7
8
# File 'app/models/blacklight_iiif_search/iiif_search.rb', line 6

def parent_document
  @parent_document
end

#qObject (readonly)

Returns the value of attribute q.



6
7
8
# File 'app/models/blacklight_iiif_search/iiif_search.rb', line 6

def q
  @q
end

#rowsObject (readonly)

Returns the value of attribute rows.



6
7
8
# File 'app/models/blacklight_iiif_search/iiif_search.rb', line 6

def rows
  @rows
end

Instance Method Details

#solr_paramsHash

return a hash of Solr search params if q is not supplied, have to pass some dummy params or else all records matching object_relation_solr_params are returned

Returns:

  • (Hash)


31
32
33
34
# File 'app/models/blacklight_iiif_search/iiif_search.rb', line 31

def solr_params
  return { q: 'nil:nil' } unless q
  { q: q, f: object_relation_solr_params, rows: rows, page: page }
end