Skip to content

new more efficient way to calculate facets #2

@punkish

Description

@punkish

I am experimenting with calculating facets, and in a quest to make them more useful as well as the calculation more performant, I have implemented the following – rather than calculating and sending back the entire result set for each facet (the trailing end of which not only likely doesn't get used by the user, it is also likely mostly bogus because of dodgy data), I am retrieving and sending only the top 50 rows of each. You can see the result at http://test.zenodeo.org/v3/treatments?$facets=true

I use SQL something like so (example below for journalTitle)

SELECT journalTitle, count FROM (
    SELECT journalTitle, Count(journalTitle) AS count 
    FROM treatments 
    WHERE journalTitle != '' 
    GROUP BY journalTitle
    HAVING count > 100 
    ORDER BY count DESC 
    LIMIT 50
)  
ORDER BY journalTitle ASC;

Please send me your rant or rave about the above technique.

attn: @tcatapano @teodorgregoriev @mguidoti
cc: @myrmoteras

Metadata

Metadata

Assignees

No one assigned

    Labels

    RFCrequest for comments

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions