Merge lp:~kamstrup/unity-lens-applications/ratings-query into lp:unity-lens-applications

Proposed by Mikkel Kamstrup Erlandsen
Status: Merged
Merged at revision: 233
Proposed branch: lp:~kamstrup/unity-lens-applications/ratings-query
Merge into: lp:unity-lens-applications
Diff against target: 0 lines
To merge this branch: bzr merge lp:~kamstrup/unity-lens-applications/ratings-query
Reviewer Review Type Date Requested Status
Michal Hruby (community) Approve
Review via email: mp+76566@code.launchpad.net

Description of the change

Implement support for the Ratings filter.

We share a Berkely DB with the Software Center with the Ratings data in. The db is in single-write-multiple-reader mode, so we can safely read it while s-c updates it (which I also verified manually). I took care to have gracefull fallback when the DB is not there or can not be opened for some reason.

Also adds a configure check for xapian.h now that we are here.

ALMOST forgot to add: This branch relies on the DB generated by this branch lp:~mvo/software-center/review-stats-as-dbm-for-unity-with-best-regards to make filtering work. But it's a good test to try without it, as we should have graceful fallback.

To post a comment you must log in.
248. By Mikkel Kamstrup Erlandsen

Set the UnityRatingsResult.pkgname on successful query

249. By Mikkel Kamstrup Erlandsen

Remove some redundant requirements from autogen.sh that I added in a frantic panic to resolve some autofoo issues

Revision history for this message
Michal Hruby (mhr3) wrote :

Looks nice! I didn't check out the SC branch, so didn't test it fully, but at least I tested the db-not-there case.

Just a couple minor things:

455 + public Database () throws GLib.IOError;
you're throwing GFileError, so either "throws FileError" or just "throws Error".

180 + ratings.query (pkginfo.package_name, out result);
perhaps it'd better to enclose it in an "if" considering it returns bool

362 + out_result->pkgname = pkgname;
a bit dangerous, but as long as it's not really used...

But all in all, approve! :)

review: Approve
250. By Mikkel Kamstrup Erlandsen

Make error checking and error reporting better in unity_ratings_database_query()

251. By Mikkel Kamstrup Erlandsen

The UnityRatingsDatabase throws a UNIX FileError and not an IOError. Thanks Michal!

252. By Mikkel Kamstrup Erlandsen

Use the bool return value from Unity.Ratings.Database.query() to check when to apply the filter

253. By Mikkel Kamstrup Erlandsen

Remove the dubiously mem-managed pkgname member from UnityRatingsResult struct. It was unused anyway. Thanks Michal!

Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

> 455 + public Database () throws GLib.IOError;
> you're throwing GFileError, so either "throws FileError" or just "throws
> Error".

Fixed to FileError in vapi. libdb raises values coinciding with the unix errnos, which also is the purpose of FileError.

> 180 + ratings.query (pkginfo.package_name, out result);
> perhaps it'd better to enclose it in an "if" considering it returns bool

Done

> 362 + out_result->pkgname = pkgname;
> a bit dangerous, but as long as it's not really used...

Removed the pkgname member from the struct as it was unused anyway - a relic from an alternative idea I pursued but abandoned.

Thanks!

Preview Diff

Empty

Subscribers

People subscribed via source and target branches