Skip to content

[FINNA-4049] Marc: Index series key and order#106

Open
rajaro wants to merge 8 commits intoNatLibFi:devfrom
rajaro:series-key-order
Open

[FINNA-4049] Marc: Index series key and order#106
rajaro wants to merge 8 commits intoNatLibFi:devfrom
rajaro:series-key-order

Conversation

@rajaro
Copy link
Contributor

@rajaro rajaro commented Feb 10, 2026

No description provided.

$parts = [];

foreach ($matches[0] as $match) {
$parts[] = str_pad($match, 6, '0', STR_PAD_LEFT);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Käyttäisin tässä samaa menetelmää kuin AbstractCallNumber::createSortableString, eli numeron eteen lisätään vain sen pituus merkkeinä.

{
$seriesKeys = [];
$seriesOrder = '';
$workIdSets = $this->getWorkIdentificationData();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nyt kun getWorkIdentificationData-metodia kutsutaan mahdollisesti useamman kerran, voisi siihen lisätä cachen (samaan tapaan kuin esim. getUniqueIDs-metodissa).

Comment on lines +1390 to +1391
if (!empty($workIdSets[0]['authors'])) {
$author = $this->metadataUtils->normalizeKey($workIdSets[0]['authors'][0]['value']);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!empty($workIdSets[0]['authors'])) {
$author = $this->metadataUtils->normalizeKey($workIdSets[0]['authors'][0]['value']);
if ($author = $workIdSets[0]['authors'][0]['value'] ?? null) {
$author = $this->metadataUtils->normalizeKey($author);

*
* @return array
*/
public function getSeriesData()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tämän olisi parempi toimia samaan tapaan kuin getWorkIdentificationData, eli niin, että SolrUpdater tekee varsinaiset avaimet, ja tämä metodi palauttaa vain ne tiedot, joiden perusteella avaimet tehdään. Näin voidaan varmistaa, ettei avaintentekorutiinia tarvitse toistaa eri formaateissa, jos toiminnallisuutta laajennetaan niihin.

@rajaro rajaro requested a review from EreMaijala March 3, 2026 13:21
{
$seriesKeys = [];
$seriesOrder = '';
$workIdSets = $metadataRecord->getWorkIdentificationData();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Voisi olla selkeämpää, että getSeriesKeyData palauttaisi myös tekijätiedot (vaikka se sitten kaivaisi ne getWorkIdentificationData:lta), niin toiminnot eivät olisi toisistaan riippuvaisia.

$seriesKeys = [];
$seriesOrder = '';
$workIdSets = $metadataRecord->getWorkIdentificationData();
if ($author = $workIdSets[0]['authors'][0]['value'] ?? null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Riittääkö, että avain tehdään ensimmäiselle tekijälle?

Comment on lines +142 to +143
if (!empty($sd['language'])) {
$seriesKey .= ' ' . $sd['language'];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Toiston välttämiseksi laittaisin nämä tähän tyyliin:

Suggested change
if (!empty($sd['language'])) {
$seriesKey .= ' ' . $sd['language'];
if ($language = $sd['language'] ?? null) {
$seriesKey .= ' ' . $language;

}
$seriesKeys[] = $seriesKey;
if (!empty($sd['order'])) {
$seriesOrder = $this->getSeriesOrder($sd['order']);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tämä on vähän outo täällä luupin sisällä, kun se ylikirjoittaa aina edellisen. Olisi ehkä selkeämpää tehdä se vain ensimmäiselle löytyneelle järjestykselle, eli jos $seriesOrder on tyhjä.

protected function addSeriesKeys(array &$data, AbstractRecord $metadataRecord)
{
$seriesKeys = [];
$seriesOrder = '';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null olisi siistimpi oletusarvo.

*
* @return string|null
*/
protected function getSeriesOrder(string $field)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lisää paluuarvon tyyppi

*
* @param string $field Series order field to normalize
*
* @return string|null
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @return string|null
* @return ?string

*
* @return void
*/
protected function addSeriesKeys(array &$data, AbstractRecord $metadataRecord)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lisää paluuarvon tyyppi

*
* @return array
*/
public function getSeriesKeyData()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lisää paluuarvon tyyppi

*
* @return array
*/
public function getSeriesKeyData()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lisää paluuarvon tyyppi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants