Hi Adam,
Everything you laid out is correct.  I"m sure you've already done this, but
looking at the existing components should be enlightening.
Because you have no UI, then your client side code should be pretty
simple.  All you should need to do is append your search parameter onto the
search url during initialization of the component.
Something like this:

                var queryObj = this.query();
>                 if(this.filter().length > 0){
>                     queryObj[componentName] = ko.toJSON(this.filter);
>                 } else {
>                     delete queryObj[componentName];
>                 }
>                 this.query(queryObj);

Of course you'll need to be able to `RestoreState` of the component from
the url itself, but examples of this are in our existing components.

You'll then need to handle for it on the backend.

Cheers,
Alexei



On Fri, Mar 13, 2020 at 12:04 PM Adam Cox <mr.adam...@gmail.com> wrote:

> Hello all,
>
> To migrate a project to arches 5, I need to reintegrate some custom search
> filters I had made in 4.4. The way search filters are implemented has been
> refactored in 5, so I could use a little guidance. The good thing is that I
> believe the way I have my custom filters set up will integrate well into
> the new pattern.
>
> From what I can tell, Arches 5 has individual search components that are
> registered in the database and whose logic is stored in arches/arches/app/
> search/*components*/. These components are typically linked to a knockout
> component which controls the UI (for the filters in my case, there will be
> no UI so hopefully that can be left blank). When a search is performed,
> these components are iterated and if one of them matches a filter that is
> included in the search request, then that filter is applied.
>
> Assuming all of that is correct, it seems like I would need to 1) create a
> new component (my_filter.py) and then register it. 2) inject a term into
> the request body behind the scenes (as I want the filter to apply to every
> search) which would activate the my_filter component.
>
> Any help with 1 or, especially, 2 would be appreciated. Of course, I would
> prefer to place this customization my own project and avoid changing
> anything in core Arches at all.
>
> Thanks,
> Adam
>
> --
> -- To post, send email to archesproject@googlegroups.com. To unsubscribe,
> send email to archesproject+unsubscr...@googlegroups.com. For more
> information, visit https://groups.google.com/d/forum/archesproject?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Arches Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to archesproject+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/archesproject/01d9e3b9-b2dd-41d7-bb80-89f725618b42%40googlegroups.com
> <https://groups.google.com/d/msgid/archesproject/01d9e3b9-b2dd-41d7-bb80-89f725618b42%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
-- To post, send email to archesproject@googlegroups.com. To unsubscribe, send 
email to archesproject+unsubscr...@googlegroups.com. For more information, 
visit https://groups.google.com/d/forum/archesproject?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Arches Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to archesproject+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/archesproject/CA%2BZLqy-GM%2B2-7tycOQEWti4w-3yt%2BEDf79OfG%3Dj%2BQt0oKGeFtA%40mail.gmail.com.

Reply via email to