Uploaded image for project: 'Alfresco'
  1. Alfresco
  2. ALF-21940

cm:lastName (and perhaps other fields as well) are locale sensitive on searches with Solr6 even though it is not of type d:mltext

    Details

    • Type: Bug
    • Status: New (View Workflow)
    • Priority: Critical
    • Resolution: Unresolved
    • Affects Version/s: Community Edition 201702 GA
    • Fix Version/s: None
    • Security Level: external (External user)
    • Labels:
      None
    • Environment:
      Alfresco 5.2.e, Alfresco Search Services 1.0.0 (Solr 6)
    • Patch Attached:
      Yes
    • Regression:
      Regression
    • Triage:
      ACE

      Description

      System: Alfresco 5.2.e, Alfresco Search Services 1.0.0 (Solr 6)

      This problem was detected as we saw incomplete search results and inconsistent behaviour when searching for users using live search/people finder. Searching using the admin console works fine as the admin console uses the DB when searching and the live search and people finder uses solr.

      Cannot reproduce with Solr4, this error only seems to appear for me with Solr6

      Test case:

      Prepare and create a user with sys:locale dk.

      people.createPerson("jd123","John","Doe","q123@q123.com",null,true);
      doe = people.getPerson("jd123");
      doe.properties["sys:locale"]="dk";
      doe.save();
      

      Open the node browser and search for Doe as last name using the alfersco-fts, this query will use the DB: =cm:lastName:"Doe"
      One result is expected.

      Next do another search using Solr: cm:lastName:"Doe"
      One result would be expected, however no results appear.

      Now update the user and change its locale to whatever you are using (in my case sv, but could be en_US):

      doe = people.getPerson("jd123");
      doe.properties["sys:locale"]="sv";
      doe.save();
      
      

      Wait for Solr to index the change (up to 15 sec) and redo the searches.

      Open the node browser and search for Doe as last name using the alfersco-fts, this query will use the DB: =cm:lastName:"Doe"
      One result is expected.

      Next do another search using Solr: cm:lastName:"Doe"
      One result is expected.

      Although the property cm:lastName is of type d:text (and not d:mltext) searching on it is locale sensitive. Is this expected behaviour?

      Workaround for the issue is to update all content to have the same locale as the majority of the users:

      
      var ctx = Packages.org.springframework.web.context.ContextLoader.getCurrentWebApplicationContext();
      var behaviourFilter = ctx.getBean('policyBehaviourFilter', Packages.org.alfresco.repo.policy.BehaviourFilter);
      behaviourFilter.disableBehaviour();
      
      //Look for all content with the locale en_US, note that solr is indexing the locale field all lowercase and with an extra _ at the end, hence the en_us_ instead of en_US in the query. 
      query = "sys:locale:\"en_us_\"";
      
      var results = search.query({"query":query, "language":"fts-alfresco"});
      logger.log("Number of nodes "+ results.length);
      for (var i=0;i<results.length;i++) {
      	var result = results[i];
      	logger.log(result.nodeRef);
      	//Change the locale to sv (Swedish)
      	result.properties["sys:locale"]="sv";
      	result.save();
      }
      
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                searchAndDiscovery Search and Discovery
                Reporter:
                marcus.svensson Marcus Svartmark
              • Votes:
                6 Vote for this issue
                Watchers:
                11 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Date of First Response: