Skip to content

Instantly share code, notes, and snippets.

View kijoyin's full-sized avatar

Kiran Joy kijoyin

  • Reading Room
  • Brisbane,QLD,Australia
View GitHub Profile
import time
import datetime
import RPi.GPIO as GPIO
def calculateSpeed():
global start
done = time.time()
elapsed = done - start
elaspesedMinute = elapsed*0.01666668
rpm = 1/elaspesedMinute
namespace Sitecore.BulkOperations
{
public class AddSection : WebEditCommand
{
public override void Execute(CommandContext context)
{
if (context.Items.Length <= 0)
return;
Item obj = context.Items[0];
NameValueCollection parameters = new NameValueCollection();
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<commands>
<command name="bucket:addSection" type="Sitecore.BulkOperations.AddSection, Sitecore.BulkOperations"/>
</commands>
</sitecore>
</configuration>
<!-- WEB INDEX configuration -->
<index id="sitecore_web_index" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
<param desc="name">$(id)</param>
<param desc="core">itembuckets_web</param>
<param desc="propertyStore" ref="contentSearch/databasePropertyStore" param1="$(id)" />
<configuration ref="contentSearch/indexConfigurations/defaultSolrIndexConfiguration" />
<strategies hint="list:AddStrategy">
<strategy ref="contentSearch/indexUpdateStrategies/onPublishEndAsync" />
</strategies>
<locations hint="list:AddCrawler">
<!-- Custom Index -->
<index id="sitecore_custom_index" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
<param desc="name">$(id)</param>
<param desc="core">itembuckets_custom</param> <!-- Created a new core for this custom index. Using the same core cause a few issues like one index disappearing when this index is updated -->
<param desc="propertyStore" ref="contentSearch/databasePropertyStore" param1="$(id)" />
<configuration ref="contentSearch/indexConfigurations/customIndexConfiguration" /><!-- You can point this to a new custom index config or an existing one. I created a new config as my custom index only needs to index very few fields -->
<strategies hint="list:AddStrategy">
<strategy ref="contentSearch/indexUpdateStrategies/onPublishEndAsync" />
</strategies>
<locations hint="list:AddCrawler">
<field fieldName="region_cname" storageType="YES" indexType="UNTOKENIZED" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider">
<Analyzer type="Sitecore.ContentSearch.LuceneProvider.Analyzers.LowerCaseKeywordAnalyzer, Sitecore.ContentSearch.LuceneProvider" />
</field>
<field fieldName="region_cname" storageType="yes" indexType="UNTOKENIZED">Sitecore7.Extensions.ComputedFields.CustomComputedField, Sitecore7.Extensions</field>`
public class CustomComputedField : IComputedIndexField
{
public object ComputeFieldValue(IIndexable indexable)
{
Item item = indexable as SitecoreIndexableItem;
if (item == null)
{
return null;
}