After upgrading from 3.2.4 to 3.3.12, the sort wasn't working well on the creators browse view.
For example, “Liscio, Sinella” is listed inbetween “Li, Sanujun” and “Li, Shixiong” The people with the same last name should be listed next to each other.
Screenshot:
Our original browse view definition for authors (cfg.d/views.pl) was the following:
...which tab joins each sub-part. If tabs are sorted before the letter 'A', this could be what's causing the problem.
Note that this can be overridden on a field definition, which will allow you to test this:
So, in your field definition (in eprint_field.pl), add something like:
name => 'creators',
type => 'compound',
multiple => 1,
fields => [
{
sub_name => 'name',
type => 'name',
hide_honourific => 1,
hide_lineage => 1,
family_first => 1,
make_single_value_orderkey => 'the_name_orderval_function_af',
},
and in cfg/cfg.d/z_local.pl:
$c->{the_name_orderval_function_af} = sub
{
my ($field, $value, $dataset) = @_;
return $value->{family} . 'ZZZZZ' . $value->{given};
}
I tested this using the "ZZZZZ" string and it worked in terms of keeping the people with the same last name next to each other, but it puts the shorter names at the end, rather than the beginning – and I think that the convention (probably based on how the phone book does it) is to put them first. This is why I used "11111" as the join string, and that worked well.
I also tested it with the default "\t" and with “\t\t\t\t\t\t\t\t” and it didn’t solve the problem – the result didn't keep the people with the same last name together. For example, we would have something like this:
Certain characters (whitespace, punctuation, etc.) are handled differently than in simple ASCII lexicographic sort. In other words, it seems to intentionally skip the tab character.
A dollars sign $ seems to work the way we expect, should have as little chance of appearing in an author name as the numeral 1, and stands out (for debugging.)
cziaarm
pushed a commit
to eprintsug/ulcc-site_lib
that referenced
this issue
Jun 14, 2017
After upgrading from 3.2.4 to 3.3.12, the sort wasn't working well on the creators browse view.
For example, “Liscio, Sinella” is listed inbetween “Li, Sanujun” and “Li, Shixiong” The people with the same last name should be listed next to each other.
Screenshot:

Our original browse view definition for authors (cfg.d/views.pl) was the following:
{
id => "creators",
allow_null => 0,
hideempty => 1,
menus => [
{
fields => [ "creators_name" ],
new_column_at => [1, 1],
mode => "sections",
open_first_section => 1,
group_range_function => "EPrints::Update::Views::cluster_ranges_30",
grouping_function => "EPrints::Update::Views::group_by_a_to_z",
},
],
order => "-date/title",
variations => [
"type",
"DEFAULT",
],
},
With Adam Field's help, we were able to patch this issue in the following way:
Ordervalues are generated in the metafield classes. The one used by a name is here:
https://github.com/eprints/eprints/blob/3.3/perl_lib/EPrints/MetaField/Multipart.pm#L185
https://github.com/eprints/eprints/blob/3.3/perl_lib/EPrints/MetaField.pm#L946
https://github.com/eprints/eprints/blob/3.3/perl_lib/EPrints/MetaField/Multipart.pm#L185
https://github.com/eprints/eprints/blob/3.3/perl_lib/EPrints/MetaField.pm#L1929
and in cfg/cfg.d/z_local.pl:
I tested this using the "ZZZZZ" string and it worked in terms of keeping the people with the same last name next to each other, but it puts the shorter names at the end, rather than the beginning – and I think that the convention (probably based on how the phone book does it) is to put them first. This is why I used "11111" as the join string, and that worked well.
I also tested it with the default "\t" and with “\t\t\t\t\t\t\t\t” and it didn’t solve the problem – the result didn't keep the people with the same last name together. For example, we would have something like this:
Li, Peng
Li, Pengjie
Lipscombe, Carla L
Lipsky, Naomi
Lipton, Rebecca
Li, Qiao
Li, Qing
It looks to me like EPrints is actually ignoring the default \t separator for the purposes of sorting.
The text was updated successfully, but these errors were encountered: