• 尊时凯龙

    shopify商店搜索之使用 AND、OR 和 NOT 运算符和前缀搜索

    shopify商店AND、OR 和 NOT 运算符

    2022/03/25

    自建站

    使用 AND、OR 和 NOT 运算符

    AND

    默认情况下,所有搜索词均通过 AND 连接在一起,因此,搜索

     artichoke hearts

    将出现同时包含“artichoke”和“hearts”。不需要连接运算符。

    OR

    搜索

     artichoke OR hearts

    会生成至少包含“artichoke”或“hearts”其中之一的结果。

    NOT

    若要搜索不带某个搜索词的结果,可以在此搜索词前面加上一个减号。

     artichoke -heart

    与包含“artichoke”而不是“heart”的术语匹配。

    前缀搜索

    搜索

     artich\*

    与以“artich”开头的术语匹配。

    搜索特定字段

    在搜索词中添加带冒号的字段名称,以便将对该词的搜索范围缩小到指定字段。

    例如:

     title:artichoke

    搜索包含单词“artichoke”的标题。

    搜索特定字段时,搜索拼写错误的单词将不起作用,因为搜索会查找完全匹配的结果。

    例如:

     title:artichoqe


    不会出现任何结果。

    可搜索属性

    根据搜索类型,结果可以基于不同的可搜索属性。

    搜索类型可搜索属性
    产品
    • 正文

    • product_type

    • 标签

    • 标题

    • 多属性条码

    • variants.sku

    • variants.title

    • 供应商

    页面
    • 作者

    • 正文

    • 标题

    文章
    • 作者

    • 正文

    • 标签

    • 标题

    Shopify商户官网原文详情:

    Using AND, OR and NOT operators

    AND

    All search terms are by default AND-ed together, so searching for

    artichoke hearts

    yields results containing both "artichoke" and "hearts". Joining operators aren't necessary.

    OR

    Searching for

    artichoke OR hearts

    yields results containing at least one of "artichoke" or "hearts".

    NOT

    Searching for results without a term can be done by prefixing the term with a minus sign.

    artichoke -heart

    matches terms with "artichoke", but not "heart".

    Prefix search

    Searching for

    artich\*

    matches terms that begin with "artich".

    Searching specific fields

    Add a field name with a colon to your search term to narrow your search for that term to the specified field.

    For example:

    title:artichoke

    searches for titles that include the term "artichoke".

    Searching for a misspelt word won't work when searching specific fields, since search looks for an exact match.

    For example:

    title:artichoqe


    doesn't yield any results.

    Searchable properties

    Depending on the type of search, results can be based on different searchable properties.

    Type of searchSearchable properties
    Products
    • body

    • product_type

    • tag

    • title

    • variants.barcode

    • variants.sku

    • variants.title

    • vendor

    Pages
    • author

    • body

    • title

    Articles
    • author

    • body

    • tag

    • title

    文章内容来源:Shopify商户官方网站


    更多