regex query help #1837
-
Hello! I am trying to expose regex matching option for the user & i ran into a problem. It's not actually working. Code https://gitlab.com/kskarthik/go-ifsc/-/blob/master/cmd/root.go#L113 Am i missing anything? When i use this pattern, the program panics
|
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 2 replies
-
@kskarthik thanks for reaching out. I reproduced the panic locally with the same regex query. In this specific query, there is an error returned "zero width assertions not allowed" and hence, I added a log for the error:
This is the output after adding the log for the error:
Please let me know if you have any further questions, thanks! |
Beta Was this translation helpful? Give feedback.
-
@metonymic-smokey I am unable to do regex with this query https://blevesearch.com/docs/Query-String-Query/ could you help me out figuring out the right path to do so? https://gitlab.com/kskarthik/go-ifsc/-/blob/master/cmd/root.go#L113 Example: I expect to get pattern matching for go run main.go search -m adv '/KARB0*/' But matching results are not returned Although this query works: go run main.go search -m adv '+delhi +axis' |
Beta Was this translation helpful? Give feedback.
-
@kskarthik I don't think you can compare the two queries, since one is regex and one isn't. For the regex query, maybe you could try using NewRegexpQuery() for the regex query ? |
Beta Was this translation helpful? Give feedback.
-
@metonymic-smokey where can i find more examples of using |
Beta Was this translation helpful? Give feedback.
-
Hey @kskarthik Line 1480 in a569e45 One of the query types used is regexp. Lines 1574 to 1575 in a569e45 Please let me know if you need any more info, thanks! |
Beta Was this translation helpful? Give feedback.
@kskarthik thanks for reaching out.
I reproduced the panic locally with the same regex query. In this specific query, there is an error returned "zero width assertions not allowed" and hence,
results
was nil.Adding error handling when dealing with returned errors in search() should fix this.
I added a log for the error:
This is the output after adding the log for the error:
Please let me know if you have any further questions, thanks!