Keeping #Sitecore #SOLR Index Names Unique for Multiple Projects

One of the things I recently ran into was what should you do if you have multiple projects with the same SOLR index name. SOLR does not allow you to have the same name for an index. For instance you can’t have more than one sitecore_master_index. You will be warned and unable to if you try and create one with the same name. Also if you rebuild the indexes it will overwrite the index data for the other site you were working on. So I went on Sitecore Slack looking for help. Where Sitecorey gave me a great idea. Basically you would prefix the configuration entry core with the name of the site in each index file. See below for an example.

Your index name should reflect that name as well in the SOLR index directory.

Now this did solve the issue of having multiple indexes, but a few people on the team wanted to take it a step further. They wanted to see indexes prefixed with site name from the control panel index rebuild. So I created a config transform this time for it. Keep in mind this is always a smart idea to keep the original files safe. Basically I just replaced the id value.

From my understanding the SIM installer can also help with the prefixing of index names. I haven’t used it for that yet as my site was already installed, but in the future that is something I will consider. Let me know if you have any questions.

First Ever Milwaukee Meets Chicago #Sitecore Meetup Recap

So not sure exactly who’s idea it was, but it turned out to be a great one to combine the Milwaukee Sitecore Meetup with the Chicago Sitecore meetup. No Bears vs Packers football was discussed, just Sitecore. There must have been over 30 attendees. Coveo did the first presentation and I was honored to be part of the second presentation of Sitecore Symposium attendees. I can’t wait for the next one. So here is the recap in pictures.

I live in the far west suburbs of Chicago so driving to Kenosha, Wisconsin was about the same time as it took me to get to the Chicago meetups. I enjoyed my view of the country roads and put on some classic hard rock music.

I arrived at the venue. I have never been to the Brat Stop, but I may have to come back for a visit.


Upon arrival it was great to start meeting others in person and seeing people again that I have met at the Symposium, the Chicago meetups and even one of my co-workers in person.

Renee from American Eagle and Isabel from Coveo.

My co-worker Chad from Paragon and Joe from GeekHive.

Like I said a sizable number of attendees.

Look at that food. Not bad for not being Chicago pizza.

I always love Sitecore freebies. I do love Sitecore like the pin says.

So let’s get down to the meetup itself. It first started with all the sponsors telling a little about the company they work for. I talked about Paragon and what we did. Hopefully what I was saying made sense. I am a developer, but I always try and do my best to sell.

Coveo then did a presentation. Coveo has been a huge part of Sitecore searching/marketing and they always impress me. I can’t wait to do another project with their tools.

 

 

 

 

 

 

 

 

 

Now it was time for the Sitecore Symposium panel.

110317_1718_FirstEverMi11.jpg

We all gave our best insights and reported things we learned and brought up a lot of subjects. Mark and the audience had some great questions. This was so much fun.

So when is the next one? Not sure, but this one was so much fun. Maybe we can discuss Bears vs Packers at the next one?

Making the #Sitecore Switch from #Lucene to #SOLR with Custom Indexes

Recently I did my first conversion from Lucene to SOLR. With Lucene being phased out in Sitecore 9 this will probably be more common. You can find a lot of different installation guides in installing SOLR, but there are a few things that tripped me up that I want to prevent others from having to deal with.

Avoid Pitfalls

  • Make sure every Lucene config is disabled. Even the ones in the sub folders.
  • Make sure all the SOLR configs are enabled even the ones in the sub folders.
  • Make sure you don’t have any Cores with the same name inside the core.properties file. I had Sitecore_Master_Index in more than one file and all my Cores would disappear every time I restarted until I corrected the name.

Custom Indexes Differences

Some of this is obvious as you can replace Lucene with Solr, but some were not so obvious to me and I had to do some research and ask for help. I highlighted the less obvious ones.

From this:

<index
id=acme_widgetgroups_index” type=Sitecore.ContentSearch.LuceneProvider.LuceneIndex, Sitecore.ContentSearch.LuceneProvider>

To this:

<index
id=acme_widgetgroups_index” type=Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider>

From this:

<configuration
ref=contentSearch/indexConfigurations/defaultLuceneIndexConfiguration>

To this:

<configuration
ref=contentSearch/indexConfigurations/defaultSolrIndexConfiguration>

From this:

<fieldMap
type=Sitecore.ContentSearch.FieldMap, Sitecore.ContentSearch>

To this:

<fieldMap
ref=contentSearch/indexConfigurations/defaultSolrIndexConfiguration/fieldMap>

From this:

<field fieldName=widgetfilters” storageType=YES” indexType=TOKENIZED” vectorType=NO” boost=1f” type=System.String” settingType=Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider />

To this:

<field fieldName=widgetfilters” returnType=string />

From this:

