Surendra Sharma

Surendra Sharma

Search This Blog

Tuesday, July 28, 2015

Luke for Sitecore Lucene search



Today I learn about Luke diagnostic tool which is used for analyzing Lucene index files.

This is developed in Java. So you need JVM in m





achine. You can download it from https://code.google.com/p/luke/
I installed lukeall-3.5.0.jar file      

             

After installation, browse you index folder path as highlighted in yellow color in below image


From this tool you can check which fields are indexing by Lucene.


You can search content items which are indexed based on particular template as shown in below image like 

_template:e5378d89080c4137898ec400b7dc4d39

Here two things to remember
1.    Enter template ID in lower letters
2.    remove dash - from template id


Simple but very useful tool.

Please leave your comments or share this tip if it’s useful for you.

Saturday, July 25, 2015

Could not find configuration node: databases/database[@id='master']



If you are getting Lucene search related error in Sitecore Could not find configuration node: databases/database[@id='master'] on Content Delivery Server then the cause of this error is that we don't need any master database entry in any config file on content delivery server.
 
Solution:- 

Just delete Sitecore.ContentSearch.Lucene.Indexes.Sharded.Master.config.example and Sitecore.ContentSearch.Lucene.Indexes.Sharded.Master.config from \Website\App_Config\Include folder. It should fix the problem.

Please leave your comments or share this tip if it’s useful for you.

Wednesday, July 22, 2015

How to create subscribers in ExactTarget using C# code



ExactTarget is a cloud service provided by Salesforce for running email campaign for email marketing. For this we need to create subscribers.
 
Here is a code for to create subscribers in ExactTarget via its web service.


Change necessary values in below code and call the method. That’s it.

static void AddSubscribers()
{
    //Account authentication information for an ExactTarget user. Access it from web.config
    SoapClient client = new SoapClient();
    client.ClientCredentials.UserName.UserName = "xyz";
    client.ClientCredentials.UserName.Password = "xyzpassword";

    //Create a new subscriber - person email id
    Subscriber newSub = new Subscriber();
    newSub.EmailAddress = "abc@test.com";
    newSub.SubscriberKey = "abc@test.com";

    //Create the subscriber attributes
    newSub.Attributes = new ExactTargetClient.Attribute[6];

    //Attribute - First Name
    newSub.Attributes[0] = new ExactTargetClient.Attribute();
    newSub.Attributes[0].Name = "First Name";
    newSub.Attributes[0].Value = "Enter your first Name Here";

    //Attribute - Last Name
    newSub.Attributes[1] = new ExactTargetClient.Attribute();
    newSub.Attributes[1].Name = "Last Name";
    newSub.Attributes[1].Value = "Enter your Last Name Here";

    //Attribute - Zip Code
    newSub.Attributes[2] = new ExactTargetClient.Attribute();
    newSub.Attributes[2].Name = "Zip Code";
    newSub.Attributes[2].Value = "110011";

    //Attribute - State
    newSub.Attributes[3] = new ExactTargetClient.Attribute();
    newSub.Attributes[3].Name = "State";
    newSub.Attributes[3].Value = "Johannesburg";

    //Attribute - City
    newSub.Attributes[4] = new ExactTargetClient.Attribute();
    newSub.Attributes[4].Name = "City";
    newSub.Attributes[4].Value = "Johannesburg";

    newSub.Attributes[5] = new ExactTargetClient.Attribute();
    newSub.Attributes[5].Name = "Country";
    newSub.Attributes[5].Value = "South Africa";

    //Specify the busiess unit ID
    newSub.Client = new ClientID();
       //Manage via a config file
    newSub.Client.ID = 1234567; 
    newSub.Client.IDSpecified = true;

    //Declare the list we want to add the subscriber to
    //Please manage these values via a configuration file
    SubscriberList mylist = new SubscriberList();
    mylist.ID = 1234;
    mylist.IDSpecified = true;

    //Relate the List to the Subscriber
    newSub.Lists = new SubscriberList[] { mylist };

    //Instantiate the CreateOptions object for the create call of TSD
    CreateOptions cOptionsTS = new CreateOptions();
    cOptionsTS.RequestType = RequestType.Asynchronous;
    cOptionsTS.RequestTypeSpecified = true;

    SaveOption saveOption = new SaveOption();
    saveOption.SaveAction = SaveAction.UpdateAdd;
    saveOption.PropertyName = "*";
    cOptionsTS.SaveOptions = new SaveOption[] { saveOption };

    try
    {
        //Create the request to add the subscriber
        string tsRequestID = "";
        string tsStatus = "";
        CreateResult[] tsResults = client.Create(cOptionsTS, new APIObject[] { newSub }, out tsRequestID, out tsStatus);

        Console.WriteLine("Overall Status ::: " + tsStatus);
        Console.WriteLine("Number of Results ::: " + tsStatus.Length);

        foreach (CreateResult result in tsResults)
        {
            Console.WriteLine("Status Code and Message ::: " + result.StatusCode + " " + result.StatusMessage);
        }

        Console.ReadLine();

        //Check for Error
        if (tsStatus != "OK") { throw new Exception(); }

    }
    catch (Exception exCreate)
    {
        Console.WriteLine(exCreate.Message);
        Console.ReadLine();
    }
}
 
Please leave your comments or share this code if it’s useful for you.