EPrints Technical Mailing List Archive
See the EPrints wiki for instructions on how to join this mailing list and related information.
Message: #05578
< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First
Re: [EP-tech] Search results sorting by compound field elements
- To: "eprints-tech@ecs.soton.ac.uk" <eprints-tech@ecs.soton.ac.uk>
- Subject: Re: [EP-tech] Search results sorting by compound field elements
- From: Adam Field <Adam.Field@jisc.ac.uk>
- Date: Thu, 21 Apr 2016 09:45:17 +0000
You can define a function that returns an ordervalue on any metadata field. It'll look like this:
....
{
name => 'foo',
type => 'name',
multiple => 0,
make_value_orderkey => 'my_order_function'
}
...
$c->{my_order_function} = sub
{
my ($field, $value, $session, $langid, $dataset) = @_;
$familyname = $value->{family};
return md5($family);
}
Note that this is hazy, from memory and just typed straight into the email. Also, don't forget to regenerate the order values (I believe it's an epadmin command).
From: <eprints-tech-bounces@ecs.soton.ac.uk> on behalf of "Alan.Stiles" <alan.stiles@open.ac.uk>
Reply-To: "eprints-tech@ecs.soton.ac.uk" <eprints-tech@ecs.soton.ac.uk> Date: Wednesday, 20 April 2016 16:01 To: "eprints-tech@ecs.soton.ac.uk" <eprints-tech@ecs.soton.ac.uk> Subject: Re: [EP-tech] Search results sorting by compound field elements Half-answering my own question: my %options = ("custom_order" => "name"); my $list = $ds->search(%options); actually does what I want, but doesn’t resolve the larger question of sorting by sub-fields – e.g. if I wanted to sort the list by given name rather than family name… From:
eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk]
On Behalf Of Alan.Stiles Hi all, Anyone got a clue how to format the ‘custom_order’ parameter of a dataset search query to sort by sub-fields of a compound field? i.e. – running a search over the ‘user’ dataset and I want to sort the results by name_family then name_given of the compound ‘name’ field. Currently running (based on the search method from
http://wiki.eprints.org/w/API:EPrints/DataSet#Object_Methods ): $list = $ds->search( {“custom_order” => “name_given/name_family” }; But it doesn’t seem to be sorting the list at all Thanks, Alan -- The Open University is incorporated by Royal Charter (RC 000391), an exempt charity in England & Wales and a charity registered in Scotland (SC 038302). The Open University
is authorised and regulated by the Financial Conduct Authority. Jisc is a registered charity (number 1149740) and a company limited by guarantee which is registered in England under Company No. 5747339, VAT No. GB 197 0632 86. Jisc’s registered office is: One Castlepark, Tower Hill, Bristol, BS2 0JA. T 0203 697 5800. Jisc Services Limited is a wholly owned Jisc subsidiary and a company limited by guarantee which is registered in England under company number 2881024, VAT number GB 197 0632 86. The registered office is: One Castle Park, Tower Hill, Bristol BS2 0JA. T 0203 697 5800. |
- Prev by Date: Re: [EP-tech] Review Filters
- Next by Date: [EP-tech] Move repository
- Previous by thread: Re: [EP-tech] Search results sorting by compound field elements
- Next by thread: [EP-tech] Move repository
- Index(es):