How to combine the filtering conditions obtained from `archiveFilters.md` and apply them to the custom filtering parameters of `archive/list`?

Calendar 👁️ 71

In Anqi CMS, efficiently managing and displaying website content is the key to improving user experience.When the amount of content grows, it is particularly important to provide flexible filtering functions to help visitors quickly find the information they need.Strong API interface support provided by AnQi CMS, through the clever combination ofarchive/filtersThe interface retrieves the filtering conditions and applies themarchive/listIn the custom filtering parameters of the interface, we can build a highly practical content filtering function

Understanding the filtering mechanism of Anqi CMS

The document filtering capability of Anqi CMS is mainly reflected in the collaborative work of two core API interfaces: one is used forDiscoveravailable filtering conditions on the website (/api/archive/filters), and the other isapplyThese conditions are used to obtain a specific document list (/api/archive/listThere is a close connection between these two, we usually first understand through the first interface which dimensions are available for filtering in the current content model, and then convert the user's selection into parameters that the second interface can recognize, so as to accurately extract the required content.

An extremely important parameter when using these two interfaces isModel ID(moduleId)In Anqi CMS, different content types (such as articles, products, cases, etc.) correspond to a specific content model, and each model may have unique filtering fields.Therefore, defining which model's documents you want to filter is the first step before performing any filtering operation.

Get the available filtering conditions (/api/archive/filters)

Imagine that you are designing a filter for your product display page, where users can search for related products by 'city' or 'education'. At this point, you need to know the 'product' model provided by Anqi CMS (assuming itsmoduleIdAre you 1) configured which fields and options are available for filtering.

By calling/api/archive/filtersthe interface, and passing the fields you are interested in.moduleIdyou can get a detailed list of filtering conditions. For example, request{域名地址}/api/archive/filters?moduleId=1The data structure returned will tell you which filters (such as "City", "Education") are available under the current model, as well as their correspondingfield namingfield_name)and all optional onesParameter options(items.label).

This data is crucial, it is like a "map" of the filtering function. Among them,field_nameIs the unique identifier for each filtering condition in the backend system, and it is also the key name we will use to construct query parameters.itemsin the array,labelField, which is the specific option displayed to the user on the front end, such as 'Beijing', 'Shanghai', or 'Master', 'Bachelor' and so on.

Apply filter conditions to get the document list (/api/archive/list)

Now we know which dimensions we can filter by, the next step is how to convert the user's selection into an actual query request and submit it to/api/archive/listInterface. This interface is responsible for returning a list of documents that meet the specified parameters.

/api/archive/listThe interface not only supports conventionalmoduleId/categoryId/page/limit/q(Search keywords) and other parameters, what is even more powerful is that it allows you to addCustom Filter Parameter. These custom parameter names are exactly what we get from/api/archive/filtersthe interfacefield_name.

For example, if/api/archive/filterstells us that there is afield_nameWithcityThe filter, and it has options like 'Beijing', 'Shanghai', etc. When the user selects 'Beijing', we can send a query parameter to/api/archive/listthe interface in the form ofcity=北京. The complete API call would look like this:{域名地址}/api/archive/list?moduleId=1&type=page&city=北京.

If a user selects multiple filter conditions at the same time, such as searching for documents in "Beijing" and filtering for a bachelor's degree, then we just need to overlay these filter parameters in the form of a URL Query String:{域名地址}/api/archive/list?moduleId=1&type=page&city=北京&certificate=本科Please note, in order to enable the filter function and get the total number,typethe parameters are usually set to,page.

In addition, you can combine other parameters to further optimize the results, such as usingorderParameter specifies the sorting method (such asorder=views descSort by view count in descending order), or useqParameter for keyword search, all of which can be seamlessly integrated with custom filter parameters.

The actual operation steps and front-end implementation ideas

In order to better understand the entire process, let's sort out how to build a dynamic content filtering function in actual development using these two interfaces:

  1. Step 1: Clarify the target modelWhen your page or component loads, first determine which document model's content you want to filter and retrieve its

Related articles

How to determine the visibility or review status of the document from the `archive/list` interface?

In AnQi CMS, one of the core aspects of content management is the control of document status, which directly relates to the visibility and review process of website content.When you retrieve the document list through the `archive/list` interface, the `status` field in the returned data assumes this critical responsibility.Understanding the meaning of this field can help you manage website content more efficiently and ensure that information is presented correctly to visitors.### `status` field

2025-11-09

Is the `created_time` and `updated_time` returned by the AnQiCMS document list a Unix timestamp, and how do I convert it to a readable date?

When using AnQiCMS, we often retrieve detailed information or lists of documents or other content from the API interface.In these returned data, `created_time` (creation time) and `updated_time` (update time) are two very critical fields.Many users may be curious, what are these values that look like a string of numbers?They are actually standard Unix timestamps. ### Understanding Unix Timestamps Unix timestamp, also known as Posix time

2025-11-09

How to use the `type=related` mode in the AnQiCMS document list interface to get related articles?

In website content operation, providing users with relevant article recommendations is an important strategy to enhance user experience, extend visit duration, and optimize content discovery.The AnqiCMS document list interface (`archive/list`) provides a very convenient feature, which can be easily achieved by setting the `type=related` parameter.### Understanding the `type=related` mode After a user has finished browsing a document (article, product, etc.), they usually want to find more information that is thematically similar and complementary to the current content.

2025-11-09

How to build pagination navigation for AnQiCMS document list on the front-end page (using `page` and `total` parameters)?

When displaying a large number of documents on the website frontend, pagination navigation is a key feature for improving user experience and managing data loading efficiency.AnQiCMS (AnQiCMS) provides a powerful and flexible API interface, allowing you to easily implement pagination of document lists on the front end.This article will introduce in detail how to use the `page` and `total` parameters in the `archive/list` interface to build a fully functional pagination navigation.--- ### Understanding the core of AnQi CMS pagination mechanism To build pagination navigation for the document list

2025-11-09

When `archive/list` returns `code` as `-1`, what error messages will the `msg` field provide?

When using Anqi CMS for website content management, we often deal with various API interfaces, among which the `archive/list` interface is the core for obtaining the document list.You may encounter the situation where the interface returns `code` as `-1` during use.At this moment, understanding the information provided by the `msg` field is particularly important, as it helps us quickly locate the source of the problem.

2025-11-09

How to efficiently extract and display the article summary (description field) from the AnQiCMS document list?

It is crucial to provide clear and attractive summaries for articles on the website in content management.This not only helps search engines better understand the page content and improve inclusion and ranking, but also quickly captures the attention of visitors on list pages, search results pages, or social sharing, guiding them to click and read the full content.AnQiCMS (AnQiCMS) provides a variety of flexible ways to manage and retrieve this content, and efficiently extracting and displaying the article summary (`description` field`) is a common need in our daily operation. AnQiCMS

2025-11-09

What is the role of `url_token` in the AnQiCMS document list results, and how is it used to generate friendly URLs?

In AnQiCMS, `url_token` is a crucial concept, it is not only a field in the document list, but also the core element for building friendly URLs (Friendly URL) of the website.Understanding its role and usage can help us better optimize the website structure, improve user experience, and search engine rankings.

2025-11-09

How to ensure that only documents under the parent category are returned when retrieving the AnQiCMS document list, without including subcategories?

When using AnQi CMS to manage website content, we often encounter situations where we need to precisely control the display range of documents.For example, when you want to display only the documents directly published under a certain parent category page, without involving the content of its subordinate subcategories, you need to adjust the way the document list is retrieved.AnQi CMS provides a very flexible API interface, allowing you to easily meet this requirement.

2025-11-09