[EP-tech] Re: problem with DB query for view

Matthew Kerwin matthew.kerwin at qut.edu.au
Tue Dec 23 00:04:35 GMT 2014


I did try that, and it didn’t make a difference; by inspecting the menu object directly I could see that it defaulted that way anyway.

 

The problem here seems to be some inherent complication resulting from a menu with two multiple fields, generating the wrong ‘distinctby’ query.

-- 

Matthew Kerwin  |  QUT Library eServices  |   <mailto:matthew.kerwin at qut.edu.au> matthew.kerwin at qut.edu.au

 

From: eprints-tech-bounces at ecs.soton.ac.uk [mailto:eprints-tech-bounces at ecs.soton.ac.uk] On Behalf Of Gilles Fournié
Sent: Monday, 22 December 2014 18:24
To: eprints-tech at ecs.soton.ac.uk
Subject: [EP-tech] Re: problem with DB query for view

 

Sorry.. 
I have not been clear. 

The wiki shows allow_null under "menus ".
Yours is outside.
I don't know if it could make a difference or not...

Regards 

Le 22 décembre 2014 08:47:48 UTC+01:00, Gilles FOURNIE <gilles.fournie at cirad.fr> a écrit :

HI,

Did you try adding "allow_null => 0" to your view ?

I'm not sure which is the default value :
http://wiki.eprints.org/w/Views.pl#Menu_options

Regards,
GF



  _____  

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  |   <https://wiki.qut.edu.au/display/lib/Digital+Repository+Team> Applications & Development Team  |  Library eServices  |  Queensland University of Technology  |  Level 3, R Block, Kelvin Grove  |   <mailto:matthew.kerwin at qut.edu.au> matthew.kerwin at qut.edu.au  |  CRICOS No 00213J

 


*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/

 

*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/


-- 
Envoyé de mon téléphone Android avec K-9 Mail. Excusez la brièveté.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20141223/6f4cac52/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6087 bytes
Desc: not available
Url : http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20141223/6f4cac52/attachment-0001.bin 


More information about the Eprints-tech mailing list