Does the `archiveFilters` interface support retrieving filtering conditions based on a specified category ID?

Calendar 👁️ 62

When using AnQi CMS for website content management, flexibly obtaining and displaying filter conditions is a key factor in improving user experience. Many friends are usingarchiveFiltersAt the interface, you may be curious whether it supports filtering conditions based on a specified category ID to provide more precise filtering options for different categories.Today, let's delve deeply into this issue.

By consulting AnQi CMS'sarchiveFiltersInterface document, we can clearly see the design intention and functional scope of the interface.archiveFiltersThe interface is mainly used to obtain the parameter filtering conditions of the document model. In its list of request parameters, we only found one namedmoduleIdThe field is required. This means that when you call this interface, you must provide a model ID, such as the article model (moduleId=1) or the product model (moduleId=2), and then it will return all the configured custom fields and their options under the model.

Therefore, the direct answer is:archiveFiltersThe interface does not support passing the category ID directlycategoryId) to get the filtering conditions for the category.The design approach is based on 'model' to define filtering fields, rather than 'category'.The logic behind this is that custom filter fields are usually bound to content models, for example, a "product" model may have "color", "size", "brand" and other filter fields, which are attributes that all products under the model (regardless of which subcategory they belong to) may have.

So, does this mean we cannot provide filtering functionality under a specific category? Of course not. Anqi CMS provides very flexible interface combination capabilities. AlthougharchiveFiltersIt does not directly support category ID, but we can achieve similar requirements by combining other interfaces.

Generally, you would first go througharchiveFiltersto get a certain interfacemoduleIdAll available filter options. These conditions, such as "city", "education", etc., are global options for this model.When a user enters a specific category page, such as the "Industry News" category under "News Dynamics", the filter displayed on the frontend is still based on the entire "article" model (i.e., moduleId).After the user selects specific conditions in these filters, you can usearchiveListThe interface to retrieve the document list that meets the conditions and belongs to the specific category.

archiveListThe interface is a powerful interface that supports passing in.categoryIdParameters to specify which category of documents to retrieve. It also supports passing througharchiveFiltersCustom filter parameters obtained. For example, you arearchiveFiltersGet the 'city' filter field, the user selected 'Beijing' in the 'Industry News' category. Then, when you callarchiveListyou can pass in at the same timecategoryId=行业新闻的IDandcity=北京So you can accurately obtain all documents about "Beijing" under the "Industry News" category.

In short,archiveFiltersWe provide all the filtering dimensions that a certain content model may have, andarchiveListIt is responsible for associating these filtering dimensions with specific classification content and for retrieval. When used together, they can build a user-friendly content display page that allows for filtering within categories.


Frequently Asked Questions (FAQ)

Q1: WhyarchiveFiltersThe interface does not providecategoryIdParameters to directly obtain the filtering conditions under the category?

A1:archiveFiltersThe interface design is based on the content "model" to define the filtering conditions.This means that filter fields (such as "color", "size") are usually attributes that all content under the model may have, rather than specifying a particular category.The Anqi CMS associates custom field configurations with models, ensuring the consistency and maintainability of filtering logic.

Q2: How to implement only displaying the available filtering conditions under a specific category in Anqi CMS?

A2: BecausearchiveFiltersThe interface returns all the filtering conditions under the model, you can process it on the front-end application level. First, you need to go throughmoduleIdRetrieve all filter conditions. Then, when the user visits a specific category, you can usearchiveListThe interface combines the category ID and filtering conditions to display content. If some filtering conditions do not have corresponding documents under this category,archiveListThe return result will naturally manifest. More refined control may require configuration of custom fields at the time of content publication to ensure that only relevant content is tagged with specific filtering labels.

Q3: How should I configure AnQi CMS if I need completely different filtering dimensions for different categories?

A3: If the filtering dimensions of different categories are so vastly different that they cannot share the same custom fields under a single model, you may need to consider creating different content models. Each content model can define a set of independent custom fields, which will becomearchiveFiltersThe interface returns the filtering conditions for the model. For example, if you have a “news” model and a “product” model, they will have their own sets of filtering conditions.

