This repository has been archived by the owner on Mar 11, 2020. It is now read-only.
/
ISearchHelper.cs
129 lines (114 loc) · 5.99 KB
/
ISearchHelper.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using GSoft.Dynamite.Taxonomy;
using Microsoft.Office.Server.Search.Administration;
using Microsoft.Office.Server.Search.Administration.Query;
using Microsoft.Office.Server.Search.Query;
using Microsoft.Office.Server.Search.Query.Rules;
using Microsoft.SharePoint;
namespace GSoft.Dynamite.Search
{
/// <summary>
/// Search service utilities
/// </summary>
public interface ISearchHelper
{
/// <summary>
/// Gets the default search service application from a site.
/// </summary>
/// <param name="site">The site.</param>
/// <returns>The search service application.</returns>
SearchServiceApplication GetDefaultSearchServiceApplication(SPSite site);
/// <summary>
/// Get the service application by its name
/// </summary>
/// <param name="appName">Name of the application.</param>
/// <returns>
/// The search service application.
/// </returns>
SearchServiceApplication GetSearchServiceApplicationByName(string appName);
/// <summary>
/// Creates a site search scope if it doesn't exist yet
/// </summary>
/// <param name="site">The site collection</param>
/// <param name="scopeName">The name of the search scope</param>
/// <param name="displayGroupName">The scope's display group</param>
/// <param name="searchPagePath">The scope's custom search page url (cannot be empty)</param>
/// <returns>The search scope</returns>
Scope EnsureSiteScope(SPSite site, string scopeName, string displayGroupName, string searchPagePath);
/// <summary>
/// Creates a farm-wide shared search scope
/// </summary>
/// <param name="site">The site collection of the context</param>
/// <param name="scopeName">The name of the shared scope to create</param>
/// <param name="displayGroupName">The search scope display group name</param>
/// <param name="searchPagePath">Path to scope-specific search page</param>
/// <returns>The newly created scope</returns>
Scope EnsureSharedScope(SPSite site, string scopeName, string displayGroupName, string searchPagePath);
/// <summary>
/// Ensure a managed property in the search service application schema
/// </summary>
/// <param name="site">The context site</param>
/// <param name="managedPropertyInfo">The managed property info</param>
/// <returns>The managed property</returns>
ManagedProperty EnsureManagedProperty(SPSite site, ManagedPropertyInfo managedPropertyInfo);
/// <summary>The delete managed property.</summary>
/// <param name="site">The site.</param>
/// <param name="managedPropertyInfo">The managed property info.</param>
void DeleteManagedProperty(SPSite site, ManagedPropertyInfo managedPropertyInfo);
/// <summary>The ensure result type.</summary>
/// <param name="site">The site.</param>
/// <param name="resultType">The result type.</param>
/// <returns>The <see cref="ResultItemType"/>.</returns>
ResultItemType EnsureResultType(SPSite site, ResultTypeInfo resultType);
/// <summary>The delete result type.</summary>
/// <param name="site">The site.</param>
/// <param name="resultType">The result type.</param>
void DeleteResultType(SPSite site, ResultTypeInfo resultType);
/// <summary>
/// Gets the result source by name using the default search service application
/// </summary>
/// <param name="site">The site collection.</param>
/// <param name="resultSourceName">Name of the result source.</param>
/// <param name="scopeOwnerLevel">The level of the scope's owner.</param>
/// <returns>
/// The corresponding result source.
/// </returns>
ISource GetResultSourceByName(SPSite site, string resultSourceName, SearchObjectLevel scopeOwnerLevel);
/// <summary>The ensure result source.</summary>
/// <param name="contextSite">The context site.</param>
/// <param name="resultSourceInfo">The result source info.</param>
/// <returns>The <see cref="Source"/>.</returns>
Source EnsureResultSource(SPSite contextSite, ResultSourceInfo resultSourceInfo);
/// <summary>The delete result source.</summary>
/// <param name="contextSite">The context site.</param>
/// <param name="resultSourceInfo">The result source info.</param>
void DeleteResultSource(SPSite contextSite, ResultSourceInfo resultSourceInfo);
/// <summary>
/// Deletes the result source.
/// </summary>
/// <param name="contextSite">Current site collection.</param>
/// <param name="resultSourceName">Name of the result source.</param>
/// <param name="level">The level.</param>
void DeleteResultSource(SPSite contextSite, string resultSourceName, SearchObjectLevel level);
/// <summary>
/// Creates a custom property rule
/// </summary>
/// <param name="resultTypeRule">The result type rule metadata</param>
/// <returns>The created property rule</returns>
PropertyRule CreateCustomPropertyRule(ResultTypeRuleInfo resultTypeRule);
/// <summary>
/// Add faceted navigation refiners for a taxonomy term and its reuses
/// </summary>
/// <param name="site">The site</param>
/// <param name="navigationInfo">The faceted navigation configuration object</param>
void AddFacetedRefinersForTerm(SPSite site, FacetedNavigationInfo navigationInfo);
/// <summary>
/// Deletes all refiners for the specified term and its reuses regardless previous configuration
/// </summary>
/// <param name="site">The site</param>
/// <param name="term">The term info object</param>
void RemoveFacetedRefinersForTerm(SPSite site, TermInfo term);
}
}