Saturday 30 December 2017

Sitecore 9 : No matching command include parameter name signer

Hello Sitecore Devs,

While Installing Sitecore 9 on windows 8.1 machine I faced an error
No matching command include parameter named 'signer'. check the spelling of the parameter name and then try again.




















I found one post regarding above error 
https://neilkillen.com/2017/11/04/sitecore-9-0-sif-windows-8-1-server-2012-gotchas/

It says that windows 8.1 does not have parameter named "signer" and hence the error.
Also IIS 8.0/8.5 does not support creation of certificates automatically. so you need to manually create certificate.

After generating the certificates manually you need to update the installation script as follows :

For Step : #install client certificate for xconnect
remove line Install-SitecoreConfiguration @certParams -Verbose so that it does not try to install certificate automatically and we can get rid of the 'signer' error.

Search for XConnectCert = $certParams.CertificateName instances in your installation script and replace $certParams.CertificateName with the thumbprint of your created certificate (make sure to convert your thumbprint to uppercase and remove space between them).

e.g. XConnectCert ="C28BDFD63F84DAA28CF604345A1A5124F3E535D1"

Re-run your installation script and you should be able to solve certificate related error.

That's all for Now !!!





Thursday 6 April 2017

Solr Keyword Search with hyphen not working

Hello Devs,

While doing hands on with SOLR, faced issues while searching for keywords with hyphen. Just an overview, I have created list of items in Sitecore which has below fields:

Employee Name, Employee Birthdate, Employee City and Employee Bio and I’m reading its values from my custom SOLR Index.

When we search with Employee Name (for e.g. John - Smith), it does’nt give any search results even if its present in index.

The reason is Sitecore field types of “html|rich text|single-line text|multi-line text|text|memo|image|reference” are defined as a text field and it uses solr.StandardTokenizerFactory.

This Standard Tokenizer treats whitespace and punctuation as delimiters and it discards them (except (dots)). To read more about Tokenizers click here.
First, you need to add the Field (e.g. Employee name) in

Sitecore.ContentSearch.Solr.DefaultIndexConfiguration.config under

<fieldNames hint="raw:AddFieldByFieldName"> 

section or you can create a custom index configuration file and add the require fields as below:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <contentSearch>
      <!-- Configuration sections for indexes -->
      <indexConfigurations>
        <!-- If an index has no configuration specified, it will use the configuration below. The configuration is not merged if the index also has
         configuration, it is either this configuration or the index configuration. -->
    <defaultSolrIndexConfiguration  type="Sitecore.ContentSearch.SolrProvider.SolrIndexConfiguration,    Sitecore.ContentSearch.SolrProvider">

          <!-- DEFAULT FIELD MAPPING
               This field map allows you to take full control over how your data is stored in the index. This can affect the way data is queried, performance of searching and how data is retrieved and casted to a proper type in the API.
            -->
          <fieldMap type="Sitecore.ContentSearch.SolrProvider.SolrFieldMap, Sitecore.ContentSearch.SolrProvider">
            <fieldNames hint="raw:AddFieldByFieldName">
                   <field fieldName="Employee Name" returnType="string" />
            </fieldNames>
         </fieldMap>
        </defaultSolrIndexConfiguration>
      </indexConfigurations>
    </contentSearch>
  </sitecore>
</configuration>

In Schema.xml file for the SOLR index you created, comment out

<fieldType name="string" class="solr.StrField" sortMissingLast="true" />

and add,

<fieldType name="string" class="solr.TextField" sortMissingLast="true">
      <analyzer type="index">
        <tokenizer class="solr.KeywordTokenizerFactory" />
        <filter class="solr.LowerCaseFilterFactory" />
      </analyzer>
      <analyzer type="query">
        <tokenizer class="solr.KeywordTokenizerFactory" />
        <filter class="solr.LowerCaseFilterFactory" />
      </analyzer>
 </fieldType>

Once you make all these changes restart your SOLR Service once and Re-build index. Now Search for keywords with – in it and you would see the results.

Happy Coding 😊

Wednesday 5 April 2017

Issue with Publishing related items from experience editor

Hello Devs,

We faced one issue while publishing related items from Experience Editor. We are passing a datasource item (e.g. XXX) to a component.

The Datasource item have a multilist field where we select the items (Item: A, B) to be displayed.

When we Update field values of the below selected items (Item: A or B) from the experience editor. The values are updated from the experience editor and were reflected in content editor as well but when we publish with (Publish sub Items and Publish Related Items) the changes are not getting reflected.

Question: Is this an intended behaviour? (We raised a support ticket for it)

Yes, Sitecore does’nt process second level reference and therefore it’s not process by Sitecore. The reason is to prevent huge number of items being published. Sitecore doesn't process references of references.

You can customize your solution to implement the behaviour in the following way:

1. Create your custom processor based on the Sitecore.Publishing.Pipelines.GetItemReferences.AddItemLinkReferences 
one (i.e. copy sources of processor).

2. Modify the GetReferences() method so that it would recursively process reference references if item is being referenced by the Renderings field (i.e. reference is a data source item).

3. Replace predefined processor with your custom one.

Click here to download the custom code file provided by Sitecore.

That’s it !!!

Happy Coding 😊

Friday 13 January 2017

Validation error on adding image in Rich-Text field from Experience editor


Validation error on adding image in Rich-Text field from Experience editor 

When we add an image in Rich-Text field through Experience Editor it throws validation error in (Sitecore 8.1 update-1(151207)).






Steps to reproduce:

Add an image in Rich-Text field from Experience Editor

As soon as we save the changes a validation error is thrown in experience editor

In Experience Editor the <img> tag created is,

<img alt="XXX" src="-/media/XXX.ashx?h=111&amp;w=539&amp;hash=CAF8436CA168BC18D2FD5D95597E874E66EDD1DF" style="width: 539px; height: 111px;" />

Open Content Editor

Click on Edit Html -> Click Fix

The Original HTML and Corrected HTML show no difference but if you see the <img> tag / is removed.

<img alt="XXX" src="-/media/XXX.ashx?h=111&amp;w=539&amp;hash=CAF8436CA168BC18D2FD5D95597E874E66EDD1DF" style="width: 539px; height: 111px;" >

/> is removed

After accepting the above changes, it doesn't throw any error in content editor as well as validation error from experience editor is gone.

Solution:

We raised this with Sitecore Support and they reported it as a Bug in Sitecore 8.1 update-1(151207) Thanks to Sitecore support as they provided a patch to resolve this issue.

So the problem appears while decoding the HTML rich text value in System.Net.WebUtility.HtmlDecode method. To let HtmlDecode generate valid output for rich text field apply following patch provided by Sitecore:

1) Backup your \Website\sitecore\shell\client\Sitecore\ExperienceEditor\ExperienceEditor.js

2) Find following code in mentioned ExperienceEditor.js:

encodeHtml: function (htmlSource) {
    htmlSource = htmlSource.replace(/\\/g, '\\\\').replace(/\"/g, "\\\"");
    var encodedHtml = encodeURIComponent(htmlSource);
    return encodedHtml;
},

and replace it with:

encodeHtml: function (htmlSource) {
    htmlSource = htmlSource.replace(/\\/g, '\\\\').replace(/\"/g, "\\\"").replace(/&amp;/g, "&amp;amp;"); // fix 102239
    var encodedHtml = encodeURIComponent(htmlSource);
    return encodedHtml;
},

3) Clear your browser cache. That’s it.

Check by adding image from Experience Editor it wouldn't throw any validation error.

Happy Coding 😊.