-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathIAutocompleteOptionsBuilder.cs
More file actions
122 lines (105 loc) · 5.32 KB
/
Copy pathIAutocompleteOptionsBuilder.cs
File metadata and controls
122 lines (105 loc) · 5.32 KB
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
using Azure.Search.Documents;
using Azure.Search.Documents.Models;
using System.Collections.Generic;
using System.Linq.Expressions;
namespace AzureSearchQueryBuilder.Builders
{
/// <summary>
/// An interface representing an <see cref="AutocompleteOptions"/> builder.
/// </summary>
/// <typeparam name="TModel">The type of the model representing the search index documents.</typeparam>
public interface IAutocompleteOptionsBuilder<TModel>
{
/// <summary>
/// Gets the autocomplete mode.
/// </summary>
/// <remarks>
/// * <see cref="AutocompleteMode.OneTerm"/> - Only one term is suggested. If the query has two terms, only the last term is completed.
/// * <see cref="AutocompleteMode.TwoTerms"/> - Matching two-term phrases in the index will be suggested.
/// * <see cref="AutocompleteMode.OneTermWithContext"/> - Completes the last term in a query with two or more terms, where the last two terms are a phrase that exists in the index.
/// </remarks>
AutocompleteMode Mode { 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 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>
/// Sets the autocomplete mode.
/// </summary>
/// <param name="autocompleteMode">The desired autocomplete mode.</param>
/// <returns>the updated builder.</returns>
IAutocompleteOptionsBuilder<TModel> WithMode(AutocompleteMode autocompleteMode);
/// <summary>
/// Sets the use fuzzy matching value.
/// </summary>
/// <param name="useFuzzyMatching">The desired fuzzy matching mode.</param>
/// <returns>the updated builder.</returns>
IAutocompleteOptionsBuilder<TModel> WithUseFuzzyMatching(bool? useFuzzyMatching);
/// <summary>
/// Build an <typeparamref name="AutocompleteOptions"/> object.
/// </summary>
/// <returns>the <typeparamref name="AutocompleteOptions"/> object.</returns>
AutocompleteOptions Build();
/// <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>
IAutocompleteOptionsBuilder<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>
IAutocompleteOptionsBuilder<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>
IAutocompleteOptionsBuilder<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>
IAutocompleteOptionsBuilder<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>
IAutocompleteOptionsBuilder<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>
IAutocompleteOptionsBuilder<TModel> WithSize(int? size);
}
}