There are many ways to do this, but I’ll try to answer this briefly with a summary of how I would do it:
Assuming that this filtering is done in an Enonic XP part, and the filtered articles are only to be displayed in that part and not to be queried from elsewhere, then I would not bother to create a service. I would just do a client-side Ajax GET request to the same part (use
This way, the part sort of becomes its own service. There is however nothing wrong with creating a separate service for this, and the logic would mostly be the same. You just substitute
serviceUrl() so that the URL to the Ajax call is something else. So it’s really more a question of how you want to organize your code, and if you plan for your article query to be used by something else in your application (or external integrations) other than this specific article-list part.
Do you want me to dive more into the specifics of any of the steps I mentioned above?