MarkLogic “search:suggest” finds constraint name

拟墨画扇 提交于 2019-12-12 23:12:53

问题


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>
)

The result of this is one suggestions: qweqwe:

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

Steps to reproduce:

  • clear database
  • create element word lexicons for element test with collation http://marklogic.com/collation/
  • execute previous code

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?


回答1:


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!



来源:https://stackoverflow.com/questions/54162942/marklogic-searchsuggest-finds-constraint-name

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!