Affects Version/s: 6.2.10 EE GA1, 6.2.X EE
Fix Version/s: 6.2.X EE
This bug is not reproducible on master/7.x branches: LikeKeywordAnalyzer was removed in 7.0 and "like" query logic was completely rewritten
Search of words with uppercase letters doesn't work for fields with LikeKeywordAnalyzer analyzer
Root cause of this issue: queries with 'like' are turned to lowercase, see:
That code was originally added in
LPS-29385because, with the exception of KeywordAnalyzer, the rest of lucene analyzers transforms in lowercase all the tokens before storing them into the index.
LikeKeywordAnalyzer delegates tokenization to KeywordAnalyzer and switch search to "like=true" in LuceneHelperImpl
As KeywordAnalyzer doesn't turn tokens to lowercase, but query is lowercased, no results are obtained for words with uppercase letters.
This issue is reproduced in all fields that uses LikeKeywordAnalyzer, but some workarounds were applied in some cases:
- assetCategoryTitles: issue was solved in
LPS-41265adding a call to StringUtil.toLowerCase
- assetTagNames: problem is not reproduced because tags are always stored in database as lowecase
- path: problem is reproduced, search in Document Library doesn't work for files with uppercase names
Steps to reproduce
- Go to "Documents and media" section
- Add three files called: myfile.txt, MyFile.txt and MYFILE.txt
- In same "Documents and media" section, execute a search with myfile word:
The three files are displayed
- In same "Documents and media" section, execute a search with my word:
Correct behavior: the three files are displayed
Wrong behavior: only 'myfile.txt' file is displayed
: in order to test this issue, it is important that created documents don't have the same name than creator user. If you are using "test" user and you create "test", "Test" and "TEST" documents, you are not going to reproduce it because it will match the name in userName field.
- The fix addresses the problem in the path field by lowercasing the title of the document when writing it into the "path" field before storing in the search index.
- Applying or removing a patch containing this fix requires to reindex Documents and Media entries to keep the content of the "path" field consistent in existing search index documents for DM entries.
- Go to Control Panel - Apps - App Manager
- Expand Lifery Core
- Find "Documents and Media" in the list
- Click on "Reindex Search"