Skip to content

Instantly share code, notes, and snippets.

@bala-one
bala-one / CoveoCustomComputedFieldConfiguration.xml
Created March 27, 2025 11:25
Coveo Custom Computed Field Configuration
<coveo>
<defaultIndexConfiguration>
<fieldMap>
<fieldNames hint="raw:AddFieldByFieldName">
<fieldType fieldName="MyComputedField" isSortable="true" isFacet="true" settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" returnType="System.String"/>
</fieldNames>
</fieldMap>
<documentOptions>
<fields hint="raw:AddComputedIndexField">
<field fieldName="MyComputedField">Balaone.Coveo.MyComputedField, Balaone.Coveo</field>
@bala-one
bala-one / CoveoCustomComputedField.cs
Created March 27, 2025 01:30
Coveo Custom Computed Field
using System;
using Sitecore.ContentSearch;
using Sitecore.Data.Fields;
using Sitecore.Data.Items;
using Sitecore.ContentSearch.Diagnostics;
using Sitecore.ContentSearch.ComputedFields;
namespace Balaone.Coveo {
public abstract class BaseCoveoComputedField : IComputedIndexField
{
@bala-one
bala-one / ImageAltComputedField.xml
Created March 6, 2025 20:06
Enhancing Coveo Search with Computed Fields - ImageAltComputedField
<field fieldName="screenshotalturl" sourceField="screenshot">
Coveo.SearchProvider.ComputedFields.ImageAltComputedField, Coveo.SearchProviderBase
</field>
@bala-one
bala-one / ImageUrlComputedField.xml
Created March 6, 2025 20:05
Enhancing Coveo Search with Computed Fields - ImageUrlComputedField
<field fieldName="screenshoturl" sourceField="screenshot">
Coveo.SearchProvider.ComputedFields.ImageUrlComputedField, Coveo.SearchProviderBase
</field>
@bala-one
bala-one / ReferencedFieldComputedField.xml
Created March 6, 2025 20:04
Enhancing Coveo Search with Computed Fields - ReferencedFieldComputedField
<field fieldName="mimetype" sourceField="MediaItem" referencedFieldName="Mime Type">
Coveo.SearchProvider.ComputedFields.ReferencedFieldComputedField, Coveo.SearchProviderBase
</field>
@bala-one
bala-one / Sitecore.ContentSearch.Solr.Index.Core.config
Created November 25, 2024 19:50
Sitecore.ContentSearch.Solr.Index.Core SOLR Config
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/" xmlns:search="http://www.sitecore.net/xmlconfig/search/">
<sitecore role:require="Standalone or ContentManagement" search:require="solr">
<contentSearch>
<configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch">
<indexes hint="list:AddIndex">
<index id="sitecore_core_index" type="Sitecore.ContentSearch.SolrProvider.SolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
<param desc="name">$(id)</param>
<param desc="core">balaone_core_index</param>
<param desc="propertyStore" ref="contentSearch/indexConfigurations/databasePropertyStore" param1="$(id)" />
@bala-one
bala-one / ContentSearch.SearchMaxResults.config
Created November 5, 2024 00:17
Limit the number of search results returned. This can be achieved by adjusting the ContentSearch.SearchMaxResults value to a lower number. Sitecore recommends to keep it at 500.
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/" xmlns:role="http://www.sitecore.net/xmlconfig/role/" >
<sitecore role:require="Standalone or ContentManagement">
<settings>
<setting name="ContentSearch.SearchMaxResults" set:value="500" />
</settings>
</sitecore>
</configuration>
@bala-one
bala-one / mvctoheadless.ps1
Created August 1, 2024 02:44
MVC to Headless Content Updates with Sitecore Powershell
###################################################
# Update the following parameters before execution
###################################################
#Starting path in content tree
$startingPath = "master:\content\home"
$defaultLayoutPath = 'master:\layout\mysite\Default'
#Report only and not update any item
<script src="https://unpkg.com/@coveops/hosted-search-page@latest/dist/index.min.js"></script>
<hosted-search-page id="hsp"></hosted-search-page>
<script>
var hostedSearchPage = document.getElementById('hsp');
hostedSearchPage.configure({
orgId: 'YOUR_COVEO_ORG_ID',
apiKey: 'YOUR_PAGES_API_KEY',
pageId: 'YOUR_HOSTED_SEARCH_PAGE_ID'
});
@bala-one
bala-one / Embeddable_Forms_Framework.html
Last active December 15, 2022 03:20
Sitecore Embeddable Forms Demo Code
<html>
<head>
<script type="text/css" src="css/styles.css"></script>
</head>
<body>
<h1>Sitecore Embeddable Forms Demo</h1>
<scef-form formId="{B5D9B438-40DD-4E8B-80BD-A9DDE0DB8382}"></scef-form>
<script type="text/javascript"
src="./sitecore-embeddableforms.umd.js?sc_site=https://sc103cm.dev.local&sc_apikey=DAC359D9-DC3E-43D4-9FCC-CA61F4A43D89">
</script>