Query suggestions from metadata field search

Is it possible to use the query suggestion library ‘padre-qs.cgi’ but confining to a specific metadata class, potentially not indexed?

E.g. in the normal search I can pass in something like ‘a:my_val’ to search within metadata class ‘a’ only. Can we do similar with padre-qs?

Thanks

Hi quimby -

I’d recommend using the /s/suggest.json endpoint for auto-suggestions, rather than accessing padre-qs.cgi.

Calls to suggest.json can’t be directly scoped to a metadata field, but they can be scoped to a profile within a collection, allowing you to create a separate source from all metadata values in a given field.

To use suggest.json in this way, some workflow will be required:

  1. In the base collection, create a metadata facet for the field of interest
  2. In your query processor options, set the results_in_facet_categories to a large value (>1000)
  3. Create a stripped-back template (e.g. auto-completion.ftl) to ONLY show the outputs of the facet categories, outputting in format that conforms to the auto-completion.csv syntax, setting the form type to respond as a CSV mimetype.
  4. In the base collection, create a new post-index workflow step to save the outputs of this form as CSV in a dedicated profile (e.g. $SEARCH_HOME/conf/COLLECTION/METACLASS/auto-suggestion.csv)

During the next collection index, you’ll now have the following additional auto-suggestion endpoints to draw from:

  1. /s/suggest.json?collection=COLLECTION&fmt=json++&profile=default&partialquery=PARTIAL
  2. /s/suggest.json?collection=COLLECTION&fmt=json++&profile=METACLASS&partial_query=PARTIAL

Alternatively, if you’re happy to blend organic suggestions and structured suggestions into the base collection’s suggest.json responses, set a ‘Category’ value in the CSV output for each field you’re wanting to source. You could then re-use the workflow to output multiple lists in the base collection config folder ($SEARCH_HOME/conf/COLLECTION/auto-suggestion-METACLASS.csv). Update your collection.cfg file to specify these additional CSV sources, and a reindex will give you a blended suggest.json endpoint.

That said, suggest.json defaults to sourcing it’s suggestions from: