The importance of the in-site search function in daily website operations is self-evident.It is not only the bridge for users to quickly find the required information, but also the key link to improve user experience, extend visit duration, and even promote conversion.If the user gets a lot of irrelevant results after entering a keyword, they are likely to leave quickly.Therefore, how to achieve accurate display of in-site search results in AnQiCMS is a topic that every content operator should deeply explore.

AnQiCMS as a system specially designed for content management, built-in powerful and flexible search mechanisms and content organization capabilities, we can fully utilize these features to greatly improve the accuracy of in-site search.

一、Understanding the search basics and content structure of AnQiCMS

AnQiCMS's in-site search functionality is mainly built around its powerful content model and template tag system. When you visit a search page of an AnQiCMS website (usually corresponding tosearch/index.htmlTemplate file)when, the system will parse the user input keywords through specific mechanisms and callarchiveListetc. tags to filter and display content.

To achieve accurate search, it is first necessary to understand how AnQiCMS organizes content:

  • Flexible content model:AnQiCMS allows us to customize content models, such as articles, products, events, etc., each model can define unique fields.The advantage of this structured data is that it allows the system to clearly identify the type and attributes of each piece of content, laying the foundation for subsequent refined searches.
  • Document classification and tags:Content is usually classified into specific categories and can be tagged with multiple labels.The category provides a hierarchical content organization, while tags provide non-hierarchical associations with multiple dimensions.These are the filtering conditions that users may expect when searching.

Understood these basics, we can then start to optimize the search results.

Second, improve the content quality and searchability from the source.

The precise search does not rely solely on the search function itself, but more importantly on the 'searchability' of the content. In AnQiCMS, this means that we need to integrate optimization strategies at the content creation and management stage:

  1. The depth application of keywords:Keywords are the cornerstone of search. In the AnQiCMS document editing interface, set precise keywords for each article or product.Document Title/Document keywordsandDocument SummaryExtremely important.The document keywords should cover the search terms that users may use, and the document summary should be a concise summary of the content, including core keywords.The "Advanced SEO Tools" feature of AnQiCMS helps us establish and maintain a keyword library that is highly relevant to our business, making it convenient to reference when publishing content and ensuring the standardization and coverage of keywords.

  2. Make good use of content models and custom fields:For different types of content, by using AnQiCMS's 'Content Model' feature, we can create models such as 'Article Model', 'Product Model', etc.Further, adding "custom fields" to each content model is the key to advanced search filtering.For example, a "product model" can include "colorThese fields not only make content management more standardized, but also provide more dimensions for matching and filtering in site search.

  3. Build a clear classification system and tag system:Categories and tags are commonly used by users to browse and discover content, and they are also an important basis for search filtering.To categorize content reasonably and assign precise tags can effectively enhance the relevance of search results.tagDataListLabel can quickly retrieve all related documents under the label.When managing documents, we can choose existing tags or input to add new tags, maintaining the vitality and accuracy of tags.

3. Display accurate search results through template tags:

In AnQiCMS, the layout and data retrieval of the search results page are controlled by template tags.We can flexibly use these tags to present the content optimized in the early stage as precise search results.

  1. Basic search box and result call:The standard search function is usually implemented through a form, and its submission target is usually/searcha path. In the template of the search results pagesearch/index.htmlwe mainly usearchiveListtags to display the search results.

    An English translation of the basic search form might look like this:

    <form method="get" action="/search">
        <input type="text" name="q" placeholder="请输入搜索关键词" value="{{urlParams.q}}">
        <button type="submit">搜索</button>
    </form>
    

    Insearch/index.htmlin,archiveListTagged throughqThe parameters automatically retrieve the search keywords from the URL:

    {% archiveList archives with type="page" limit="10" %}
        {% for item in archives %}
            <!-- 展示搜索结果的标题、描述、链接等信息 -->
            <a href="{{item.Link}}">{{item.Title}}</a>
            <p>{{item.Description}}</p>
        {% endfor %}
    {% endarchiveList %}
    {% pagination pages with show="5" %}{% endpagination %}
    

    Here are thetype="page"CombinepaginationTags can easily implement pagination of search results.

  2. UtilizemoduleIdandcategoryIdLimit the search range:If your website content is rich, users may want to search only within specific types (such as "products") or specific categories (such as "company news"). At this point, we can inarchiveListtags inmoduleIdorcategoryIdParameters can be used to limit the search range. For example, search only for products:

    {% archiveList archives with type="page" moduleId="产品模型ID" q="用户搜索词" limit="10" %}
        <!-- 仅展示产品模型的搜索结果 -->
    {% endarchiveList %}
    

    Or search within a specific category:

    {% archiveList archives with type="page" categoryId="分类ID" q="用户搜索词" limit="10" %}
        <!-- 仅展示特定分类下的搜索结果 -->
    {% endarchiveList %}
    
  3. Multi-dimensional filtering conditions:archiveFiltersPowerful applications of:To achieve truly accurate search, multi-dimensional filtering is indispensable. AnQiCMS'sarchiveFiltersLabels are born for this. It can automatically generate filter conditions for users to choose from based on the custom fields defined in the content model.

    Imagine a product showcase website where users might search for 'red', 'L size' T-shirts. By defining custom fields such as 'color', 'size', etc. in the content model, and then using them in the search template,archiveFiltersTags can be used to create such a filter:

    {% archiveFilters filters with moduleId="产品模型ID" allText="全部" %}
        {% for item in filters %}
            <div>
                <span>{{item.Name}}: </span> {# 如:颜色 #}
                <ul>
                    {% for val in item.Items %}
                        <li class="{% if val.IsCurrent %}active{% endif %}">
                            <a href="{{val.Link}}">{{val.Label}}</a> {# 如:红色 #}
                        </li>
                    {% endfor %}
                </ul>
            </div>
        {% endfor %}
    {% endarchiveFilters %}
    

    After the user clicks the filter condition, the URL will automatically include:sex=男these query parameters,archiveListLabels are automatically recognized and filtered to match the content. This greatly enhances the precision of search.

  4. Optimization of sorting methods:Users may want the search results to be sorted in different ways, such as by publish time, views, or relevance.archiveListTagsorderThe parameter allows us to specify the sorting rule, such asorder="views desc"(in descending order of views) ororder="id desc"In search templates, providing sorting options allows users to adjust the order of results according to their preferences, further enhancing satisfaction.

Four, Auxiliary Functions and Continuous Optimization

In addition to the direct search function, other features provided by AnQiCMS can also indirectly improve the accuracy of on-site search:

  • Static rules:Through the management of pseudo-statics and 301 redirects, we can optimize the URL structure to make it more semantic, which is not only beneficial for search engine optimization, but also allows users to better understand the content through intuitive URLs, indirectly enhancing the in-site search experience.
  • Content replacement and anchor text:“Full site content replacement” and “Anchor text management” functions, can help us maintain consistency of content and integrity of internal links.A well-structured internal link can help the system better understand the relationship between content, which can be helpful in some advanced search scenarios.
  • Traffic statistics and analysis:Although AnQiCMS's traffic statistics mainly focuses on external traffic and crawler monitoring, we can combine external tools (such as Google Analytics) to analyze users' on-site search terms.By analyzing these search terms, we can identify user needs, optimize keyword strategies, even adjust the content model and classification system, forming a closed-loop of continuous optimization.

By combining the use of these strategies, we can refine the in-site search function of AnQiCMS to be more accurate and efficient, truly meeting users' deep-level information search needs.


Frequently Asked Questions (FAQ):

  1. Q: Why do I still get unsatisfactory search results even though I set keywords in AnQiCMS?A: The application of keywords is not just about simple filling, but more importantly, its natural distribution and contextual correlation in the content.Ensure that the keywords appear reasonably in the title, introduction, body, and custom fields.archiveFiltersThese functions such as advanced filtering, or whether the settings for content models, categories, and tags are detailed enough, all directly affect the accuracy of the search.
  2. Q: Can I customize the layout and style of the search results page?A: Of course. AnQiCMS is a highly customizable CMS, the search results page usually corresponds to the template directory undersearch/index.html. You can freely adjust the HTML structure and CSS style in this template file according to your design requirements, and make use ofarchiveList/paginationUse tags to flexibly display data and fully realize personalized page layout.
  3. Q:archiveFiltersCan the generated filtering conditions be sorted according to my wishes?A:archiveFiltersThe label will automatically generate filter conditions based on the configuration of custom fields in the content model.The definition order of fields and the management in the background content model settings will affect the display order on the page.orderto adjust the filtering conditions (item.Items)的显示顺序,但你可以通过调整内容模型自定义字段的定义,或者在前端模板中通过JavaScript进行二次排序来实现更个性化的展示。