Community

MarkLogic 10 and Data Hub 5.0

Latest MarkLogic releases provide a smarter, simpler, and more secure way to integrate data.

Read Blog →

Company

Stay On Top Of Everything MarkLogic

Be the first to know! News, product information, and events delivered straight to your inbox.

Sign Me Up →

 
Knowledgebase:
Difference between cts: contains and fn: contains
06 September 2019 09:21 AM

Search fundamentals

 

Difference between cts:contains and fn:contains

 1) fn:contains is a substring match, where as cts:contains performs query matching

 2) cts:contains therefore can utilize general queries and stemming, where fn:contains does not

 

For example:-

 

Example.xml

<test>daily running makes you fit</test>

 

  •         fn:contains(fn:doc(“Example.xml”),”ning”)

          True

  •          cts:contains(fn:doc(“Example.xml”),”ning”)

         False

 

   

  •         fn:contains(fn:doc(“Example.xml”),”ran”)

           False

  •         cts:contains(fn:doc(“Example.xml”),”ran”)

            True

 

 

Note:-

The cts:contains examples are checking the document against cts:word-querys.  Stemming reduces words down to their root, allowing for smaller term lists.

 

1) Words from different languages are treated differently, and will not stem to the same root word entry from another language.

2) Note: Nouns will not stem to verbs and vice versa. For example, the word “runner” will not stem to “run”.

References

(8 vote(s))
Helpful
Not helpful

Comments (0)