Scoped-search on ext_method

I would like to provide auto-complete on “digest” for docker tags. This is not a column, though, so have an ext_method to get the values. The auto-complete code tries to get a column, which doesn’t exist. Is this a bug or a mistake on my part?

https://github.com/Katello/katello/compare/master...thomasmckay:22501-digest-search

I think this will work:

I don’t think I’ll be able to do this w/o changes in scoped-search. Where is the best place to open an RFE and get assistance in getting changes in?

Scoped search has always been receptive to PR’s from the Foreman community, just open a PR or issue. https://github.com/wvanbergen/scoped_search/

Where are you trying to auto-complete? There’s some stuff for plugins allowing you to override the default auto complete route:

https://projects.theforeman.org/projects/foreman/wiki/How_to_Create_a_Plugin#Specifying-alternate-auto-complete-path-for-Role-Filters

I’m not sure if that will work for what you need.

Thanks! I’ll check out the docs. I’d be glad to submit a PR… but probably
need some guidance on what/where/how.

You could override complete_for for the specific model and check if it starts with the field you are searching on or not and then either defer to super or take other action, but keep in mind there may be more then one search clause that needs to be handled.
I would be weary of adding autocomplete (or even searching) on fields that aren’t in the database though, as that is what scoped search is designed for. Perhaps it would be best, if possible, to define additional relations between the different models, so that scoped search can be used for searching in the relation using its default methods.