Class: Hyrax::Dashboard::NestedCollectionsSearchBuilder
- Inherits:
-
CollectionSearchBuilder
- Object
- SearchBuilder
- CollectionSearchBuilder
- Hyrax::Dashboard::NestedCollectionsSearchBuilder
- Defined in:
- app/search_builders/hyrax/dashboard/nested_collections_search_builder.rb
Overview
Responsible for searching for collections of the same type that are not the given collection
Instance Attribute Summary collapse
-
#discovery_permissions ⇒ Object
readonly
Override for Hydra::AccessControlsEnforcement.
Attributes inherited from CollectionSearchBuilder
Instance Method Summary collapse
-
#initialize(access:, collection:, scope:, nest_direction:) ⇒ NestedCollectionsSearchBuilder
constructor
A new instance of NestedCollectionsSearchBuilder.
-
#show_only_other_collections_of_the_same_collection_type(solr_parameters) ⇒ Object
Solr can do graph traversal without the need of special indexing with the Graph query parser so use this to compute both the parents and children of the current collection then exclude them See solr.apache.org/guide/solr/latest/query-guide/other-parsers.html#graph-query-parser.
- #with_pagination(solr_parameters) ⇒ Object
Methods inherited from CollectionSearchBuilder
#add_sorting_to_solr, #gated_discovery_filters, #models, #sort_field, #with_access
Methods included from FilterByType
Constructor Details
#initialize(access:, collection:, scope:, nest_direction:) ⇒ NestedCollectionsSearchBuilder
Returns a new instance of NestedCollectionsSearchBuilder.
10 11 12 13 14 15 |
# File 'app/search_builders/hyrax/dashboard/nested_collections_search_builder.rb', line 10 def initialize(access:, collection:, scope:, nest_direction:) super(scope) @collection = collection @discovery_permissions = (access) @nest_direction = nest_direction end |
Instance Attribute Details
#discovery_permissions ⇒ Object (readonly)
Override for Hydra::AccessControlsEnforcement
18 19 20 |
# File 'app/search_builders/hyrax/dashboard/nested_collections_search_builder.rb', line 18 def @discovery_permissions end |
Instance Method Details
#show_only_other_collections_of_the_same_collection_type(solr_parameters) ⇒ Object
Solr can do graph traversal without the need of special indexing with the Graph query parser so use this to compute both the parents and children of the current collection then exclude them See solr.apache.org/guide/solr/latest/query-guide/other-parsers.html#graph-query-parser
28 29 30 31 32 33 34 35 |
# File 'app/search_builders/hyrax/dashboard/nested_collections_search_builder.rb', line 28 def show_only_other_collections_of_the_same_collection_type(solr_parameters) solr_parameters[:fq] ||= [] solr_parameters[:fq] += [ Hyrax::SolrQueryBuilderService.construct_query(Hyrax.config.collection_type_index_field => @collection.collection_type_gid), "-{!graph from=id to=member_of_collection_ids_ssim#{' maxDepth=1' if @nest_direction == :as_parent}}id:#{@collection.id}", "-{!graph to=id from=member_of_collection_ids_ssim#{' maxDepth=1' if @nest_direction == :as_child}}id:#{@collection.id}" ] end |
#with_pagination(solr_parameters) ⇒ Object
21 22 23 |
# File 'app/search_builders/hyrax/dashboard/nested_collections_search_builder.rb', line 21 def with_pagination(solr_parameters) solr_parameters[:rows] = 1000 end |