Alfresco javascript search insensitive case

339 views Asked by At

I'm using search root objet to perform search

var result = search.query({query: "TYPE:\"cm:category\" AND @cm\\:name:CAt*" }).

What i want to do exactly is to select categories which name begin with the term "cat" (but ignoring case)

How can i do that?

I want also the query ignore whitespace before and after category name.

Thank you.

1

There are 1 answers

1
mitpatoliya On

I think you could simply use this Query

var result = search.query({query: "TYPE:\"cm:category\"  AND @cm\\:name:*CAt*"  })

It should give you all categories whose name contains "cat" word. You can also try with other wildcard character "?" in your query.

Only thing to remember is "For tokenized fields the pattern match can not be exact as all the non token characters (whitespace, punctuation, etc) will have been lost and treated as equal."