-
Notifications
You must be signed in to change notification settings - Fork 0
/
ISuggestOptionsBuilder.cs
135 lines (116 loc) · 6.3 KB
/
ISuggestOptionsBuilder.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
130
131
132
133
134
135
using System.Collections.Generic;
using System.Linq.Expressions;
namespace AzureSearchQueryBuilder.Builders
{
/// <summary>
/// An interface representing a <see cref="SuggestOptions"/> builder.
/// </summary>
/// <typeparam name="TModel">The type of the model representing the search index documents.</typeparam>
public interface ISuggestOptionsBuilder<TModel> : IOrderlessSuggesOptionsBuilder<TModel>
{
/// <summary>
/// Gets a collection of fields to include in the result set.
/// </summary>
IEnumerable<string> Select { get; }
/// <summary>
/// Gets the value indicating that suggestions should be found even if there is a substituted or missing character in the search text.
/// </summary>
bool UseFuzzyMatching { get; }
/// <summary>
/// Gets a list of expressions to sort the results by.
/// Each expression can be either a field name or a call to the geo.distance() function.
/// Each expression can be followed by asc to indicated ascending, and desc to indicate descending.
/// The default is ascending order.
/// There is a limit of 32 clauses for $orderby.
/// </summary>
IEnumerable<string> OrderBy { get; }
/// <summary>
/// Gets the expression that filters the documents considered for producing the completed term suggestions.
/// </summary>
string Filter { get; }
/// <summary>
/// Gets the string tag that appends to search hits.
/// </summary>
string HighlightPostTag { get; }
/// <summary>
/// Gets the string tag that prepends to search hits.
/// </summary>
string HighlightPreTag { get; }
/// <summary>
/// Gets a number between 0 and 100 indicating the percentage of the index that must be covered by a query in order for the query to be reported as a success.
/// </summary>
double? MinimumCoverage { get; }
/// <summary>
/// Gets a list of field names to search for the specified search text.
/// </summary>
IEnumerable<string> SearchFields { get; }
/// <summary>
/// Gets the number of items to retrieve.
/// </summary>
int? Size { get; }
/// <summary>
/// Adds a property to the collection of fields to include in the result set.
/// </summary>
/// <typeparam name="TProperty">The type of the property being selected.</typeparam>
/// <param name="lambdaExpression">An expression to extract a property.</param>
/// <returns>the updated builder.</returns>
ISuggestOptionsBuilder<TModel> WithSelect<TProperty>(Expression<PropertyLambdaDelegate<TModel, TProperty>> lambdaExpression);
/// <summary>
/// Sets the use fuzzy matching value.
/// </summary>
/// <param name="useFuzzyMatching">The desired fuzzy matching mode.</param>
/// <returns>the updated builder.</returns>
ISuggestOptionsBuilder<TModel> WithUseFuzzyMatching(bool useFuzzyMatching);
/// <summary>
/// Uses an expression for sorting the elements of a sequence in ascending order using a specified comparer.
/// </summary>
/// <typeparam name="TProperty">The type of the property to be ordered by.</typeparam>
/// <param name="lambdaExpression">An expression to extract a property from each element.</param>
/// <returns>the updated builder.</returns>
IOrderedSuggestOptionsBuilder<TModel> WithOrderBy<TProperty>(Expression<PropertyLambdaDelegate<TModel, TProperty>> lambdaExpression);
/// <summary>
/// Uses an expression for sorting the elements of a sequence in descending order using a specified comparer.
/// </summary>
/// <typeparam name="TProperty">The type of the property to be ordered by.</typeparam>
/// <param name="lambdaExpression">An expression to extract a property from each element.</param>
/// <returns>the updated builder.</returns>
IOrderedSuggestOptionsBuilder<TModel> WithOrderByDescending<TProperty>(Expression<PropertyLambdaDelegate<TModel, TProperty>> lambdaExpression);
/// <summary>
/// Adds a where clause to the filter expression.
/// </summary>
/// <param name="lambdaExpression">The lambda expression used to generate a filter expression.</param>
/// <returns>the updated builder.</returns>
ISuggestOptionsBuilder<TModel> Where(Expression<BooleanLambdaDelegate<TModel>> lambdaExpression);
/// <summary>
/// Sets the string tag that appends to search hits.
/// </summary>
/// <param name="highlightPostTag">the desired tag.</param>
/// <returns>the updated builder.</returns>
ISuggestOptionsBuilder<TModel> WithHighlightPostTag(string highlightPostTag);
/// <summary>
/// Sets the string tag that prepends to search hits.
/// </summary>
/// <param name="highlightPreTag">the desired tag.</param>
/// <returns>the updated builder.</returns>
ISuggestOptionsBuilder<TModel> WithHighlightPreTag(string highlightPreTag);
/// <summary>
/// sets a number between 0 and 100 indicating the percentage of the index that must be covered by a query in order for the query to be reported as a success.
/// </summary>
/// <param name="minimumCoverage">The desired minimum coverage.</param>
/// <returns>the updated builder.</returns>
ISuggestOptionsBuilder<TModel> WithMinimumCoverage(double? minimumCoverage);
/// <summary>
/// Appends to the list of field names to search for the specified search text.
/// </summary>
/// <typeparam name="TProperty"></typeparam>
/// <param name="lambdaExpression">The lambda expression representing the search field.</param>
/// <returns>the updated builder.</returns>
ISuggestOptionsBuilder<TModel> WithSearchField<TProperty>(Expression<PropertyLambdaDelegate<TModel, TProperty>> lambdaExpression);
/// <summary>
/// Sets the number of items to retrieve.
/// </summary>
/// <param name="top">The desired top value.</param>
/// <returns>the updated builder.</returns>
ISuggestOptionsBuilder<TModel> WithSize(int? size);
}
}