本文介绍了MarkLogic“搜索:建议"查找约束名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以这真的很奇怪.我有一个完整的空数据库,并使用以下代码:

So this one is really weird. I have a completly empty database and use the following code:

xquery version "1.0-ml";

import module namespace search = "http://marklogic.com/appservices/search"
    at "/MarkLogic/appservices/search/search.xqy";

search:suggest("qwe" ,
  <options xmlns="http://marklogic.com/appservices/search">
    <constraint name="qweqwe">
      <word type="xs:string" collation="http://marklogic.com/collation/">
        <element name="test"/>
      </word>
    </constraint>
    <default-suggestion-source ref="qweqwe"/>
  </options>
)

其结果是一个建议:qweqwe:

search:suggest似乎找到了约束名称并提出了建议.

The search:suggest seems to find the constraint name and suggest it.

复制步骤:

  • 清除数据库
  • 使用排序规则http://marklogic.com/collation/为元素test创建元素词词典.
  • 执行以前的代码
  • clear database
  • create element word lexicons for element test with collation http://marklogic.com/collation/
  • execute previous code

将ml 9.0-8与完全空的和重新编制索引的documents数据库一起使用.您可以将约束的名称更改为所需的名称,您总是可以得到建议.这是一个错误吗?

Using ml 9.0-8 with a completly empty and reindexed documents database. You can change the name of the constraint to whatever you want, you can always get a suggestion for it. Is this a bug?

推荐答案

不是错误,它是设计使然. search:suggest /v1/suggest 最常用于搜索栏中的提前输入建议.这是一种用户方便的事情.它可以帮助用户发现可用的约束,并给它们返回一个冒号,因此您可以在插入名称+冒号之后继续寻找该约束的值.

Not a bug, it is by design. search:suggest, and /v1/suggest are most commonly used for typeahead suggestions in a search bar. It is a user-convenience kind of thing. It helps the user discover the available constraints, giving them back including a colon, so you can continue looking for values for that constraint, after inserting the name+colon.

HTH!

这篇关于MarkLogic“搜索:建议"查找约束名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 03:55