-
Notifications
You must be signed in to change notification settings - Fork 124
Custom Queries Development Pattern
In Valkyrie, Custom Queries are adapter-specific additions to standard Valkyrie Queries. They may only exist for one specific adapter. Reference: Custom Queries (Valkyrie documentation)
Hyrax provides a number of custom queries intended for use with its metadata adapter's query service (Hyrax.query_service
).
These queries are used throughout Hyrax's internals, so an implementation is required in order to use a new metadata adapter with Hyrax. For this reason, we provide default implementations of each of these queries that use only core Valkyrie queries. These implementations guarantee compatibility for all Valkyrie adapters that provide the core queries, but aren't intended to be high performance implementations. Hyrax may provide adapter specific implementations of these queries optimized for specific adapters (e.g. it does so for Wings
); when it does so, we consider that adapter "supported". Applications considering using an unsupported adapter should evaluate the custom query implementations with their own performance needs in mind and, if appropriate, implement their own versions of these queries.
Hyrax.custom_queries
is aliased to Valkyrie.config.metadata_adapter.query_service.custom_queries
for convenience.
code location | what happens there |
---|---|
lib/wings/setup.rb |
register custom queries in the wings metadata adapter (look for register_query_handler ) |
spec/spec_helper.rb |
register custom queries in other metadata adapters used for testing (look for register_query_handler ) |
`app/services/custom_queries/navigators/* | defines custom queries that help with navigating from one object in the model to a related object. These are non-adapter specific and should work with all metadata adapters. |
`app/services/custom_queries/* | defines additional custom queries. These are non-adapter specific and should work with all metadata adapters. |
`lib/wings/services/custom_queries/* | defines custom queries that are optimized for wings adapter |