<documentOptions
type=Sitecore.ContentSearch.LuceneProvider.LuceneDocumentBuilderOptions, Sitecore.ContentSearch.LuceneProvider>

To this:

<documentOptions
type=Sitecore.ContentSearch.SolrProvider.SolrDocumentBuilderOptions, Sitecore.ContentSearch.SolrProvider>

I hope this helps you as you do your conversion. If you have any questions, feel free to ask.

#Sitecore Symposium Day 4 #SitecoreSYM @ParagonDev

Well final day is done and I am sitting at the airport. To say that I am truly blessed to have the opportunity to be part of the Sitecore Symposium is an understatement. I am so glad Paragon Consulting chose me to attend. I have a lot to learn about the new features of Sitecore, but that is my passion and I can’t wait to dive in. So just like the other posts here is my day in pictures.

I don’t do these pics ever, but I also don’t get this fancy because I am always coding.

It might not be web development, but there is a lot you can learn about marketing and utilize as you develop websites.

Did someone say headless? That is going to be so cool

Putting this here so I can actually read it.

Where is Rob?

There he is.

I always test my code. I am not kidding.

Well this had to finally come off, but I may still wear it from time to time.

See you next year?????

Sitecore Symposium Day 3 #SitecoreSYM @ParagonDev

In the city that never sleeps it was a great day from sunup to sunrise. I still can’t get over how awesome this event has been and how I look forward to the future with Sitecore. So here we go. My day in pictures.

First a run to start out the day. I ran into one of my coworkers and I followed her as she ran super-fast. Never thought I could run that fast feeling still full of last night’s dinner.

One of the best seminars I have heard about marketing. Lots of important information. We all have work to do.

This guy is hilarious. Always good to mix comedy with anything.

Keep on learning…

Thanks Paragon for providing lunch.

More learning. This time the Data Exchange Framework. My little area of expertise.

Scott Anderson Chief Marketing Officer of Sitecore. A big celebrity for us.

Mark Hamill is in the house. One of the greatest moments ever. What a great guy.

Finishing the night at the Omni.

Something you don’t see everyday.

On to day 4 and back home.

Sitecore Symposium Day 2 #SitecoreSYM #ParagonDev

I am writing this late at night. It has been a busy day. Some pictures below. Having an awesome day and learning and meeting so many in the Sitecore world.

A little early morning run to start the day.

#VegasStrong

My new developer running buddy from GeekHive.

Mark Frost CEO opening up the Sitecore Symposium.

A development track might be better than a running track.

Bloody Mary in the morning? Tomato juice and coffee go well together.

The Sitecore guru himself Kamruz.

Keep on learning.

I love dessert.

Sitecore Mints!!! My breath smelled like mints and great websites.

Keep on learning…

Paragon and our little microbrews.

Closeup because why not?

Dinner time. Italian family style.

Goodnight!

Sitecore Symposium Day 1 #SitecoreSYM #ParagonDev

First day of the Sitecore Symposium I am in awe. It was great to meet people I talk to virtually, catch up with current coworkers, old coworkers and meet new people. So here is Day 1 in pictures.

Is my head really that big? Seen at the baggage area of the airport.

Paragon developers meet Marilyn Monroe. Maybe she needs a Sitecore site?

If you close your eyes and go back to the 50s these guys were good. It was the 50s right?

I can’t take Darth Vader in a Jedi fight, but pretty sure I can beat him in a race.

This drink was called cloud 9. No alcohol, but it was good. Loved licking the sugar from the side.

Sitecore development would be super hard without Hedgehog software. I am taking one of the babies home with me.

Room with a view.

No white tiger sightings yet.

Good night. Going running in the morning and then learning lots of things during the day.

So That is What the Custom Data Property is for. #Sitecore #Hedgehog #TDS and Glass Mapper Model Generation.

Glass and TDS makes our development life easier so we should try and use every feature we can. Right? One of my favorite features is generating a list of Glass models instead of GUIDS. A lot of you probably know this, but there is always times where someone does not. I wanted to document this so this can help others.

Select the field that is a Treelist or whatever multi list field.

In the properties under Code Generation you need to specify the type of list you want returned with model.

In my case:

type=IEnumerable<Feature.SectionLink.Models.sitecore.templates.Feature.SectionLink.SectionLink>.

Now Glass will auto generate and you will get the actual Glass Item Model instead a list of GUIDS.

[SitecoreType(TemplateId=ISectionLinksConstants.TemplateIdString)]

