Hi Alexei, thanks for the response on this, I think it's all the info I need to get started in earnest. Can I place the filter anywhere in my project and then register it from there? That would be great, as I (think) it would mean that I would only have to migrate the core Arches js file that holds the code you referenced (query object) to my project in order to edit it. Does that sound right? I will likely add a migration to my project so that the new filter is registered that way, instead of following the package loading pattern.
Thanks, Adam On Mon, Mar 16, 2020 at 2:18 PM Alexei Peters <[email protected]> wrote: > 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 <[email protected]> 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 [email protected]. To >> unsubscribe, send email to [email protected]. >> 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 [email protected]. >> 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 [email protected]. To unsubscribe, send email to [email protected]. 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/archesproject/CAGYBTatviNKnGAWqpYOPMUiibzfs0cpj9z6i2Tg-7kgndkn0tw%40mail.gmail.com.
