+ /**
+ * Parse a standard search term string into individual search terms and
+ * extract any exact terms searches to be made.
+ *
+ * @return array{terms: array<string>, exacts: array<string>}
+ */
+ protected static function parseStandardTermString(string $termString): array
+ {
+ $terms = explode(' ', $termString);
+ $indexDelimiters = SearchIndex::$delimiters;
+ $parsed = [
+ 'terms' => [],
+ 'exacts' => [],
+ ];
+
+ foreach ($terms as $searchTerm) {
+ if ($searchTerm === '') {
+ continue;
+ }
+
+ $parsedList = (strpbrk($searchTerm, $indexDelimiters) === false) ? 'terms' : 'exacts';
+ $parsed[$parsedList][] = $searchTerm;
+ }
+
+ return $parsed;
+ }
+