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.