MCPcopy Index your code
hub / github.com/apache/answer / parseWithin

Method parseWithin

internal/service/search_parser/search_parser.go:199–216  ·  view source on GitHub ↗

parseWithin parse quotes within words like: "hello world"

(query *string)

Source from the content-addressed store, hash-verified

197
198// parseWithin parse quotes within words like: "hello world"
199func (sp *SearchParser) parseWithin(query *string) (words []string) {
200 var (
201 q = *query
202 expr = `(?U)(".+")`
203 )
204 re := regexp.MustCompile(expr)
205 matches := re.FindAllStringSubmatch(q, -1)
206 words = []string{}
207 for _, match := range matches {
208 if len(match[1]) == 0 {
209 continue
210 }
211 words = append(words, match[1])
212 }
213 q = re.ReplaceAllString(q, "")
214 *query = strings.TrimSpace(q)
215 return
216}
217
218// parseNotAccepted return the question has not accepted the answer
219func (sp *SearchParser) parseNotAccepted(query *string) (notAccepted bool) {

Callers 1

ParseStructureMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected