search:search() vs cts:search() in MarkLogic

喜欢而已 提交于 2019-12-21 17:02:40

问题


I have read about cts:search() and search:search() separately but could not figure out the exact difference between them. It says cts:search() ultimately uses search:search(). Can anyone illustrate in detail the scenario where one should go for cts:search() and for search:search().This is not in relation to some particular project work where I need to implement this but in general.

Thanks!


回答1:


Also worth mentioning are the:

  • Client REST API, which basically exposes the Search API as an HTTP interface
  • Java Client API, which exposes the Client REST API as a set of convenient Java objects, and methods
  • Node.js Client API, which exposes the Client REST API as a set of convenient Node.js objects, and methods

HTH!




回答2:


The Search API (e.g. search:search()) is an XQuery library that provides a high-level interface for some of the core capabilities of MarkLogic, such as search, facets, and aggregates. It uses the lower-level cts:* (and other) libraries under the covers, but will save most developers a bunch of typing and debugging.

In general, I'd recommend starting with the Search API. We've put a lot of effort into making sure it's robust and fast. For example, when doing faceted search, it orchestrates getting the search results and calculating facets from range indexes in parallel. There are many other examples of conveniences and best practices that you get out-of-the-box with the Search API. If you need to do something more or different than the Search API provides, there are several places that allow you to work with lower-level cts:query instances. For example, search:resolve() takes a cts:query and calls the equivalent of search:search().

Also, for those working in Server-Side JavaScript, the upcoming 8.0-4 release will introduce a similarly positioned high-level library designed specifically for JavaScript.



来源:https://stackoverflow.com/questions/32382898/searchsearch-vs-ctssearch-in-marklogic

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