Search code examples
javascriptxquerymarklogic

What works best when building a search application: search:search or cts:search?


I want to know that in order to make a dynamic search application which looks through all the collections and gives the users the ability to use facets, collection facets, pagination, sorting etc what should be the right approach?

I found two functions for this: search:search, and cts:search. Which matches my needs best?


Solution

  • search:search is built on top of cts:search (as well as other APIs). They’re designed to work together. You should start with search:search, though. It is designed specifically for your faceted search use case and includes many conveniences and best practices that might not be obvious with the lower-level APIs, for example, concurrent facet resolution and pagination. If you need to do something more sophisticated than what search:search provides out-of-the-box, you can call out to other libraries.