Closed vbier closed 11 months ago
Fixing this issue also fixes: https://github.com/nextcloud/fulltextsearch/issues/751 https://github.com/nextcloud/fulltextsearch/issues/768
And most likely also: https://github.com/nextcloud/files_fulltextsearch/issues/222 https://github.com/nextcloud/files_fulltextsearch/issues/224 https://github.com/nextcloud/fulltextsearch_elasticsearch/issues/260
Has been fixed with https://github.com/nextcloud/fulltextsearch_elasticsearch/pull/237. I have just validated that searching now works with version 27.0.3.
As soon as a username has some special character, no documents are found in the fulltext search. This effectively breaks fulltext search for all AD/LDAP users, which makes nextcloud unsuitable for use in corporate environments.
This is caused by the filter restricting documents by user permissions in https://github.com/nextcloud/fulltextsearch_elasticsearch/blob/91f9440cc6d9fa050446d97c8efb12c417085453/lib/Service/SearchMappingService.php#L307 The term query on users or owner does not find usernames that do not only consist of characters and digits because the type of the users and owner fields are text:
When using the term query on text fields, the searched term is analyzed (see the big fat warning here: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-term-query.html) and does not match. Either fix the filter to use the subfield users.keyword and owner.keyword:
or change the field type to keyword.