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

searchEngineId can't be configured DLFileEntry search / index operations

    Details

      Description

      Description: Unable to set an alternate search engine in 7.1 and 7.2 for DLFileEntry, which was possible in 7.0.

      By default, documents are indexed and searched with the search engine corresponding to the ID "SYSTEM_ENGINE"
      However, using a portal property you can specify which search engine will be used to index/search documents for any given model:
      index.search.engine.id[com.liferay.journal.search.JournalArticleIndexer]=SEARCH_ENGINE_1
      index.search.engine.id[com.liferay.portal.kernel.model.User]=SEARCH_ENGINE_2

      Note 1: For any given search only 1 search engine will be queried. The search engine that is used depends on the indexer that is performing the search. For a single indexer search, the SYSTEM_ENGINE will be used unless an alternate search engine has been set in index.search.engine.id. In the case of a multi-indexer search, com.liferay.portal.search.internal.searcher.FacetedSearcherImpl will use SYSTEM_ENGINE, unless an alternate search engine is set, ie index.search.engine.id[com.liferay.portal.search.internal.searcher.FacetedSearcherImpl]=SEARCH_ENGINE_1. Point being, whether its a single indexer search, or a multi-indexer search, only 1 search engine will be used. This means that if documents are indexed into different search engines, it will not be possible to return all of them in a single search.

      Note 2: For indexers extending BaseIndexer, the indexer class name is used as the filter in the portal property. For DefaultIndexer's, the class name used in the *SearchRegistrar to register and create the ModelSearchDefinition/ModelSearchSettings is used as the filter in the portal property. There are also cases where 2 separate indexers are used for indexing/searching, ie com.liferay.bookmarks.model.BookmarksEntry and com.liferay.bookmarks.search.BookmarksSearcher to index and search Bookmarks

      Steps to reproduce:

      1. In portal-ext.properties, set
        index.search.engine.id[com.liferay.document.library.kernel.model.DLFileEntry]=SOLR_ENGINE
        index.search.engine.id[com.liferay.portlet.documentlibrary.util.DLSearcher]=SOLR_ENGINE
        
      2. Start portal, create a Document called alpha
      3. In the Documents and Media search bar, search for alpha
        Expected Result: Search would not find the document because an alternate search engine has been set for DLFileEntry/DLSearcher.
        Actual Result: The document is found in the search results.

       

      Optional: To test that using an alternate search engine works after the fix:

      Configure the Solr Connector to use a different search.engine.id:

      1) Go to SolrSearchEngineConfigurator and change

      @Reference(
      	target = "(&(search.engine.id=SYSTEM_ENGINE)(search.engine.impl=Solr))"
      )

      to

      @Reference(
      	target = "(&(search.engine.id=SOLR_ENGINE)(search.engine.impl=Solr))"
      )

      2) Go to SolrSearchEngine and change

      @Component(
      	immediate = true,
      	property = {"search.engine.id=SYSTEM_ENGINE", "search.engine.impl=Solr"},
      	service = {SearchEngine.class, SolrSearchEngine.class}
      )

      to

      @Component(
      	immediate = true,
      	property = {"search.engine.id=SOLR_ENGINE", "search.engine.impl=Solr"},
      	service = {SearchEngine.class, SolrSearchEngine.class}
      )

      3) Start a Solr server and deploy the Solr module
      4) Repeat original steps 1-3. The document should be found when performing a search. 
      5) Create a web content article called alpha
      6) Go to the home page and use the Search Bar to search for alpha

      Expected Result: Search would only find the web content article and not the document because the "SYSTEM_ENGINE" ID is being used for the search.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              linda.sui Linda Sui
              Reporter:
              joshua.cords Joshua Cords
              Participants of an Issue:
              Recent user:
              Jason Pince
              Engineering Assignee:
              Bryan Engler
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved:
                Days since last comment:
                28 weeks, 4 days ago

                  Packages

                  Version Package
                  7.1.10 DXP FP18
                  7.1.X
                  7.2.10 DXP FP5
                  7.2.10.2 DXP SP2
                  7.2.X
                  7.3.10 DXP GA1
                  Master