Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Escaping special characters for searches #744

Open
lguariento opened this issue Jan 31, 2022 · 0 comments
Open

[BUG] Escaping special characters for searches #744

lguariento opened this issue Jan 31, 2022 · 0 comments
Labels

Comments

@lguariento
Copy link
Contributor

lguariento commented Jan 31, 2022

When the input search string contains a parenthesis Lucene interprets it as an unescaped special character. For instance, searching for test) or httpclient() .

Error:

<?xml version="1.0" ?><exception><path>/db/apps/doc/modules/view.xql</path><message>exerr:ERROR Syntax error in Lucene query string: Cannot parse 'exist)': Encountered " ")" ") "" at line 1, column 5.
Was expecting one of:
    <EOF> 
    <AND> ...
    <OR> ...
    <NOT> ...
    "+" ...
    "-" ...
    <BAREOPER> ...
    "(" ...
    "*" ...
    "^" ...
    <QUOTED> ...
    <TERM> ...
    <FUZZY_SLOP> ...
    <PREFIXTERM> ...
    <WILDTERM> ...
    <REGEXPTERM> ...
    "[" ...
    "{" ...
    <NUMBER> ...
     [at line 53, column 21]
In function:
	dq:do-query(node()*, xs:string?, xs:string?) [30:30:/db/apps/doc/modules/search.xql]
	dq:query(node()*, map(*), xs:string?, xs:string, xs:string) [-1:-1:/db/apps/doc/modules/search.xql]

We should escape any special character from searches.

Followign exceptions could be useful (even used)

  • double quotes for phrase searches: "this is my search term"
  • asterisk for fuzzy searches: *
  • how about question marks: ?

The query is here.

This issue was originally posted under /website.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants