parseQuestionID check whether specified question's id
(query *string)
| 302 | |
| 303 | // parseQuestionID check whether specified question's id |
| 304 | func (sp *SearchParser) parseQuestionID(query *string) (questionID string) { |
| 305 | var ( |
| 306 | q = *query |
| 307 | expr = `inquestion:(\d+)` |
| 308 | ) |
| 309 | |
| 310 | re := regexp.MustCompile(expr) |
| 311 | res := re.FindStringSubmatch(q) |
| 312 | if len(res) == 2 { |
| 313 | questionID = res[1] |
| 314 | q = re.ReplaceAllString(q, "") |
| 315 | } |
| 316 | |
| 317 | *query = strings.TrimSpace(q) |
| 318 | return |
| 319 | } |
| 320 | |
| 321 | // parseIsAnswer check the result if only limit answer or not |
| 322 | func (sp *SearchParser) parseIsAnswer(query *string) (isAnswer bool) { |