Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-73013

Search doesn't work for "path" field mapped to LikeKeywordAnalyzer analyzer when it contains uppercase terms

    Details

      Description

      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:

      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-41265 adding 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

      1. Go to "Documents and media" section
      2. Add three files called: myfile.txt, MyFile.txt and MYFILE.txt
      3. In same "Documents and media" section, execute a search with myfile word:
        The three files are displayed
      4. 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

      Note: 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.


      Solution Notes

      • 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"

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  2 years, 9 weeks, 6 days ago

                  Packages

                  Version Package
                  6.2.X EE