2

My field configuration on Sitecore:

<field fieldName="unifiedtitle" storageType="yes" indexType="tokenized" returnType="string">Project.Foundation.Indexing.ComputedFields.UnifiedTitleComputedField, Project.Foundation.Indexing</field>

Basically I'm facing the following situation when querying against my Solr index:

This is returning the expected result

keywordsFilter.Or(item => item.UnifiedTitle.Like("The Bentley Moose Jaw"))

or

keywordsFilter.Or(item => item.Content.Like("Bentley Moose"))

And as you can see here, this is the value of the unifiedtitle field on Solr:

enter image description here

But this is not returning any result

keywordsFilter.Or(item => item.UnifiedTitle.Like("Bentley Moose"))

It looks like the Like operator doesn't have the same behavior when I use the UnifiedTitle field. Even weirder, if I use the exact value of this field as a filter, than it works as I showed above.

Any suggestion would be hugely appreciated. Thanks.

  • Did you try "Contains"? – Swati Gupta Oct 7 at 12:20
  • Yes I did, same result... – Hugo Santos Oct 7 at 13:28
  • Can you also add details of your computed index configuration? – Mahendra Shekhawat Oct 7 at 14:25
  • Sure, there it is. – Hugo Santos Oct 7 at 14:35
3

I've managed to fix this.

It looks like that a returnType="string" field can't be tokenized.

After changing the returnType to "text" everything is working as expected:

<field fieldName="unifiedtitle" storageType="yes" indexType="tokenized" returnType="text">Project.Foundation.Indexing.ComputedFields.UnifiedTitleComputedField, Project.Foundation.Indexing</field>

  • This is what I was thinking.... String (UTF-8 encoded string or Unicode). Strings are intended for small fields and are not tokenized or analyzed in any way. They have a hard limit of slightly less than 32K. You should use text or for multi values textcollection for tokenized – Mahendra Shekhawat Oct 8 at 3:30

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.