Related articles

In what scenario should `archiveFilters` be used instead of `archiveParams`?

During the development and content management of Anqi CMS, we often need to obtain relevant information about documents (Archive).Among them, `archiveFilters` and `archiveParams` are two API interfaces closely related to custom fields, but their design purposes and application scenarios are different.Understanding the difference between them can help us build website features more efficiently and enhance the user experience.First, let's briefly understand the core functions of these two interfaces.

2025-11-09

What is the difference between the interface for getting document parameters (`archiveParams`) and the interface for getting document parameter filtering conditions (`archiveFilters`)?

When using AnQiCMS for website content management, we often need to deal with document-related API interfaces.Among them, the interface names `archiveParams` and `archiveFilters` sound similar at first glance, and they are both related to Understanding the differences between them can help us develop and manage websites more efficiently.

2025-11-09

How to configure custom fields in Anqi CMS so that they can be used as filter conditions?

In AnQi CMS, configuring custom fields as filter conditions is a very practical feature to make your website content more dynamic and interactive.It can help users quickly find the content they need based on specific attributes, thereby significantly improving the user experience of the website.Next, let's learn how to implement this feature in AnQi CMS. ### Custom Field: The "Alive" Tag of Content Firstly, we need to understand what a custom field is.

2025-11-09

How to apply the filtering conditions obtained from the `archiveFilters` to the `archiveList` interface for document filtering?

In AnQi CMS, implementing the dynamic filtering function of documents is a key step to improve the user experience of the website.This usually involves close collaboration between two core interfaces: `archiveFilters` is used to obtain available filtering conditions, while `archiveList` is responsible for retrieving and displaying the corresponding document list based on these conditions.A deep understanding of how they work together can help us build flexible and user-friendly content filtering mechanisms for websites.### Understanding the Filtering Mechanism: From Definition to Discovery Imagine that your website has published a large number of articles

2025-11-09

What would the `archiveFilters` interface return if a document model does not have filterable custom fields?

In Anqi CMS, the `archiveFilters` interface is a very practical feature that allows us to retrieve the filtering conditions of specific document models, thereby helping users to implement flexible content filtering on the front-end page.For example, on a product display page, we may need to filter products based on attributes such as 'color', 'size', or 'brand'. What if a document model is exactly configured without any filterable custom fields, what will the `archiveFilters` interface return?

2025-11-09

How to properly handle the error codes returned by the `archiveFilters` interface (such as -1, 1001, 1002)?

During the operation and development of the website, we often use various API interfaces provided by Anqi CMS to dynamically obtain and display content.Among them, the `archiveFilters` interface plays an important role, helping us to obtain the document filtering conditions, thus providing users with a more refined content browsing experience.However, correctly handling the error codes returned by any API is crucial to ensure the stable operation of the website and a smooth user experience.

2025-11-09

Does the `archiveFilters` interface require user login authorization to access?

In the daily application of Anqi CMS, the `archiveFilters` interface is an important tool for dynamically displaying filter conditions on the front-end page. It allows the website to generate various filter options based on the field configuration of the article model, such as "city", "education", and so on.It is crucial for building a user-friendly content browsing experience, where users can quickly locate content of interest through these filtering conditions.However, many developers may have a question when integrating: does this interface require user login authorization to access?To answer this question

2025-11-09

How to dynamically build a frontend filtering UI based on the response of `archiveFilters`, such as dropdown menus or checkboxes?

In today's increasingly rich content of websites, how to allow users to quickly find the information they are interested in is a crucial operational issue.AnQiCMS provides powerful content management capabilities, and its API interface provides a solid foundation for front-end developers to build flexible and varied interactive interfaces.Today, let's delve into how to use the response data from the `archiveFilters` interface to dynamically build front-end filtering UI, such as common dropdown menus or checkboxes.The value of dynamic filtering interface Imagine that

2025-11-09