Showing posts with label sitecore. Show all posts
Showing posts with label sitecore. Show all posts

Tuesday, 11 September 2018

Multilist field Index issue When Index only selected field

Problem:

We added a new multi-list field in Sitecore 9 Update 2, (vanilla instance) on the Sample Item and populated it with some content items.
We Added new multi-list field to include the fields section in the index configuration file as: 
            xxxxxxx  


also set
false
under documentOptions node in Sitecore 9 update 2

We rebuild the sitecore_master_index and we queried the index in Solr. We noticed that the field is stored in the index as a string in the format of an array of IDS. - this is not what we expected."multilistitem_t_en":["{Guid1}|{Guid2}"],

If we turn true and rebuild the index we see the field in the index as a string in the format of a list og GUIDs which is what we expect to be the default behaviour."multilistitem_sm":["23442343231423423234abcdbded", "bced4423433231423423234abcdbded"],We don't want to change indexAllFields to true though due to performance issues.

Solution:

Due to this issue, we had to postpone the release by a day and out team needs to change all our multi-list fields code to computed fields. After some time Sitecore has provided a fix


Happy sitecoring........


Tuesday, 23 February 2016

Sitecore Zero DownTime Deployment..................Possible?

In Sitecore deployment its alway a issue of downtime may be couple minutes to few miute as both content delivery share same Web Database and content package installed on CM and just code drop on CDs so you alway come in situation  where you need to wait  until template/ layout deploy and then publish and site back on track. Its is Chicken and Egg situation which should deploy first and some times you need to apply some manual steps on some content before you published it.

There are couple of Ways you can deploy without down time one of the way is show in Sitecore Scaling guide for Disaster recovery servers used as temporary/ permanent switch to  live traffic for user after deployment. Which increase servers cost and lots of over heads.

My client do not wants add new servers to infrastructure  as they don't have enough resources to manage all servers and achieve No down time while deployment.

Following Diagram is very common across Sitecore deployment.
Standard Sitecore architecture  is two or more Content Delivery servers one Content Management Server one  Solr with Zookeper to sync Solr Node, Sql Cluster for Load balacing Sql. like below. I assume Core Database is required and all of us know.

There is option for solr and Lucene to switch index while rebuild index no down time for solr content. We can't use that feature as we are having Nutch for site search.




We have automated lots of  step using Teamcity and octopus steps like Sanity Check after deployment complited and generate report of any broken link or page error. I am going in to details but I am showing some basing settings  how to achive. 

There are few steps you need to do

Add new Web Publishing Target. 


Visit John West Blog or Nehemiah Jeyakumar

Add new Web Index or Any costom Index Core.

Copy existing Web Index Named "Sitecore_Web_Index or any custom and got Sitecore_web2_index
folder and find core.properties Open and change Name property  with "Sitecore_Web2_index

Update Index Update Strategies

Go to Sitecore.ContentSearch.DefaultConfigurations.config
Add following new Strategy Which allow to update index to both Solr index same time  while  normal operation of cm. So we hare update content on both solr index.

<onPublishEndAsyncWeb2 type="Sitecore.ContentSearch.Maintenance.Strategies.OnPublishEndAsynchronousStrategy, Sitecore.ContentSearch">
<param desc="database">web2</param>
<!-- Whether or not a full index rebuild should be triggered when the number of items in the EventQueue exceeds the number specified
in ContentSearch.FullRebuildItemCountThreshold. -->
<CheckForThreshold>true</CheckForThreshold>
 </onPublishEndAsyncWeb2>


 Configure Solr Index.config

Add following or as per your need

<!-- WEB INDEX configuration -->
          <index id="sitecore_web2_index" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
            <param desc="name">$(id)</param>
            <param desc="core">$(id)</param>
            <param desc="propertyStore" ref="contentSearch/indexConfigurations/databasePropertyStore" param1="$(id)" />
            <configuration ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration" />
            <strategies hint="list:AddStrategy">
              <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/onPublishEndAsyncWeb2" />
            </strategies>
            <locations hint="list:AddCrawler">
              <crawler type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch">
                <Database>web</Database>
                <Root>/sitecore/content/home</Root>
              </crawler>
            </locations>
           <!-- <locations hint="list:AddCrawler">
              <crawler type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch">
                <Database>web</Database>
                <Root>/sitecore/content/demo</Root>
              </crawler>
            </locations>-->
          </index>


