philomena-dev/philomena

Using wildcard * in a forum post search in a query that contains spaces always gives zero results

Opened this issue · 2 comments

Describe the bug
When using forum post search (https://derpibooru.org/posts or https://furbooru.org/posts) with a query that contains spaces ( ) and wildcards (*) there are no results where they should be.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://derpibooru.org/posts?pq=any+burning+questions+you which is a forum post search for a query any burning questions you
  2. See that there is a result:
    image
  3. Delete part of the last word in that query and replace it with a wildcard. For example any burning questions yo* https://derpibooru.org/posts?pq=any+burning+questions+yo*
  4. See that there are no results:
    image

Expected behavior
The same post as in step 1. should be found in step 4. because it theoretically matches the query.

Additional context
Adding body: at the begging of the query with a wildcard still gives zero results. The same problem exists on Furbooru.

Using wildcard * works fine provided that there are no spaces in the query.

This isn't a surprise given that post bodies are tokenized and not parsed as terms (parsing as terms would result in a massive explosion of index space). There isn't an Elasticsearch operator that supports any combination of match_phrase and wildcard, so while counterintuitive, this can't really be fixed.

Is it written anywhere on the site? Maybe it should be. And maybe in general when doing such a search with spaces and wildcards instead of just "no posts found!" there should be an explanation.