Skip to content

Bug: No substring search in backend #17

Closed
ballaschk opened this issue Nov 4, 2019 · 6 comments
Closed

Bug: No substring search in backend #17

ballaschk opened this issue Nov 4, 2019 · 6 comments

Comments

@ballaschk
Copy link
Collaborator

When searching contacts, documents or images from the main editor, only fully matching words are accepted as search terms in the self-populating results screen. This is true for tags, file names, image descriptions, etc. ...

Example:

  • "uh" does not give "uhr.png" as an image result, only "uhr" will
  • "stoc" does not give "Stock Image" as an image result", only "Stock" will
  • "Mart" does not give Martin B and Martin V as contacts results, only "Martin" will.
  • "Sicherheit" will not return documents tagged with "Sicherheitsbelehrung"
  • etc.
@donald
Copy link
Member

donald commented Nov 15, 2019

Contacts / Persons seem to work with substring search in the backend.

Unlike Contacts, Documents and Images use the wagtail search for which we currently use the postgres_search backend. The search-function of that backend, however, doesn't seem to support substring searches, so this is an upstream issue. However, the backend is able to index for substring match and the autocomplete-function of the backend can search for partial matches. I could even make that available to Documents and Image (Index and Chooser) by just replacing .search() with .autocomplete(). So we might have dirty a workaround but I'm not yet decided how this hack could be integrated.

@donald
Copy link
Member

donald commented Nov 15, 2019

@ballaschk: Experimental patch is applied on the life server. Please test.

@ballaschk
Copy link
Collaborator Author

ballaschk commented Nov 19, 2019

Great! It works in the interface that comes up in the rich text editor ("Images", "Documents" buttons).

But not in the "Contact" picker after adding a section with a contact (see below).

Screenshot 2019-11-19 at 09 53 34 Screenshot 2019-11-19 at 09 53 42

@donald
Copy link
Member

donald commented Nov 19, 2019

Thanks for the screenshot. With the above commit, I only fixed "Documents" and "Images" . "Contacts" already work from the page, where you edit the Contacts. So there is the chooser/picker for contacts left. I'll have a look into that.

@donald
Copy link
Member

donald commented Nov 19, 2019

I've made a workaround for the "Contacts" chooser. Test, please. In my test "her" is not matched , I think postgres fulltext index has stopwords for common words like "the" "it" and possible "his" and "her".

@ballaschk
Copy link
Collaborator Author

Worked flawlessly in the instances I needed it. Thanks a lot!

Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants