1

We have upgraded to Sitecore 10.1 from Sitecore 8.2 and Solr 8.4 from Solr 6.6.2

We have a droplist field which is PropertyAddressState and after rebuiliding the index it is propertyaddressstate_s rather than propertyaddressstate_t (which is in Solr 6.6.2).

Here is the code to filter state

filterPredicate.And(x => x.PropertyAddressState.Equals(state));

The Sitecore Search log is showing the field propertyaddressstate_t_en:("nsw") whereas in the Solr 8.4 the field is propertyaddressstate_s

It shows no result because of different field types.

How can I force in the code to use propertyaddressstate_t rather than propertyaddressstate_s

The droplink is string returnType and by changing to returnType text. It works fine

Changing

<fieldType fieldTypeName="icon|droplist|grouped droplist" returnType="string"/>

to

<fieldType fieldTypeName="icon|droplist|grouped droplist" returnType="text"/>

Changing droplist returnType to Text works but is this a good solution?. I am concerned if this will break something else.

Any suggestion would be appreciated.

1
  • I don't think it's a good idea to change droplist from string to text, instead just your particular field type only. Nov 26 at 6:16
1

You can set text in returnType like below, instead of changing in fieldType

<fieldTypes hint="raw:AddFieldByFieldName">
  <field fieldName="propertyaddressstate" returnType="text" />
  ...
</fieldTypes>

Then publish and rebuild the index.

2
  • For dropdown, it should be string, not stringCollection because dropdown can hold only one value. Nov 25 at 8:50
  • Corrected, sorry I was thinking about multilist Nov 25 at 12:16
1
  1. You need to use return type as string collection for droplist filed type
  2. Populate Solr schema again in the control panel
  3. Rebuild the indexes
0

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.