Wildcards are not considered in site administration menus' search bar
Written By
Christopher Czibere
How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!
While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.
Legacy Article
You are viewing an article from our legacy "FastTrack"
publication program, made available for informational purposes. Articles
in this program were published without a requirement for independent
editing or verification and are provided"as is" without
guarantee.
Before using any information from this article, independently verify its
suitability for your situation and project.
Issue
- When searching for a document in e.g. the Documents and Media tab the search functionality doesn't return the document if its name contains underscores.
- We have a document named 'Qwe_Rtz_Uio.txt' and if we search for parts of it, like "qwe" or "rtz" it doesn't show the document in the search results
Resolution
- The observed behaviour is a limitation coming from the design of search.
-
A customization would be required to make the Documents and Media search work as specified above (i.e. to return qwe_rtz_uio.txt for keyword "rtz"). This can be done by adding a new field to the index document, analyzed by a simple or stop analyzer (or any custom analyzer that splits by the underscore '_'), then extending the search query to do a match_phrase_prefix search on this field.
- The ElasticSearch directly searches the database where the data and files are stored. Underscores are not considered separators in the database, they're only used to have a clearer look at the displayed text. For example: ABC_DEF_GHI.txt > is ABCDEFGHI.txt in the database and when searching for it.
-
If you consider the following files:
- Qwe Rtz Uio.txt
- Qwe-Rtz-Uio.txt
- qwe_rtz_uio.txtIf you consider the following files:
- The title field is analyzed by standard analyzer which produces the following tokes for the above filenames.
- Qwe Rtz Uio.txt -> qwe, rtz, uio.txt
- Qwe-Rtz-Uio.txt -> qwe, rtz, uio.txt
- qwe_rtz_uio.txt -> qwe_rtz_uio.txt
- Document names should be separated by dash (-) or a space.
Did this article resolve your issue ?