public partial class
SectionLinks  : GlassBase, ISectionLinks

       {

///
<summary>

 /// The Section List field.

            ///
<para></para>

                           ///
<para>Field Type: Treelist</para>          

                           ///
<para>Field ID: e09af999-37fa-42a3-98b7-1ffb802413c2</para>

                           ///
<para>Custom Data: type=IEnumerable<Feature.SectionLink.Models.sitecore.templates.Feature.SectionLink.SectionLink></para>

                           ///
</summary>

                           [global::System.CodeDom.Compiler.GeneratedCodeAttribute(“Team Development for Sitecore – GlassItem.tt”, “1.0”)]

                           [SitecoreField(ISectionLinksConstants.Section_ListsFieldName)]

                           public
virtual
IEnumerable<Feature.SectionLink.Models.sitecore.templates.Feature.SectionLink.SectionLink> Section_Lists  {get; set;}

       }

In my controller I just call it this way and I have my list to run through the ForEach:

viewModel = sitecoreservice.Cast<ISectionLinks>(Sitecore.Context.Item,inferType:true).Section_Lists.ToList();

So that is it. Let me know if there is something else we can do with this property. I would like to know.

Top Must Have Tools for Your #Sitecore Development Environment

There are so many tools I have used over the years in my Sitecore projects. I wanted to come up with a list of the ones I use the most. I will be using the list as a reference as well when I start a new project each time and hope that others can find it useful. I kept the descriptions short, but if you click on the links I provided you can find more information on what each tool does. So here they are in no particular order.

  1. SIM Installer (Sitecore Instance Manager)

    The SIM installer is great for installing/uninstalling different versions of Sitecore sites. It also does many other things that you help you maintain and update your Sitecore instances. I would not install an instance of Sitecore without using it.

    You can download it here.

  2. Sitecore Developer Toolbox

    You ever wonder what happened to the XPath Builder? Wouldn’t it be cool to be able to get to the admin tools from the content editor? The Sitecore Developer Toolbox brings all the major developer tools together. Time is money and having these shortcuts at the ready will save you lots of time.

    You can find it in the Sitecore market place here.

    For more information about it check out this link.

  3. Google Chrome Extension

    This Chrome extension is fantastic for getting to the Sitecore admin pages much faster from the Chrome browser.

    You can find the tools here.

  4. Sitecore Rocks

    Sitecore Rocks works integrates with Visual Studio to give you an all in one interface to Sitecore. With Sitecore rocks you have a Sitecore explorer window that you can use to view your Sitecore sites. You can do just about all the same functionality with Sitecore Rocks that you can do in Sitecore without leaving Visual Studio. Some of the functionality like creating/updating templates, creating/updated renderings and retrieving data using a query analyzer. One of my favorite features of Sitecore Rocks is the multiple select and delete.

    You can find it here.

  5. Luke

    Luke is the perfect tool for troubleshooting query and data issues with Lucene. I have used the tool many times when I find data abnormalities.

    You can download it here.

  6. Helix Generator

    Since Helix has started becoming a standard with new Sitecore projects having a way to have a Helix skeleton to get you started is nice to have. You can find many Helix generators out there. Here is the one that I usually use. The thing I like I bought it is you can choose what you want installed.

    You can find it here.

  7. DotPeek or Reflector

    These are great utilities for opening code from any DLL need to understand the code better. Whenever I have a task that a pipeline needs to be overridden or I need to understand why something is being set I use one of these utilities.

    DotPeek can be downloaded from here.

    Reflector can be downloaded from here.

  8. TDS or Unicorn

    TDS and Unicorn are critical in a development environment if you want to keep your Sitecore database in sync with your team. Both work well with source control so you can keep your Sitecore changes safe.

    You can find TDS here.

    You can find Unicorn here.

  9. Data Exchange Framework

    For importing and exporting data, updating xDB and anything else you can think of ways of manipulating Sitecore data the DEF is Sitecore’s best tool to do so.

    You can find it here.

  10. Sitecore Slack Chat and Sitecore Stack Exchange

    Stuck on something? More than likely someone else has been stuck on the same issue. Nothing wrong with reaching out for help. Some of the nicest Sitecore developers can be found on Slack and Stack Exchange.

    You can find the Slack group here.

    The Sitecore Stack Exchange can be found here.

  11. Debug Attach Manager

    I have found this the easiest way to attach to a process and debug. It remembers the process you last attached to so you can easily attach to it again.

    You can find it here.

  12. ZeroDeploy by Hedgehog Software.

    No developer likes to wait to debug their website. Sometimes you forget what you changed while testing if the site takes too long to reload. With ZeroDeploy it makes the wait time 99% faster.

    You can find it here.

  13. Razl by Hedgehog Software

    With this tool you can compare and merge your Sitecore databases. This tool is great for troubleshooting missing data, getting production data into development for testing, resetting production from a backup etc.…

    You can find it here.

  14.  Astrogrep

    This is a tool I use almost daily. It searches file names and text within files. I have found this useful for troubleshooting errors and/or finding a setting.

  You can find it here.

