Closed karangarg45 closed 3 years ago
Hey @karangarg45,
in the code example you did not correctly string escape the quotes.
You use: 'keyword: "some \"random\"" '
whereas it should be 'keyword: "some \\"random\\"" '
(try executing this on the Node.js command line/browser dev tools to test this).
@bripkens Thanks for the quick response. The string shared by you gives the correct output but now my output contains extra \
charcter.
This is what the output looks like
@karangarg45 Your output looks correct to me. The output string contains only the characters some "random"
.
In term: "some \"random\""
the 2 slashes and 2 outer quotation marks don't exist as part of the string. They are how the terminal/console/browser shows you the data.
"some \"random\"" === 'some "random"'
The original lucene lib had an issue and a known limitation related to parse the escaped quotes. https://github.com/thoward/lucene-query-parser.js/issues/1
When i try to do the same in this library, i get some unexpected result(not an error though). Is it also a limitation with this parser too?
Codesandbox example for the same https://codesandbox.io/s/busy-browser-kzykt?file=/src/index.js