Change Code  to switch index  

In our case Searcm manager configure based on one of App setting value  so we can chagne index to search content from that index.

Nutch Feeding to both Index Sitecore_Web_Index and Sitecore_Web2_Index.




Now configuration is ready All you need to run deployment in following order. We are using octopus deploy so we have lots of flexibility to chagne configuration using powershellshell script.

1. Remove one Content delivery Server from Load Balancer its depend on load balancer software API.
2. Stop Nutch for feeding index
2. Change App Setting to for Site Search TO Sitecore_Web2_Index on CM and CD both.
3. Set Default publishing target On CM only to Web2 Database. Instead of Web|Web2 in DefaultPublishingTargets in web.config file, you can set mutliple target separated by pipe
4. Set Site Definition Database Attribute to Web2 (CM and one CD)
4. Deploy Sitecore Item to  cm and code to CM and CD
5. Publish content to  Web2 Publishing target
6. Run test script to regression check of you site.


If successful  all above steps run second part of deployment.

1. Add back first server and remove other server from load balancer.

2. Change configuration for search
3. Set Site definition to Web2
3. Deploy code package to content delivery.
4. Add server To Load balancer.

Finally steps
Set DefaultPublishingTargets to Back to web|web2 on CM so manual publish sync content and update index correctly.


In Next deployment just switch web2 to web and deploy to server.

Enjoy No downtime deployment....

I have test this and with Solr index....Not tested with Lucene.













Sitecore Content Editor Search-Tags with User Friendly Facets tags

Its is very surprised that Sitecore beautiful feature people are not using it. Sitecore support very large content using Sitecore Item Bucket which was created as sitecore 6.6 module couple of year ago but now its part of sitecore Sitecore Item bucket. Item Buckets is a system that lets you store millions of content items in one container. You can convert individual items in the content tree into item buckets that can contain any number of subitems. These subitems are not listed in the content tree and do not have a direct parent-child relationship with the item bucket item.

One Really good feature is tagging content and seach based on tagging. We have thousands of pictures and content for one of my client they are struggling to find content. So I introduced them tagging feature. To enabled Tags filter for search Go to Item /sitecore/system/Settings/Buckets/Facets/Tags  and Enabled Checkbox Global.
so we can filter content based on tags applied but we discover that Tags are showing some strange Id like below.




Sitecore Has settiing for enabled User friendly name for Tags.

 Find Sitecore.Bucket.config file and find 
<setting name="BucketConfiguration.ResolveFacetValueToFriendlyName" value="false"/>

Repace with 
<setting name="BucketConfiguration.ResolveFacetValueToFriendlyName" value="true"/>

just rebuild index master index  you will see following.



Its Nice Feature...............

I was looking weather someone has face similar issue but found out yes is very common.
I had implemented computed field and use that field for facets. But after looking more in details find out above configuration out of box from Sitecore.

Thanks for visiting.......






 

Thursday, 24 April 2014

Sitecore Rule : Item Saved Actions not showing.

I am really fan of sitecore rule engine and discover some hidden gems for rule engine. I am bit surprise that has sitecore intentionally not added separate templates for each rule type or left it for developer to add themselves. but good things is it works with new template type with same field names...

Created new rule using template: /sitecore/templates/System/Rules/Rule  under /sitecore/system/Settings/Rules/Item Saved/Rules but actions are not showing any action from /sitecore/system/Settings/Rules/Item Saved/Actions  and showing from common actions under /sitecore/system/Settings/Rules/Common/Actions






 
 

Why? its not showing Item Saved/Actions and Showing Common Actions.

Solutions: when we create rule new there is default insert option is "rule" using which use /sitecore/system/Settings/Rules/Item Saved/Rules template with no source specified as below:



By adding new source with item saved path not going to solve the issue and this will applied to all rules and showing item saved action in all rules like item deleted, item created if you customised  pipeline. so this solution not going to work. after digging more and other rules action come to know that you need to create new template same as item insert option or content editor warning etc.

