forked from Kentico/xperience-algolia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
IAlgoliaObjectGenerator.cs
38 lines (32 loc) · 1.61 KB
/
IAlgoliaObjectGenerator.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using System.Collections.Generic;
using CMS.DocumentEngine;
using Kentico.Xperience.Algolia.Models;
using Newtonsoft.Json.Linq;
namespace Kentico.Xperience.Algolia.Services
{
/// <summary>
/// Generates anonymous <see cref="JObject"/>s from Xperience <see cref="TreeNode"/>s
/// for upserting into Algolia.
/// </summary>
public interface IAlgoliaObjectGenerator
{
/// <summary>
/// Creates an anonymous object with the indexed column names of the and their values loaded from the passed
/// <see cref="AlgoliaQueueItem.Node"/>.
/// </summary>
/// <param name="queueItem">The queue item to process.</param>
/// <returns>The anonymous data that will be passed to Algolia.</returns>
/// <exception cref="ArgumentNullException" />
JObject GetTreeNodeData(AlgoliaQueueItem queueItem);
/// <summary>
/// Splits a <see cref="TreeNode"/>s data into multiple fragments. The "objectID" of each individual fragment
/// <u>must be set</u> within this method.
/// </summary>
/// <remarks>See <see href="https://www.algolia.com/doc/guides/sending-and-managing-data/prepare-your-data/how-to/indexing-long-documents/"/>.</remarks>
/// <param name="originalData">The data from the <see cref="TreeNode"/>.</param>
/// <param name="algoliaIndex">The index which the <see cref="TreeNode"/> belongs to.</param>
/// <returns>One or more anonymous objects that will be passed to Algolia.</returns>
IEnumerable<JObject> SplitData(JObject originalData, AlgoliaIndex algoliaIndex);
}
}