So those are my favorite tools to use in my Sitecore development environment. Is there some more that I should be using? Let me know.

Serializing a #Sitecore Computed Index Field (When You Need to Pass an Immense Amount of Data)

Recently I worked on a Data Exchange Framework process that involved extracting several records. Each record would eventually be inserted into an external table as they were basically rows. The DEF process was slow creating the records so I created a computed index field to handle creating the records and the DEF process would just need to read and insert the records accordingly. Problem was most computed index fields usually return a small value. In this case it could be several rows of data. The solution was simple though. Serialize a list of objects then deserialize it and let the DEF processor take it from there.

In my example the computed index field is created using an Image field class which contains a list of ImageInfo objects. You can fill in and create the index however you want. See below.

public class
 Image
 {
  [IndexField("imageinformation")]
  publicList<ImageInfo> ImageInformation { get; set; }
  [IndexField("images")]
  public string Imagelist { get; set; }
  [IndexField("_templatename")]
   public string TemplateName { get; set; }
 }

public class ImageInfo
 {
  public string EntityId { get; set; }
  public string caption1 { get; set; }
  public string caption2 { get; set; }
  public string freeformcaptions { get; set; }
  public string url { get; set; }
  }

As stated above, Image contains a list of ImageInfo objects. I used Newtonsoft to Serialize it.

return JsonConvert.SerializeObject(image.ImageInformation); 

This is an example of what the serialized data looks like:

“[{\”EntityId\”:\”4aa575d5-af18-466f-8e56-a06494ca6d16\”,\”caption1\”:\”NoCaption\”,\”caption2\”:null,\”freeformcaptions\”:null,\”url\”:\”https://acme.com/-/media/Images/Acme/Products/location/area51/subspecies/images/Streetscape3.ashx\”},{\”EntityId\”:\”4aa575d5-af18-466f-8e56-a06494ca6d16\”,\”caption1\”:\”NoCaption\”,\”caption2\”:null,\”freeformcaptions\”:null,\”url\”:\”https://acme.com/-/media/Images/Acme/Products/location/area51/subspecies/images/Streetscape.ashx\”},{\”EntityId\”:\”4aa575d5-af18-466f-8e56-a06494ca6d16\”,\”caption1\”:\”NoCaption\”,\”caption2\”:null,\”freeformcaptions\”:null,\”url\”:\”https://acme.com/-/media/Images/Acme/Products/location/area51/subspecies/images/Streetscape1.ashx\”},{\”EntityId\”:\”4aa575d5-af18-466f-8e56-a06494ca6d16\”,\”caption1\”:\”NoCaption\”,\”caption2\”:null,\”freeformcaptions\”:null,\”url\”:\”https://acme.com/-/media/Images/Acme/Products/location/area51/subspecies/images/Exterior.ashx\”},{\”EntityId\”:\”4aa575d5-af18-466f-8e56-a06494ca6d16\”,\”caption1\”:\”NoCaption\”,\”caption2\”:null,\”freeformcaptions\”:null,\”url\”:\”https://acme.com/-/media/Images/Acme/Products/location/area51/subspecies/images/Streetscape3.ashx\”},{\”EntityId\”:\”4aa575d5-af18-466f-8e56-a06494ca6d16\”,\”caption1\”:\”NoCaption\”,\”caption2\”:null,\”freeformcaptions\”:null,\”url\”:\”https://acme.com/-/media/Images/Acme/Products/location/area51/subspecies/images/Streetscape4.ashx\”},{\”EntityId\”:\”4aa575d5-af18-466f-8e56-a06494ca6d16\”,\”caption1\”:\”NoCaption\”,\”caption2\”:null,\”freeformcaptions\”:null,\”url\”:\”https://acme.com/-/media/Images/Acme/Products/location/area51/subspecies/images/Streetscape5.ashx\”}]”

This is the computed index in the index configuration.

<fields hint="raw:AddComputedIndexField">
<!-- Custom Computed Fields -->
<!-- Default SC Fields -->
<field fieldName="images">Acme.Feature.Website.ComputedFields.CustomReporting.ImagesComputedField, Acme.Your.Website</field>
 </fields> 

In the process method of the DEF you can then deserialize the field and do your processing.

var imageinfo = JsonConvert.DeserializeObject<List<ImagesComputedField.ImageInfo>>(image.Imagelist);
foreach (var imagedet in imageinfo)
{
 UpdateDataTable(new Guid(imagedet.EntityId), imagedet.caption1, 
 imagedet.caption2,imagedet.freeformcaptions, imagedet.url); 
}

So that is it. Not too bad and will solve a lot of issues where you need to move a lot of data. The DEF process went from 15 plus minutes to less than a minute once this index was created.