You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by Bertrand Delacretaz <bd...@apache.org> on 2014/05/01 15:53:54 UTC

Evaluating Sling (was: I can't figure out how to do restful search)

Hi,

On Thu, May 1, 2014 at 2:24 PM, eftal sogukoglu <es...@stern.nyu.edu> wrote:
>...I am trying to evaluate sling / jb for a massive organization...
> My initial poc has very little requirements:
> - Push custom content.  Easy off the bat, so checked.
> - Search through content...which had me scratching my head but I think with your help I am almost there.
> - Push / pull binary content via rest (like PDF, Images) with metadata.  is that easy off the bar?  Would appreciate some direction....

Note that if you're looking at massive content you might want to
evaluate http://jackrabbit.apache.org/oak/ which is more scalable than
Jackrabbit and will probably become the default repository in Sling
soon - but you can very much start your evaluation with the current
default setup, usage is the same.

For searching, as discussed in a separate thread you can start with
the org.apache.sling.servlets.compat bundle, even though it's not
compliant with our current best practices it should work well for a
proof of concept.

Binary content is easy to handle, you can store it using MKCOL and PUT
requests handled by the standard webdav service, which creates a
standard nt:file/nt:resource node structure. You can then (for
example) add mixins to the nt:resource node to allow for additional
metadata properties, and set those properties - see the example below.
If you have lots of metadata, using a custom mixin that allows you to
add a metadata node under nt:resource (or alongside it) is probably
better.

HTH,
-Bertrand


Metadata example:
curl -u admin:admin -X MKCOL http://localhost:8080/somefolder
curl -u admin:admin -T image.jpg http://localhost:8080/somefolder/image.jpg
curl -u admin:admin -Fjcr:mixinTypes=mix:title
http://localhost:8080/somefolder/image.jpg/jcr:content
curl -u admin:admin -Fjcr:description="The image description"
http://localhost:8080/somefolder/image.jpg/jcr:content
curl -u admin:admin http://localhost:8080/somefolder/image.jpg.tidy.3.json
{
  ...
  "jcr:primaryType": "nt:file",
  "jcr:content": {
    "jcr:description": "The image description",
    ":jcr:data": 127434,
    "jcr:mixinTypes": ["mix:title"],
    "jcr:mimeType": "image/jpeg",
    "jcr:primaryType": "nt:resource",
    ...
  }
}