Does the `categoryList` tag support fuzzy search or filtering by category name (without going through URL parameters)?

Calendar 👁️ 58

As an experienced website operations expert, I am deeply familiar with the various functions and content operation strategies of AnQiCMS, and I am willing to analyze them for youcategoryListDoes the tag in AnQi CMS support fuzzy search or filtering based on category names, an important issue.

In the template system of Anqi CMS,categoryListTags are the core tools for developers and content operators to obtain and display the website category list.It helps us build clear website navigation and content structure with its concise and efficient features.However, when we delve into the details of its functions, we find that its design philosophy and specific parameters determine some characteristics and limitations in handling fuzzy search or filtering of classification names.

We can clearly see from the document you provided.categoryListThe definition and usage of tags. Their core purpose isTo get the list of articles and product categoriesAnd it mainly controls the range and level of the categories obtained through the following parameters:

  • moduleId: Specify the content model ID, for example, to get the category list of the article model.
  • parentId: Used to get the subcategories under a specified parent category, or through.parentId="0"Get the top-level category.
  • allWhen set totrueall categories are retrieved, if specified at the same timemoduleIdthen all categories under the model are retrieved.
  • limit: Controls the number of items displayed, supports pagination mode.
  • siteId: Used to specify which site's data to retrieve in a multi-site environment.

Upon careful examination of these parameters, we will find a key piece of information:categoryListThe tag itselfNo direct parameters are provided, such asqOr (query keyword)nameFuzzy matching of category namesUsed for direct fuzzy search or filtering when calling a label based on the category name.The focus of its design is on building a hierarchical classification structure through model ID and parent-child relationships, rather than performing dynamic search based on text content.

This contrasts with the functions of some other tags in AnQiCMS. For example,archiveListThe (document list tag) explicitly supportsq="搜索关键词"This parameter allows users to search and filter document titles based on keywords. This difference indicates,categoryListLabels are designed to primarily organize data structures and display levels, rather than immediate, text-oriented search matching.

Then, why?categoryListTags do not directly support fuzzy search for category names?

This is usually due to several considerations:

  1. Separation of duties:Template tags are usually designed to perform specific and efficient data retrieval tasks.categoryListFocus on hierarchical traversal of structured data, while text search may be considered a more complex query that requires additional indexing and matching logic.
  2. Performance optimization:If you want to perform fuzzy matching directly on a large number of category names at the template level, especially when the number of categories is large, it may cause additional burden on the database and increase the rendering time of the page.Place this complex logic in a backend API or a more specialized service, usually for better performance.
  3. Flexible backend support:AnQiCMS is a system dedicated to providing an efficient, customizable, and scalable content management solution, which tends to implement complex and highly customized search requirements through backend APIs or custom modules, thereby providing greater flexibility.

In the absence of URL parameters, if it is indeed necessary to perform a fuzzy search or filter based on the category name, what alternative strategies are available at the current template level?

due tocategoryListThe tag does not support directly, you may need to consider the following alternative methods, but they all have their own limitations:

  1. Front-end JavaScript auxiliary filtering:
    • Approach:UsecategoryListTag retrieves all (or most) related category data, and then reads these data through JavaScript on the frontend.You can write JS code to perform fuzzy matching on categories loaded based on user input, and dynamically hide or show the categories that meet the criteria.
    • Advantage:No backend code needs to be modified, the implementation is relatively simple.
    • Limitations:This method requires loading all potential category data at once, which can lead to slow page loading and poor user experience if the number of categories is very large.The filtering logic is completely executed on the client side, which is not friendly to SEO (search engines cannot see the filtered content).
  2. Limited built-in template logic (not recommended for large-scale use):
    • Approach:If you want to filter a very small number of categories, you cancategoryListofforInside the loop, using the AnQiCMS template supportedifLogical judgment and string filter (such asfilter-contain.mdmentionedcontainThe filter) to judgeitem.TitleWhether it contains specific keywords.
    • Advantage:Pure template implementation, no JS required.
    • Limitations: containFilters are typically used to determine if a value contains another value. If complex "fuzzy search" logic needs to be implemented in a template, it will be very cumbersome and inefficient.For a large amount of classified data, this will bring significant performance issues because the template engine must traverse all categories and perform string comparison one by one.This is not the practice of "fuzzy search".

Conclusion

In summary, AnQiCMS'categoryListTag, under its current design,Does not directly support fuzzy search or filtering by category name (not through URL parameters). Its core function is to accurately obtain the classification set based on structured attributes (such as model ID, parent ID).

If you have a strong business need to implement a dynamic fuzzy search or filter function for category names, and you do not want to rely on URL parameters for frontend interaction (or have higher requirements for performance, SEO), then a more robust solution may require stepping out of the scope of pure template tags and considering the following advanced customization:

  1. Develop custom API interface:Create a backend interface that is responsible for performing a fuzzy search based on the category name and returning the filtered category data. The front end calls this interface via AJAX to retrieve and render the data.
  2. Custom label or plugin:If AnQiCMS provides a mechanism for extending tags or plugins, a custom tag can be developed that includes fuzzy matching logic for category names.

AlthoughcategoryListThe label is limited in this aspect, but it does not affect the powerful ability of AnQiCMS in content management and structured data display.Understanding its design principles can help us better utilize existing tools and, when necessary, adopt more suitable expansion solutions.


