About ordered sets, it looks like I stumbled upon a precedent that I
didn't remember about:
in pkg/schema/nodeattr/nodeattr.go , we have:
// CamliPathOrderColon is the prefix "camliPathOrder:".
// The attribute key should be followed by a uint64. The attribute value
// is an existing value of a camliPath element.
// CamliPathOrder optionally sorts sets already using "camliPath:foo" keys.
// The integers do not need to be contiguous, nor 0- (or 1-) based.
CamliPathOrderColon = "camliPathOrder:"
It looks like the picasa importer is setting it, but nothing else
does, and the UI does not take it into account. So, should we
consolidate that use whenever we want to have ordered sets? Or is the
intention that one can use CamliPathOrderColon to sort a set when _it
happens_ that your set is based on a camliPath relation, BUT that it
should not influence one's decision to use camliPath vs camliMember to
create an ordered set?
Another point:
the initial model allows for a Preview attribute for a document (like
an album cover), which would be the page of the document that we want
to show on the index page as the icon for the whole document I
suppose.
server/camlistored/ui/blob_item_image_content.js says:
// Sets can have the camliContentImage attr to indicate a user-chosen
"cover image" for the entire set. Until we have some rendering for
those, the folder in the generic handler is a better fit than the
single image.
but it does not exactly match the definition we have for camliContent
vs CamliContentImage in pkg/schema/nodeattr/nodeattr.go , i.e. since a
document permanode itself does not have any camliContent (its members
- regardless of whether we use camliPath or camliMember - do), we
could very well use camliContent on the document permanode to indicate
the preview page. I'd vote for using camliContentImage though, and
maybe add the preview/cover image use case as documentation in
nodeattr.go
On 8 January 2015 at 23:50, Aaron Boodman <aa...@aaronboodman.com> wrote:
<snip>
> The reason that I do not like using an image for containers right now is
> that you cannot tell when looking at a search result that an item actually
> has children rather than just being a single thing.
>
> We used camliContentImage to set the "cover photo" for albums from some of
> the image importers. As a result, you couldn't tell whether a picture was
> just a picture or whether it was an album.
>
> For a single document it makes more sense, but I still sort of think it
> would be better if the presentation was different in this case. Like a
> simple thing could be to superimpose a small folder in the corner of the
> image or something. Or make it look like a stack of images, or whatever.
>
> Sorry for being persnickety.
No problem, I see your point, and I think it's totally fine to wait
until we come up with a good presentation idea to do the preview thing
for sets.
But do you have any opinion on which one (camliContent vs
camliContentImage - or other?) to pick to store the preview image ? I
think this is something we should clarify, define, and document.
On 8 January 2015 at 23:50, Aaron Boodman <aa...@aaronboodman.com> wrote:
>> It looks like the picasa importer is setting it, but nothing else
>> does, and the UI does not take it into account. So, should we
>> consolidate that use whenever we want to have ordered sets? Or is the
>> intention that one can use CamliPathOrderColon to sort a set when _it
>> happens_ that your set is based on a camliPath relation, BUT that it
>> should not influence one's decision to use camliPath vs camliMember to
>> create an ordered set?
>
>
> These are really questions for Brad, but my opinion is that there should be
> one ordering mechanism and it should apply to both camliPath and camliMember
> attributes.
So let's say we add a "next" and/or "previous" attributes (we can
bikeshed the names later) to our vocabulary of common permanode
attributes.
Those would be set as needed when one wants to construct
an ordered set with camilMember (and camliPath). You mentioned doing
so as an extra argument when setting a camliMember claim. But it seems
more complicated than setting this "previous" attribute as a distinct,
separate, claim, no?
The UI would as usual request children/members of the document. I
don't remember if the current query for that specifies an order, but I
think we would have to make sure that it does not specify any, or
maybe a new one like "naturalOrder" or whatever. So the UI would have
to know to specify that when it's dealing with a (scanning cabinet)
document (or any other time where we want an ordered set).
The search handler gets the query, sees that we want "naturalOrder".
At this point, to make things efficient we'd have to write a new
permanodes enumeration method in the corpus based on this natural
order, like the the ones we have based on modtime or ctime. I'm not
sure yet how difficult that would be. But assuming the docs don't have
many pages for now, we can make it work by using the dumb full
enumeration for permanodes, apply the usual Constraint matching, and
then sort them all. Brad actually left a "sort them" TODO at the point
where this should be done :-)
We'd have to define what we do when the set of results cannot be fully
ordered (because at least one of the permanodes in the results does
not have a "next"/"previous" for some reason). Move it at the end of
the set and log? or error out? Or maybe having this "previous"
attribute is automatically added as part of the constraint when
"naturalOrder" is requested, and hence any permanode which does not
have it is actually excluded from the results.
Then we send the blobs back to the UI, wich should have nothing more
to do than display them in the order they already are.
It's still blurry for me but it looks like it could work. Again, I
need to think more about an optimized enumeration for this order in
the corpus.
Comments?
About the prevClaimHash and nextClaimHash idea. Why don't use something like this:
camliOrder is by default the unix epoch of the created date. When you reorder items, you just change it to (newPrevItem.camliOrder + newNextItem.camliOrder)/2.
Yes, the camliOrder should be a floating point thing.