How to use the `q` parameter to perform keyword search in the AnQiCMS document list and realize the in-site search function?

Calendar 👁️ 103

In the daily operation of websites, providing users with efficient and convenient in-site search functions is a key link to improving user experience and guiding content discovery.For those of us using AnQiCMS to manage website content, it is not difficult to achieve this function.AnQi CMS provides a very practical parameter -qLet us be able to easily search for keywords in the document list.

Start the journey of on-site search: UnderstandingqParameter

At the document list interface of Anqi CMS (/api/archive/list),qThe parameter plays a core role. It allows us to specify a search keyword to filter out all documents with the title containing that keyword.Imagine, when users are looking for specific information on your website, they only need to enter a few words in the search box and can quickly find related content, which will undoubtedly greatly enhance their satisfaction with the website.

To makeqThe parameter is effective, there is an important prerequisite, that is the type of the document list (type) must be set topage. Whentype="page"At this time, Anqi CMS will return a document list with pagination information, and at this timeqParameters can be parsed correctly to perform keyword searches. This means that if you want to build a complete on-site search page, display search results, and support pagination, then you willtypeis set topageIt is indispensable.

Actual operation: How to use in URLqSearch by parameters

Utilize in practical applications,qThe parameter search is very intuitive. When the user enters a keyword in the search box on the front end of the website and submits it, your website (or front-end application) will use this keyword asqThe value of the parameter, add to the/api/archive/listinterface request URL.

For example, if your website domain isyourdomain.comIf the user searches for "AnQi CMS tutorial", then the API request URL may look like this:

yourdomain.com/api/archive/list?type=page&q=安企CMS教程

Through this simple URL structure, the AnQi CMS backend will identify your search intent and return a list of documents with titles containing "AnQi CMS tutorial", along with pagination information.

Optimize search experience: combine with other parameters

qThe parameter is powerful, but it usually needs to work with other parameters to provide a more accurate and friendly search experience.

  • Specify the content model (moduleId):Your website may contain various content models such as articles, products, cases, etc. If the user wants to search for specific types of content, you can combinemoduleIdParameters to limit the search range. For example, searching for "AnQi CMS tutorial" will limit the search to the article model, the request can be changed to:yourdomain.com/api/archive/list?type=page&moduleId=1&q=安企CMS教程
  • Limit category (categoryId)If the website content structure is complex, users may want to search within specific categories. At this point,categoryIdthe parameter can come into play, making the search results more focused.
  • pagination (page,limit)To avoid loading too much data at once, and to facilitate users in browsing a large number of search results,pageand the current page numberlimit(The number of items displayed per page is a required parameter. When the user clicks on the 'Next page' or 'Previous page' on the search results page, the values of these parameters are updated accordingly to retrieve the correct search results segment.)

By flexibly combining these parameters, you can provide users with a highly customized in-site search function, allowing them to quickly locate the target content whether they are looking for a product, a tutorial, or a news item.

The value of in-site search for content operation

The in-site search function is not just about technical implementation, it has a profound significance for content operation. An efficient in-site search can:

  • Improve user satisfactionUsers who can quickly find the information they need are more likely to stay longer on your website and become loyal users.
  • Optimize content strategy: By analyzing users' search keywords, you can gain insights into their interests and needs.Which words are frequently searched? Which search terms did not find suitable results?This data can provide valuable reference for your content creation direction.You can create new content based on popular search terms, or optimize the title and description of existing content to make it easier to find.
  • Improve website navigationIf a large number of users find content for a specific category or topic through search, this may suggest that you can highlight these parts more in the website navigation, optimizing the overall information architecture.

In short, the Anqi CMS'sqThe parameter provides convenience for building a powerful and flexible in-site search function.Master its usage and combine it with other parameters for optimization, which will significantly improve the user experience and content operation efficiency of the website.


Frequently Asked Questions (FAQ)

