LPS-51476

The issue wass caused by when we perform a search in specific field, we added "like(*)" for the Lucene parse's query when add term for our defined "LikeKeywordAnalyzer" field. Please refer to the below detailed explanation:

I assume we have four wiki article.
1. title: foo
2. title: bar
3. title: foo bar
4. title:fooxyz

When search keywords in Search Portlet, we will assgin query value for predefined field (Refer to FacetedSearcher.createFullQuery() method, for example, assetCategoryTitles, title, and so on). 

1. When search "foo" in Search Portlet, the query parse will be "assetCategoryTitles:*foo* title:yu".
2. When specify field (the keywords: title:foo -title:bar) to search in Search Portlet. the query parse will be "(title:*foo* -title:*bar*) (title:foo -title:bar)". This issue occured in here. 

In this case, when we assign query parse for assetCategoryTitles field, the field belongs to LikeKeywordAnalyzer and we will add "like(*)" for the Lucene parse's query, the query parse will be "(title:*foo* -title:*bar*). That is to say, when assign query parse for assetCategoryTitles field, lucene parse will be "title:foo -title:bar", in fact, after lucene parsed, the search field will be changed (from assetCategoryTitles to title). It matchs lucene can performe a search in specific field. However, after field changed, we still add "like(*)" for the field parse's query and it is wrong logic.

So we should judge whether the current field equals lucene parsed field, if yes, we will keep the original field logic (field defined Analyzer). If no, we should keep lucene parsed field query. When assign the query parse for assetCategoryTitles field, the query parse will be "(title:foo -title:bar)". 

Please help check the fix.

Reference : Search may perform search in specific field.
https://www.liferay.com/documentation/liferay-portal/6.2/user-guide/-/ai/searching-for-content-in-liferay-liferay-portal-6-2-user-guide-06--2
http://lucene.apache.org/core/3_5_0/queryparsersyntax.html

Thanks,
Hai