Step 1. Duplicate Rule template in /sitecore/templates/System/Rules/Rule named "Item Saved Rule".
Step 2. Add /sitecore/system/Settings/Rules/Item Saved to source field to rule field.
Step 3: Add Insert option to Rule item  as Item Saved
Step 4 Create rule desire rule under item saved/Rules with new template created in step 1.
Step 5 Add desire action folder or action to item saved/actions.
After Applying this you will see as below.


Sitecore........is...........Amazing........................

 

Saturday, 27 October 2012

Multisite workflow With Sitecore Rule Engine

Some company run multiple sites on single sitecore instance. sitecore run very smoothly. you can share templates, layouts etc......

All of sudden business requirement change and all content on each site must have to go through some kind of workflow.......... their own group of editors, so Sites cant share workflow they must have its own workflow.  developer : "PROBLEM.............PROBLEM......................." We cant share templates................etc etc

I have visited view blogs post many people saying that you can add one more steps in workflow and custom commnad will decide what work flow need to set on item. and I agree you can do.
But there is easy way you ca achieve this. "There is Sitecore there is way"...........Sitecore have one hiddle telent which is "Rule Engine", I really love it. Its amazing you can do lots of things with sitecore client...................Its really add to much power to Sitecore Product.


Let me show you how can you achieve this buy rule engine..

  1.  Go to /sitecore/system/Settings/Rules/Common/Actions                                                   Right click  Insert from template using /sitecore/template/system/rules/action Named:"Set workflow"  
           On right Text field Add

            Set WorkFlow [WorkflowId,Tree,root=/sitecore/system/Workflows,Item] State    [WorkFlowState,Tree,root=/sitecore/system/Workflows,Item]
    
            In type field(you can  change it later)
            Sominral.Rules.Action.SetWorkflow, Sominral.Workflow.Action
           

2. Create new folder under  /sitecore/system/Settings/Rules/

 Name: Item Created
Create another folder under Item Created  Folder

Then create new item using /sitecore/templates/system/rules/rule

On content area In Name field Set Workflow
 Now Click on Edit Rule



 
Is its easy you can set as many as rules you want.. there are lots of optin base on item layout base etc etc... all easy right ?
 
We have spedified code reference on Action item code will be  as below
 
namespace Sominral.Rules.Action
{
 using Sitecore.Rules;
 using Sitecore.Rules.Actions;
 using Sitecore.Diagnostics;
 using Sitecore.SecurityModel;
 using Sitecore.Data.Items;
 public class SetWorkflow : RuleAction where T : RuleContext
 {
  public string WorkflowId { get; set; }
  public string WorkFlowState { get; set; }
  public SetWorkflow()
  {}
  public override void Apply(T ruleContext)
  {
   Assert.IsNotNull(ruleContext, "rule context");
   if (!ruleContext.IsAborted)
   {
    using (SecurityDisabler securityDisabler = new SecurityDisabler())
    {
     var db = Sitecore.Data.Database.GetDatabase(ruleContext.Item.Database.ToString());
     var createdItem = db.GetItem(ruleContext.Item.ID);
     if (createdItem == null)
     {
      return;
     }
     createdItem.Editing.BeginEdit();
     using (new EditContext(createdItem))
     {
      createdItem.Fields["__Workflow"].Value = WorkflowId;
      createdItem.Fields["__Workflow state"].Value = WorkFlowState;
     }
     createdItem.Editing.EndEdit();
    }
   }
  }
 }
}
 
Yes we have added Action now how to trigged this action I know I know you are smart enough where to Trigger it dont you?......................
 
Answer is  Item Created event...........you need to add custom event on event pipeline. and trigger all rules under
/sitecore/system/Settings/Rules/Item Created/Rules item.

I know you can do it...........
hint: look how delete event fire.....


Thanks
Loving Rule engine..

Friday, 12 October 2012

Sitecore Page Editor - An error ocurred when adding new control to placeholder.


Do you have problem to Add control to bottom of any placeholder in sitecore page editors  in sitecore Version 6.4.1 ?
Are you getting following error.


After spending an hour,  sitecore doesn't help much though.

Just did some debugging using dot peek find out that place holder names are case sensitive.
It will throw an error If place holder name is "Main" not "main" or "/contentArea/Right" not "/contentarea/right"

So make sure when you add control using content editor use all place holder name in lowercase and full path possible. else you could face above error.

It will throw above error.