1

I've been searching here for a solution but at least when I've tried out the answers in the Xpath builder I always get errors. I'm using Sitecore 8.2. The current query is:

/sitecore/content/Documents//*[@@TemplateName='Document'and@Publication='1' and contains(@#Title#,'" + keyword + "')]

I just want to make the keyword insensitive to case. I've tried forcing the title field item in the query to lowercase but I only get errors so apparently I'm not getting the syntax correct and can't seem to find a reference that gives syntax that doesn't produce an error...

When I try the following:

/sitecore/content/Documents//*[@@TemplateName='Document'and@Publication='1' and contains( translate(@Title,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'), 'keyword')]

I get "String expression expected in Contains().

I get the same when trying:

/sitecore/content/Documents//*[@@TemplateName='Document'and@Publication='1' and contains(lower-case(@Title), 'keyword')]
2
  • 1
    I would recommend using the Content Search API here instead of using XPath with a descendants tree walk. It will perform much better and your case insensitivity is simple to do. – Richard Seal Nov 15 '19 at 19:27
  • Thanks, I changed it to use the Search API and it's working as it should now. – Levi Wallach Nov 15 '19 at 22:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.