You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by eftal sogukoglu <es...@stern.nyu.edu> on 2014/05/01 05:37:20 UTC

I can't figure out how to do restful search

I've been playing around with Sling all day and can't figure out how to do a restful query.

Some old docs say you can do /content.query.json but that is failing.

Whats the fastest way I can achieve this?

Re: I can't figure out how to do restful search

Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi,

On Thu, May 1, 2014 at 2:24 PM, eftal sogukoglu <es...@stern.nyu.edu> wrote:
> ...Why is the usage not recommended at all?...

The discussion is at http://markmail.org/message/sxurvywelnyt3ntz -
there's nothing terribly wrong with it but the servlet ignores the
current request's resource, which can be a bit confusing and does not
follow our current best practices.

> ...what would be your
> recommended way of doing restful searches?...

If you look at the JsonQueryServlet code [1] it's very simple, and
having lots of content is really a problem of the underlying content
repository, so using it might not be too bad.

The "resource is ignored" bit could be improved by mounting the
servlet on a specific resource type, instead of using
sling/servlet/default which means it currently applies to any resource
if you use the .query.json path suffix - that's what's not really
conform to the Sling way of thinking.

Modifying the servlet (or creating a descendant class) so that it's
mounted on a sling/query resource type for example would be better,
and there's probably other things that can be improved...we vaguely
discussed that when moving it to the compat bundle, but no one has
come up with an improved variant so far.

In summary, starting with that servlet is probably fine, and if you
improve it based on your use cases contributions are welcome - we
might create a new query bundle with an improved variant.

I'll reply to your use case questions separately.

-Bertrand

[1] https://svn.apache.org/repos/asf/sling/trunk/bundles/servlets/compat/src/main/java/org/apache/sling/servlets/compat/impl/JsonQueryServlet.java

Re: I can't figure out how to do restful search

Posted by eftal sogukoglu <es...@stern.nyu.edu>.
Thanks:) That was me obviously.


- Why is the usage not recommended at all?
- I am trying to evaluate sling / jb for a massive organization...what would be your recommended way of doing restful searches?

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.

Tnkx,
Eftal


On May 1, 2014, at 5:32 AM, Bertrand Delacretaz <bd...@apache.org> wrote:

> Hi,
> 
> On Thu, May 1, 2014 at 5:37 AM, eftal sogukoglu <es...@stern.nyu.edu> wrote:
>> I've been playing around with Sling all day and can't figure out how to do a restful query.
>>> Some old docs say you can do /content.query.json but that is failing....
> 
> I've just replied to a surprisingly similar question at
> http://stackoverflow.com/questions/23400647/how-to-do-restful-search-in-apache-sling
> ;-)
> 
> See https://issues.apache.org/jira/browse/SLING-2226 and
> http://in-the-sling.blogspot.ch/2008/09/how-to-use-json-query-servlet.html
> 
> -Bertrand


Re: I can't figure out how to do restful search

Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi,

On Thu, May 1, 2014 at 5:37 AM, eftal sogukoglu <es...@stern.nyu.edu> wrote:
> I've been playing around with Sling all day and can't figure out how to do a restful query.
>> Some old docs say you can do /content.query.json but that is failing....

I've just replied to a surprisingly similar question at
http://stackoverflow.com/questions/23400647/how-to-do-restful-search-in-apache-sling
;-)

See https://issues.apache.org/jira/browse/SLING-2226 and
http://in-the-sling.blogspot.ch/2008/09/how-to-use-json-query-servlet.html

-Bertrand