func ParseSearchString(s string) SearchSpecs {
	s = strings.TrimSpace(s)

	if s == "" {
		return SearchSpecs{}
	}

	// break into words
	words := strings.Split(s, " ")

	// combine phrases first, then extract OR conditions, then extract NOT conditions
	// and the leftovers will be AND'd
	ret := SearchSpecs{}
	words = combinePhrases(words)
	words = extractOrConditions(words, &ret)
	words = extractNotConditions(words, &ret)

	for _, w := range words {
		// ignore empty quotes
		word := extractPhrase(w)
		if word == "" {
			continue
		}
		ret.MustHave = append(ret.MustHave, word)
	}

	return ret
}
// ParseSearchString parses the Q value and returns a SearchSpecs object.
//
// By default, any words in the search value must appear in the results.
// Words encompassed by quotes (") as treated as a single term.
// Where keyword "OR" (case-insensitive) appears (and is not part of a quoted phrase), one of the
// OR'd terms must appear in the results.
// Where a keyword is prefixed with "-", that keyword must not appear in the results.
// Where OR appears as the first or last term, or where one of the OR operands has a
// not prefix, then the OR is treated literally.
ParseSearchString parses the Q value and returns a SearchSpecs object.

By default, any words in the search value must appear in the results.
Words encompassed by quotes (") as treated as a single term.
Where keyword "OR" (case-insensitive) appears (and is not part of a quoted phrase), one of the
OR'd terms must appear in the results.
Where a keyword is prefixed with "-", that keyword must not appear in the results.
Where OR appears as the first or last term, or where one of the OR operands has a
not prefix, then the OR is treated literally.
// ParseSearchString parses the Q value and returns a SearchSpecs object . // // By default any words in the search value must appear in the results . // Words encompassed by quotes ( " ) as treated as a single term . // Where keyword " OR " ( case - insensitive ) appears ( and is not part of a quoted phrase ) one of the // OR ' d terms must appear in the results . // Where a keyword is prefixed with " - " that keyword must not appear in the results . // Where OR appears as the first or last term or where one of the OR operands has a // not prefix then the OR is treated literally .
func ParseSearchString(s string) SearchSpecs {
	s = strings.TrimSpace(s)
	if s == "" {
		return SearchSpecs{}
	}
	words := strings.Split(s, " ")
	ret := SearchSpecs{}
	words = combinePhrases(words)
	words = extractOrConditions(words, &ret)
	words = extractNotConditions(words, &ret)
	for _, w := range words {
		word := extractPhrase(w)
		if word == "" {
			continue
		}
		ret.MustHave = append(ret.MustHave, word)
	}
	return ret
}
func ParseSearchString ( s string ) SearchSpecs { s = strings . TrimSpace ( s ) if s == " " { return SearchSpecs { } } words := strings . Split ( s , " " ) ret := SearchSpecs { } words = combinePhrases ( words ) words = extractOrConditions ( words , & ret ) words = extractNotConditions ( words , & ret ) for _ , w := range words { word := extractPhrase ( w ) if word == " " { continue } ret . MustHave = append ( ret . MustHave , word ) } return ret }
ParseSearchString parses the Q value and returns a SearchSpecs object.
ParseSearchString parses the Q value and returns a SearchSpecs object .
// break into words // combine phrases first, then extract OR conditions, then extract NOT conditions // and the leftovers will be AND'd // ignore empty quotes