Frequently Asked Questions (FAQ)

  1. Q:categoryListCan tags be filtered by category name?Exact matchFor example, I only want to get the category named "Company News"?A:categoryListThe tag does not directly support filtering by exact name, its purpose is to get a categoryList. If you want to get aSpecificname category detail, you can try usingcategoryDetailThe tag supports passing throughidortokenTo get the category details by (category URL alias). If the name is used as an alias in the URL (token) thencategoryDetailThe label can be retrieved. However, if only the Chinese name is available, it needs to be implemented on the backend or through front-end logic in conjunction with other data retrieval methods.

  2. Q: If my website has tens of thousands of categories, is it feasible to use JavaScript for front-end fuzzy search?A: For a small number of categories (such as dozens), front-end JavaScript filtering is feasible because it can respond quickly to user operations.If the number of categories reaches hundreds or even thousands, loading all category data at once will significantly increase the page loading time, consume user bandwidth, and may lead to a decrease in browser performance, seriously affecting the user experience.In this case, we strongly recommend using the backend API query method to load only the category data related to the user's search keywords.

  3. Q: Besides the tags mentioned in the document, does AnQiCMS provide other built-in features (such as custom plugins or modules) to expandcategoryListto support fuzzy search?A: According to the provided document, AnQiCMS has advantages such as "modular design" and "flexible content model", indicating that it has certain extensibility. Although the document does not directly mention thecategoryListThe specific fuzzy search extension point of the tag, but if the core requirement indeed exists, it is usually considered the following ways: first, refer to the AnQiCMS developer manual or community to see if there are hooks (Hook) for template tags or

Related articles

In AnQiCMS, `categoryList` and `pageList` coexist without any issues, a practical template for intelligent operation

As an experienced website operations expert, I know that the flexible use of template tags in a content management system is the key to building an efficient and multifunctional website.Many AnQiCMS (AnQiCMS) users, especially those friends who are new to template development, may have a question: Will there be a conflict if tags with different functions like `categoryList` and `pageList` are used simultaneously on the same page??

2025-11-06

How to ensure that the `categoryList` generates absolute path links for external reference or SEO?

As an expert who deeply understands website operation, I know the importance of the standardization of website links for search engine optimization (SEO) and user experience.In such an efficient and powerful content management system as AnqiCMS, ensure that category links are presented in absolute path form, which not only enhances the visibility of the website in search engines but also facilitates the citation and sharing of content on external platforms.Today, let's delve into how to elegantly achieve this goal in AnqiCMS.### The Foundation for Optimizing SEO and External References: Understanding the Value of Absolute Paths Imagine that

2025-11-06

`categoryList`is there a difference or**practice**in the way it is called in the mobile template and PC template?

As an experienced website operations expert, I am well-versed in the powerful functions and essence of content operation of AnQi CMS, and I am delighted to delve into the calling method of the `categoryList` tag in the mobile and PC templates of AnQi CMS, as well as how to use its features to achieve efficient and user-friendly content presentation.On a day when content marketing and user experience are increasingly important, the performance of a website on different devices is crucial.AnQi CMS understands this, as can be seen from its project advantages and core features, it provides "adaptive, code adaptation"}

2025-11-06

How to customize the `categoryList` in multi-level nesting, the character style and content before the child category `Spacer`?

As an experienced website operations expert, I am well aware of the importance of website navigation and content classification for user experience and SEO.AnQiCMS (AnQiCMS) with its flexible template engine and rich tag system provides us with powerful content display capabilities.Today, let's delve deeply into a detail that is common in multi-level category displays but often overlooked - how to customize the `Spacer` character style and content before the subcategory in the `categoryList` tag.### Perceiving the Beauty of Hierarchical Layers

2025-11-06

How to extend the additional features of the `categoryList` tag without modifying the AnQiCMS core code?

As an experienced website operations expert, I fully understand how to skillfully utilize the existing functions of the CMS system to expand without touching the core code, which is crucial for maintaining system stability and reducing upgrade costs.AnQiCMS (AnQiCMS) offers us a powerful tool for deep customization at the content operation level with its flexible template engine and rich tag system, among which the `categoryList` tag is often a point where we need to expand the function.In Anqi CMS

2025-11-06

Is the HTML structure generated by `categoryList` friendly to search engine crawlers, and how can it be optimized?

As an experienced website operations expert, I know that every detail can affect the performance of a website in search engines.Today, let's delve deeply into the `categoryList` tag generated by AnQiCMS, the degree of friendliness of its HTML structure to search engine spiders, and how we can cleverly optimize it to improve the website's SEO performance.Since its inception, AnQi CMS has been favored by operators for its SEO-friendly design concept.

2025-11-06

How to handle the pagination problem when nesting `archiveList` inside `categoryList`?

As an experienced website operations expert, I have accumulated rich experience in the content management practice of AnQiCMS.I am well aware that when facing the powerful template tag system of AnQiCMS, how to skillfully combine them to achieve the expected content display effect is a challenge that many operators and developers will encounter.Today, let's delve into a common yet confusing issue: how to properly handle the pagination problem of `archiveList` when nesting `categoryList`?

2025-11-06

`categoryList` returns the category data whether it includes user group or permission-related setting information?

In the daily operation and template development of AnQi CMS, we often need to obtain site data from different angles, and the category list (`categoryList`) is undoubtedly one of the most commonly used tags.However, regarding whether the `categoryList` returned classification data includes user group or permission-related setting information?This topic, we delve into the design philosophy and functional implementation of AnqiCMS, revealing the logic behind it.

2025-11-06