Skip to content

Custom Queries Development Pattern

hackartisan edited this page Mar 8, 2022 · 4 revisions

Introduction

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)

In Hyrax

In Hyrax, there are global custom queries registered directly to the Hyrax configuration object and therefore acccessible through Hyrax.custom_queries. These use existing Valkyrie queries to provide functionality commonly used throughout a Hyrax app.

Code Locations

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
Clone this wiki locally