CROWNPEAK SEARCHG2 IMPLEMENTATION

Posted by: Priyanka Prajapati

The CrownPeak Search G2 platform is a highly-scalable, high-performance, enterprise-grade indexing and query platform, based upon the Apache Lucene Software Library & Apache SolrCloud.

It does Realtime Indexing, which provides a direct connection between the CMS and the Search G2 platform. This results in assets that can be built within the CMS for delivery directly into the Search G2 platform upon publication.

Here we will look at a very basic implementation and see how to connect all the things together.

Prerequisites:

Understanding of C#, Javascript and Crownpeak CMS API

Now that we have some initial background done, lets start with the steps to implement SearchG2 -

1) The first step is to create a Crownpeak Search Collection. The Collection will contain website index definition and corresponding crawling rules. Please contact Crownpeak support to set up the same.

Once you have the collection name setup, place it inside the web.config file under the appSettings node:

(Each type of workflow has unique collection name, So If you have multiple environment setup then you can condition it accordingly)

2) The next thing you need to do in Crownpeak is, to add insert, update and delete files to the template, from which you want to fetch data in the search result. Create methods inside a CMS Library file (A user defined c# class file) to create, update and delete Search fields and call them from inside the insert, update and delete template files, with specific operation type, for example:

3) In order to implement your own search in asp.net C#, first you should reference below dlls in your application.

i. CrownPeak.SearchG2.dll

ii. SolrNet.dll

Add below additional namespaces to your asp.net page and class files which holds any operations of search index:

4) A new class should be created to hold the search result. This must inherit from CrownPeak.SearchG2.Result.ResultBase, and should implement the properties that you wish to retrieve from the search index. The properties do not have to match exactly, and you can decorate your properties with attributes that describe exactly which field to use to populate it. For example:

5) Creating and Configuring Search Object :

Next step is to create Search object and configure the search properties to customize the result.

Once you get the result set of the search, you can perform any operation as per your requirement.

References:

  1. https://developer.crownpeak.com/Documentation/BestPractices/Search-G2/Search-G2-Introduction.html

  2. https://developer.crownpeak.com/Documentation/BestPractices/Search-G2/Search-G2-Realtime-Indexing.html

  3. https://developer.crownpeak.com/Documentation/BestPractices/Search-G2/Search-G2-CMS-Administration-Interface.html

AccelerateBSi uses cookies to deliver superior functionality and to enhance your experience of our website. Continued use of this site indicates that you accept this policy.