Reputation: 11
I have tried the following code for case-sensitive search in marklogic using javascript.
jsearch.documents().where(cts.wordQuery("automobile",["case-sensitive"]))
Upvotes: 1
Views: 52
Reputation: 7335
Passing the case-sensitive option on the word query is necessary but -- if the database only has case-insensitive indexing -- not sufficient for case-sensitive search.
If the database hasn't been indexed to support case-sensitive searches, one expedient short-term development-time workaround is to add filtering on the result set by chaining a filter()
call after the where()
call and before the result()
call.
For more information about filter()
, see:
http://docs.marklogic.com/DocumentsSearch.filter
For good performance at scale, however, the database should be indexed for fast case sensitive searches instead of using filtering. See:
http://docs.marklogic.com/guide/admin/text_index#id_24289
For more information about unfiltered searching, see:
http://docs.marklogic.com/guide/performance/unfiltered
Hoping that helps,
Upvotes: 4