Q1:qCan the parameter only search the document title?A1: Based on the document description,qThe parameter is mainly used to search for document titles containing specified keywords.If you need to perform a more advanced search on the document text or other fields, it may be necessary to combine secondary development of AnQi CMS or consider integrating third-party search solutions.

Q2: How to get the user input keywords on the front-end page and pass them toqthe parameter?A2: Usually, you can set up a search form on the front-end page (<form>label), when the user enters a keyword and clicks the submit button, the form will automatically use the keyword asqThe value of the parameter, added to the URL via GET request. Alternatively, you can use JavaScript to capture user input and dynamically construct a URL that includesqThe API request URL of the parameter, then load the search results through AJAX or redirection.

Q3: If I don't want the search results to be paginated,qWill the parameter still take effect?A3: No. The document clearly states,qThe parameter only takes effecttype="page"when it is in the list type. If you settypeis set tolist(default value),qThe parameter will not take effect, you will not be able to filter results by keywords. Therefore, in order to implement in-site search, you musttypeis set topage.

Related articles

How does the `child=false` parameter affect the display of categories and their subcategories when retrieving the document list?

In Anqi CMS, the `archive/list` interface is the core tool for obtaining the list of website documents, which provides a variety of parameters to help us accurately filter and display content.Among them, the `child` parameter, although simple in appearance, plays a vital role in the display of categories and their subcategories in documents, directly affecting the granularity of content presentation.Understand and make good use of this parameter, it can make the content organization of your website clearer and improve the user experience.By default, when you access `archive/list`

2025-11-09

How to get the document list with 'Headline' or 'Slide' recommended attributes (`flag`) in AnQiCMS?

In AnQiCMS (AnQiCMS), content managers often need to flexibly display important content on the website, such as setting specific articles as 'headline' or 'slideshow' to attract users' attention.The AnQi CMS provides a very practical feature, that is, marking documents through the 'recommended attribute' (flag).If you want to get the list of documents marked specially, the AnQiCMS API interface can help you achieve it easily.

2025-11-09

Does the AnQiCMS document list interface support excluding multiple categories of documents at the same time (`excludeCategoryId` usage)?

In website operation, we often need to flexibly display content, such as displaying the latest articles on a page, but not including content under certain specific categories, such as announcements or internal news.AnQiCMS as a powerful content management system, provides a rich set of API interfaces to meet these complex display requirements.Today, let's delve into a very practical parameter of the `archive/list` interface: `excludeCategoryId`, especially how it supports excluding multiple categories of documents.###

2025-11-09

How to filter the AnQiCMS document list to display articles under a specific category (`categoryId`)?

How to accurately filter out articles under specific categories when managing and displaying a large amount of content in Anqi CMS is a key link to improve the organization of website content and user experience.Strong and flexible interfaces are provided by AnQi CMS, allowing us to easily achieve this goal.This article will provide a detailed introduction on how to use the document list interface of Anqi CMS to only display specific categorized articles that you hope to see.### Master the document list interface: the core of content filtering To filter articles under specific categories, we need to use the `/api/archive/list` interface provided by AnQi CMS

2025-11-09

How to handle the `extra` field returned by the `archive/list` interface to obtain custom field information?

When using AnQi CMS for website content management, we often need to display more personalized data beyond the usual information such as title, summary, thumbnail, etc.This additional information, such as the author of the article, the model of the product, the release location, etc., is achieved through the powerful custom field function of Anqi CMS.How can we elegantly extract and utilize these custom fields when we obtain the document list through the `archive/list` interface on the front end?The answer is hidden in the `extra` field of the returned data

2025-11-09

In the AnQiCMS document list, what do the `images`, `logo`, and `thumb` fields represent, and how should they be used?

When using AnQi CMS to manage website content, we often encounter scenarios involving image upload and display.In the data structure of documents (articles, products, etc.), categories, and even single pages, the `images`, `logo`, and `thumb` fields play different roles. They work together to support the effective presentation and performance optimization of the website's visual content.Understanding their specific purposes can help us better plan content and optimize the user experience.### `images` : multi-image display and rich content `images`

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

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