EPrints Technical Mailing List Archive

See the EPrints wiki for instructions on how to join this mailing list and related information.

Message: #03730


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

[EP-tech] problem with DB query for view


Hi folks,

 

We have two multiple compound fields: “creators” and “editors”, with subfields:

·         name (type=name)

·         id (type=text)

·         … etc.

 

The ids are sparsely assigned (used to identify contributors associated with our institution.)

 

We also have a view “person”, with a single menu:

 

       allow_null => 0,
       menus => [{

              fields => [ "creators_id", "editors_id" ],

              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",

       }],

 

The problem is that, since upgrading from 3.2 to 3.3, the view includes a subset of those creators/editors who don’t have an id.

 

I tracked through the code and found that it’s generating the correct UNION statement (effectively: select from eprint_creators_id where creators_id!='' UNION select from eprint_editors_id where editors_id!=''), however for each field it’s then wrapping the union in a distinctby (select creators_id from (UNION); select editors_id from (UNION)). Of course, the union returns everything with either a creators_id or an editors_id, so both of those distinctby queries includes some null ids. Thus, the first section in the view menu is “?” with a link to the user “NULL.html” who has several thousand EPrints.

 

This is a bug, but I’m not quite sure how to turn it into a bug report on github. In the meantime, has anybody else come across this sort of issue? Are there any known fixes or workarounds?  I have a potential hack ready to get us by, but I’d prefer something a bit less klugey.

 

Cheers

--

Matthew Kerwin  |  Senior Web Developer  |  Applications & Development Team  |  Library eServices  |  Queensland University of Technology  |  Level 3, R Block, Kelvin Grove  |  matthew.kerwin@qut.edu.au  |  CRICOS No 00213J

 

Attachment: smime.p7s
Description: S/MIME cryptographic signature