@arsedizioni/ars-utils 21.1.74 → 21.1.76

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2151,6 +2151,24 @@ class ClipperSearchUtils {
2151
2151
  queries = this.concatTextQuery(q.trim(), queries);
2152
2152
  return queries;
2153
2153
  }
2154
+ /**
2155
+ * Normalize text query 2: if the number of quotes, plus and minus is odd, add a quote at the end of the query
2156
+ * @param text : the text to normalize
2157
+ * @returns : the normalized text
2158
+ */
2159
+ static normalizeTextQuery2(text) {
2160
+ let quote = true;
2161
+ for (var i = 0; i < text.length; i++) {
2162
+ const ch = text[i];
2163
+ if (ch === '"' || ch === '+' || ch === '-') {
2164
+ quote = !quote;
2165
+ }
2166
+ }
2167
+ if (quote) {
2168
+ return '"' + text + '"';
2169
+ }
2170
+ return text;
2171
+ }
2154
2172
  /**
2155
2173
  * Return a rank number from a char value (A, B, C)
2156
2174
  * @param value : the char value