Bug #12357

Changes to reference code separator are not shown in search/browse results

Added by Dan Gillean 10 months ago. Updated about 1 month ago.

Status:VerifiedStart date:07/31/2018
Priority:MediumDue date:
Assignee:-% Done:

0%

Category:Administration / settings
Target version:Release 2.5.0
Google Code Legacy ID: Tested version:2.4, 2.5
Sponsored:No Requires documentation:

Description

  • Log in as an administrator in an instance with data, where ref code inheritance is already turned on, and the default - dash separator is in use
  • Navigate to Admin > Settings, and find the Global setting for the default reference code separator
  • Change this from a dash to a / slash, and save
  • For good measure, clear the application cache, restart memcached and PHP-FPM, and open a new incognito browser window
  • Navigate to Browse > Archival descriptions, and remove the top-level description filter
Error encountered
  • The dash is still displayed in the search/browse results as the default separator
  • Clicking through to a description shows the expected / slash separator on the archival description view page
Expected result
  • When the global setting is changed, these changes should be reflected throughout AtoM
  • The separator used on the archival description search/browse results should be the same as that found in Admin > Settings > Global > Default separator

i18n-notification.png (14 KB) Dan Gillean, 03/20/2019 08:20 AM

History

#1 Updated by Dan Gillean 7 months ago

  • Tested version 2.5 added

From a post in the AtoM User forum: (here )

We ran into Bug #12357 too, having selected / as our ref code separator. It turns out to be a rare case where repopulating the search index is actually the problem rather than the solution.

The ref codes seen in the browse list come from the index, rather than being built on the fly, unlike the ref codes seen in individual descriptions. If we resave an individual description, the ref-code separator seen for that description in the browse list respects the setting (/), but if we repopulate the index it reverts to the default (-). Over time, we end up with a mixture, which looks a bit odd.

The problem arises, or at least is expressed, in

plugins/arElasticSearchPlugin/lib/model/arElasticSearchInformationObjectPdo.class.php

Line 355, in the getReferenceCode function, reads:

$refcode .= implode(sfConfig::get('app_separator_character', '-'), $identifiers);

[ note: appears on line 421 in AtoM 2.5 ]

When we resave an individual description, this runs under the app and the app sees the config, so we get the set separator. When we repopulate the index, this runs under the task and the task can't see the config, so we default to '-'.

As a workaround, we could respect the UI setting by replacing the line with something like:

    //$refcode .= implode(sfConfig::get('app_separator_character', '-'), $identifiers);
    $separator_character = QubitPdo::fetchColumn('SELECT value FROM setting_i18n WHERE id IN (SELECT id FROM setting WHERE name = "separator_character")', array());
    if (!$separator_character) {$separator_character = array('-');}
    $refcode .= implode($separator_character[0], $identifiers);

Or, as it's just a workaround, and we're not likely to change the setting, we could hard code it:

    $refcode .= implode('/', $identifiers);

which, pending a more elegant solution, is what we've done.

#2 Updated by Dan Gillean 4 months ago

Another useful comment from the community, here (2019-01-14):

I Found that the problem is very simple! on the line 421:

$refcode .= implode(sfConfig::get('app_separator_character', '-'), $identifiers); 

https://github.com/artefactual/atom/blob/qa/2.5.x/plugins/arElasticSearchPlugin/lib/model/arElasticSearchInformationObjectPdo.class.php#L421

For some reason, the function "sfConfig::get" is not able to get the CHR defined in AtoM settings as it should!
"Admin > Settings > Global > Reference code separator"

Since it can't get the value, it will use the given alternative character "-" for the reference code separator whatever value we have placed in the settings.

I've spend some time (hours) trying to understand why but I haven't been able to fix the problem. I guess someone that knows the AtoM code better than I, will easily fix this and in a short time.

#3 Updated by Dan Gillean 2 months ago

Confirmed that repopulating the index and clearing the application cache(s) resolves the issue.

Would like it if we could add a note in the UI by this setting, like we do for i18n languages settings - see attached screenshot.

Text could read:

Please rebuild the search index and clear the application cache if you are changing the reference code separator setting.

php symfony search:populate
php symfony cc

You may need to restart PHP-FPM and Memcached as well.

Will also add a note to the docs.

#4 Updated by Steve Breker about 1 month ago

  • Status changed from New to Code Review

Alert added. PR ready for review.

https://github.com/artefactual/atom/pull/876

#5 Updated by Mike Cantelon about 1 month ago

  • Assignee set to Mike Cantelon

#6 Updated by Mike Cantelon about 1 month ago

  • Status changed from Code Review to Feedback
  • Assignee changed from Mike Cantelon to Steve Breker

Looks good!

#7 Updated by Steve Breker about 1 month ago

  • Status changed from Feedback to QA/Review
  • Assignee deleted (Steve Breker)

Merged to qa/2.5.x. Ready for QA.

#8 Updated by Dan Gillean about 1 month ago

  • Status changed from QA/Review to Verified
  • Requires documentation deleted (Yes)

#9 Updated by Dan Gillean about 1 month ago

  • Target version set to Release 2.5.0

Also available in: Atom PDF