You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// TODO: rethink attributes. Use for example enum for queryType
27
-
// TODO: add comment for all attributes
28
-
29
26
/// Describes all parameters of search query.
30
27
publicclassQuery:Printable{
28
+
/// The type of query.
29
+
///
30
+
/// - PrefixAll: All query words are interpreted as prefixes.
31
+
/// - PrefixLast: Only the last word is interpreted as a prefix (default behavior).
32
+
/// - PrefixNone: No query word is interpreted as a prefix. This option is not recommended.
33
+
publicenumQueryType:String{
34
+
case PrefixAll ="prefixAll"
35
+
case PrefixLast ="prefixLast"
36
+
case PrefixNone ="prefixNone"
37
+
}
38
+
39
+
/// Remove words if no result.
40
+
///
41
+
/// - None: No specific processing is done when a query does not return any result.
42
+
/// - LastWords: When a query does not return any result, the final word will be removed until there is results.
43
+
/// - FirstWords: When a query does not return any result, the first word will be removed until there is results.
44
+
/// - AllOptional: When a query does not return any result, a second trial will be made with all words as optional (which is equivalent to transforming the AND operand between query terms in a OR operand)
45
+
publicenumRemoveWordsIfNoResult:String{
46
+
case None ="None"
47
+
case LastWords ="LastWords"
48
+
case FirstWords ="FirstWords"
49
+
case AllOptional ="allOptional"
50
+
}
51
+
52
+
/// Typo tolerance.
53
+
///
54
+
/// - Enabled: The typo-tolerance is enabled and all matching hits are retrieved. (Default behavior)
55
+
/// - Disabled: The typo-tolerance is disabled.
56
+
/// - Minimum: Only keep the results with the minimum number of typos.
57
+
/// - Strict: Hits matching with 2 typos are not retrieved if there are some matching without typos.
58
+
publicenumTypoTolerance:String{
59
+
case Enabled ="true"
60
+
case Disabled ="false"
61
+
case Minimum ="min"
62
+
case Strict ="strict"
63
+
}
64
+
65
+
// MARK: - Properties
66
+
67
+
/// The minimum number of characters in a query word to accept one typo in this word.
68
+
/// Defaults to 3.
31
69
publicvarminWordSizeForApprox1:UInt=3
70
+
71
+
/// The minimum number of characters in a query word to accept two typos in this word.
72
+
/// Defaults to 7.
32
73
publicvarminWordSizeForApprox2:UInt=7
74
+
75
+
/// If true, the result hits will contain ranking information in _rankingInfo attribute.
76
+
/// Default to false.
33
77
publicvargetRankingInfo=false
78
+
79
+
/// If true, plural won't be considered as a typo (for example car/cars will be considered as equals).
80
+
/// Default to false.
34
81
publicvarignorePlural=false
82
+
83
+
/// If true, enable the distinct feature (disabled by default) if the attributeForDistinct index setting is set.
84
+
/// This feature is similar to the SQL "distinct" keyword: when enabled in a query, all hits containing a duplicate value
85
+
/// for the attributeForDistinct attribute are removed from results. For example, if the chosen attribute is show_name
86
+
/// and several hits have the same value for show_name, then only the best one is kept and others are removed.
35
87
publicvardistinct=false
88
+
89
+
/// The page to retrieve (zero base). Defaults to 0.
36
90
publicvarpage:UInt=0
91
+
92
+
/// The number of hits per page. Defaults to 20.
37
93
publicvarhitsPerPage:UInt=20
94
+
95
+
/// If false, disable typo-tolerance on numeric tokens. Default to true.
38
96
publicvartyposOnNumericTokens=true
97
+
98
+
/// If false, this query won't appear in the analytics. Default to true.
39
99
publicvaranalytics=true
100
+
101
+
/// If false, this query will not use synonyms defined in configuration. Default to true.
40
102
publicvarsynonyms=true
103
+
104
+
/// If false, words matched via synonyms expansion will not be replaced by the matched synonym in highlight result.
105
+
/// Default to true.
41
106
publicvarreplaceSynonyms=true
42
-
publicvaroptionalWordsMinimumMatched:UInt=0
107
+
108
+
/// The list of attribute names to highlight.
109
+
/// By default indexed attributes are highlighted.
43
110
publicvarattributesToHighlight:[String]?
111
+
112
+
/// The list of attribute names to retrieve.
113
+
/// By default all attributes are retrieved.
44
114
publicvarattributesToRetrieve:[String]?
115
+
116
+
/// Filter the query by a set of tags. You can AND tags by separating them by commas.
117
+
/// To OR tags, you must add parentheses. For example tag1,(tag2,tag3) means tag1 AND (tag2 OR tag3).
118
+
/// At indexing, tags should be added in the _tags attribute of objects (for example {"_tags":["tag1","tag2"]} ).
45
119
publicvartagFilters:String?
46
-
publicvarnumericFilters:String?
120
+
121
+
/// A list of numeric filters.
122
+
/// The syntax of one filter is `attributeName` followed by `operand` followed by `value. Supported operands are `<`, `<=`, `=`, `>` and `>=`.
123
+
/// You can have multiple conditions on one attribute like for example `numerics=price>100,price<1000`.
124
+
publicvarnumericFilters:[String]?
125
+
126
+
/// The full text query.
47
127
publicvarfullTextQuery:String?
48
-
publicvarqueryType:String?
49
-
publicvarremoveWordsIfNoResult:String?
50
-
publicvartypoTolerance:String?
128
+
129
+
/// How the query words are interpreted.
130
+
publicvarqueryType:QueryType?
131
+
132
+
/// The strategy to avoid having an empty result page.
0 commit comments