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!
cts:element-value-geospatial-co-occurrences. Returns value co-occurrences from the specified element value lexicon with the specified geospatial lexicon. cts:element-value-match. Returns values from the specified element value lexicon(s) that match the specified wildcard pattern.
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.
Also worth mentioning are the:
HTH!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With