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

Portal ignores properties "index.search.highlight.fragment.size" and "index.search.highlight.snippet.size"

    Details

      Description

      The following properties

          #
          # Set the fragment size returned from the search result highlighter
          #
          index.search.highlight.fragment.size=80
      
          #
          # Set the number of lines for the snippet returned by a search engine.
          #
          index.search.highlight.snippet.size=3
      

      have no effect because when getting snippets we don't pass in the actual valeus from the com.liferay.portal.kernel.search.QueryConfig, instead we do

      snippet = LuceneHelperUtil.getSnippet(
          luceneQuery, snippetField, StringUtil.merge(values), termCollectingFormatter);
      

      which turns into

      	public static String getSnippet(
      			Query query, String field, String s, Formatter formatter)
      		throws IOException {
      
      		return getSnippet(query, field, s, 3, 80, "...", formatter);
      	}
      

      Master is not affected, Lucene code has been removed, and we already pass in the config from QueryConfig in the related code:

      	protected void addHighlightedField(
      		SearchRequestBuilder searchRequestBuilder, QueryConfig queryConfig,
      		String fieldName) {
      
      		searchRequestBuilder.addHighlightedField(
      			fieldName, queryConfig.getHighlightFragmentSize(),
      			queryConfig.getHighlightSnippetSize());
      
      		String localizedFieldName = DocumentImpl.getLocalizedName(
      			queryConfig.getLocale(), fieldName);
      
      		searchRequestBuilder.addHighlightedField(
      			localizedFieldName, queryConfig.getHighlightFragmentSize(),
      			queryConfig.getHighlightSnippetSize());
      	}
      

        Attachments

        1. fixed.png
          fixed.png
          6 kB
        2. reproduced.png
          reproduced.png
          23 kB

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  4 years, 12 weeks, 4 days ago

                  Packages

                  Version Package
                  6.2.X EE