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

Catalog search does not handle correctly parenthesis inside quotes #3879

Closed
erral opened this issue Nov 29, 2023 · 1 comment · Fixed by #3881
Closed

Catalog search does not handle correctly parenthesis inside quotes #3879

erral opened this issue Nov 29, 2023 · 1 comment · Fixed by #3881

Comments

@erral
Copy link
Member

erral commented Nov 29, 2023

BUG/PROBLEM REPORT (OR OTHER COMMON ISSUE)

What I did:

  • Add a page with parenthesis enclosed text as a title
  • Try to search that page using quoted query

What I expect to happen:

  • The search searches the page

What actually happened:

  • The search does not find the page
  • When accessing through REST API (because plone.app.querystring uses the munge_search_term function here), we get an error because the query is transformed to an unknown string for ZCatalog

What version of Plone/ Addons I am using:

  • Plone 6
@mauritsvanrees
Copy link
Member

Let me check.
I have created a Plone 6.0 site with two pages, one with title "Hello World Plain" and one with "Hello (World) Parentheses".
In the SearchableText and Title indexes, the parentheses are stripped away, so they only have ['hello', 'world', 'parentheses'] or similar.

  • Search for hello world:
    • munge_search_term gives hello AND world*
    • This finds both.
  • Search for "hello world", so in quotes:
    • munge_search_term gives hello world"
    • This finds both.
  • Search for hello (world):
    • munge_search_term gives hello AND "("world")"*
    • This finds both.
  • Search for "hello (world)", so in quotes:
    • munge_search_term gives "hello "("world")"", which looks wrong.
    • This finds nothing.

Now I try it with your branch. There is no change, except in the last one, where munge_search_term correctly gives "hello (world)", and we find both pages.

So looks good to me. Thanks!
Same for your plone.app.querystring PR.

I wonder if we could instead simply add the parentheses to BAD_CHARS, as they are ignored anyway, but they are not exactly "bad" characters, just a bit annoying. ;-). So let's leave that as it is.

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

Successfully merging a pull request may close this issue.

2 participants