What do the `name` and `field_name` in the `archiveFilters` interface represent?

Calendar 👁️ 71

During the development and content management of AnQi CMS, we often need to handle document filtering and display.archiveFiltersThe interface is designed for this, it provides the ability to dynamically obtain filtering conditions. Understanding the returned data innameandfield_namefields is crucial for building flexible front-end filtering functions.

name: User-friendly filter condition display name

When we go througharchiveFiltersThe data returned when the document filter condition is retrieved through the interface will include anamefield. Thisnamefield represents the filter conditiondisplay nameorUser-friendly nameIt is presented in human-readable language (usually Chinese), and its main function is to display clear and intuitive filtering options on the website front end.

For example, in the example data returned by the interface, we can seenameFor "city" and "education". These are the labels you usually see on a page, used for user selection. You cannameUnderstand that you define the Chinese name or description of a custom field in the AnQi CMS background, which is directly facing the end user and aims to provide a good interactive experience.

field_name: The internal filter field call name

withnameis accompanied byfield_name. It plays a completely different role in terms of function.field_namerepresents the filter conditions oftechnical identifierorAPI call nameIt is usually a short English word or pinyin, used to uniquely identify a filtering condition in backend logic and API requests.

Thisfield_nameIt is the system name defined for the field when custom field settings are made in the Anqi CMS backend, which is used internally to process data and construct queries. For example, whennameWhen it is 'city', its correspondingfield_namemay be 'city'; whennameit is 'education', itsfield_namemay be 'certificate'.

field_nameThe core function lies in its uniqueness and stability. When the user selects one in the front-end interface,nameWhen the filtering condition for "city" is set to "Beijing", your front-end code will use its correspondingfield_name"city" as a parameter to pass toarchiveListetc interfaces. For example, a request/api/archive/list?moduleId=1&city=北京The backend can then filterfield_name“city” accurately to find all documents where the city is “Beijing”.

Additionally, when obtaining document details,archiveDetailWhen a document contains custom fields, these fields are also present asextrakeys in the object. For example,field_namemay appear in the objectextra, here is theauthor: { name: '作者', value: 'AnqiCMS', default: '' }.authorIt is the custom fieldfield_name.

namewithfield_namecollaboration

In short,nameis provided for users to view, convenient for users to understand and operate; andfield_nameIt is provided for the program to ensure the accuracy of API calls and data processing.This separation design makes the website have a good user experience while also maintaining the clarity and efficiency of the backend data logic.archiveFiltersThe interface retrieves these two, allowing developers to dynamically build various filters without hardcoding the conditions, thereby greatly enhancing the flexibility and maintainability of the website.


Frequently Asked Questions (FAQ)

1. Why do we need both fields to existnameandfield_nameWhat are these fields for?

This design aims to separate the presentation layer from the data processing layer.nameProvide a user-friendly interface display, allowing users to easily understand and select filtering conditions; andfield_nameIt serves as the unique identifier for internal system and API interactions, ensuring the accuracy and stability of data processing. You cannameconsider as a label,field_nameconsider as the "code" behind the label.

2.field_nameCan it be changed arbitrarily? What impact will it have after the change?

It is usually not recommended to change arbitrarilyfield_name. Becausefield_nameOnce set, it may be referenced in multiple places, such as inarchiveListIn the interface query parameters orarchiveDetailreturnedextrafield as the key name. Frequent modifications may lead to dependencies on thisfield_nameThe front-end function or third-party integration has failed, so it should be defined cautiously when creating custom fields.

3. How to utilize in the front-end pagearchiveFiltersto build filtering functions with the returned data?

You can traversearchiveFiltersThe interface returnsdatathe array, using each item'snameas the display text for the filter button or dropdown menu. After the user selects a filter condition, get the correspondingfield_nameanditemsselected item in the array.label(or actual value), thenfield_name=labelcall as a query parameterarchiveListto get the filtered document list. This can realize dynamic and flexible filtering functions.

Related articles

In AnQi CMS, what is the role of the `moduleId` parameter in the `archiveFilters` interface?

When using AnQiCMS to build a website, we often need to provide flexible filtering functions for different types of content so that visitors can quickly find the information they need according to their needs.The `archiveFilters` interface was born for this purpose, it can help us get the document filtering conditions.And in this interface, the `moduleId` parameter plays a crucial role.### `archiveFilters` interface's `moduleId`

2025-11-09

How to get the parameter filter condition list of a specified document model?

In website operation, providing users with a convenient content filtering function can significantly improve user experience and content discovery efficiency.The Anqi CMS provides powerful interfaces, allowing us to flexibly obtain and utilize these filtering conditions.Today, let's discuss how to get the parameter filtering condition list of a specified document model in Anqi CMS. ### The Importance of Understanding Filtering Criteria Imagine if your website has many products or articles, and users want to search based on dimensions such as "city", "education", or "product type".

2025-11-09

How to optimize the navigation experience of the previous and next documents through the `archivePrev` and `archiveNext` interfaces?

Today, with the increasing refinement of content management, every detail of a website may affect the reading experience of users.Among them, the navigation between the previous and next documents, as an important part of guiding users to continuously explore the website content, should not be overlooked in terms of convenience and fluidity.AnQiCMS (AnQiCMS) knows this and provides the powerful and intuitive interfaces `archivePrev` and `archiveNext` to help us easily implement and optimize this feature.###

2025-11-09

How should the comment area on the document detail page be integrated with the Anqi CMS comment API to display and publish comments?

In website operation, the comment area of the document detail page plays an important role, it not only promotes user interaction and enhances content activity, but also brings new content and search engine visibility to the website.AnQiCMS provides a powerful and easy-to-integrate comment API that allows you to easily implement comment display and posting features on your website.This article will discuss in detail how to use these APIs to create a fully functional comment system for your document detail page.##

2025-11-09

How to interpret the `items` array in the filtering conditions API, used to build the front-end filter?

In modern web design, the content filtering feature has become an important part of improving user experience and content discoverability.A well-designed filter can help users quickly locate the information they are interested in, whether it is products, articles, or any other form of content.For Anqi CMS, the provided filtering conditions API (/api/archive/filters) is the foundation for building such frontend filtering functions.Especially the `items` array in the response data is the key to understanding and implementing dynamic filtering.

2025-11-09

Why does the `total` field often display as 0 in the `archiveFilters` returned data? What is its real purpose?

When using AnQi CMS for website content management, we often deal with various API interfaces.Among them, the `archiveFilters` interface is an important tool for obtaining document filtering conditions.Many users notice that when using this interface, the `total` field in the `items` list of the returned data always displays as `0` for each filter option (such as `Beijing` and `Shanghai` under `City`).This may be confusing: Since it's a 'quantity', why is it `0`? This

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

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