Re: REST calls
Look at solrconfig.xml - the httpCaching element controls this. On Thu, Jul 1, 2010 at 2:08 PM, Jason Chaffee jchaf...@ebates.com wrote: Cool, I must have configured something wrong then, because it wasn't working for me. Thanks! -Original Message- From: Erik Hatcher [mailto:erik.hatc...@gmail.com] Sent: Wednesday, June 30, 2010 7:51 PM To: solr-user@lucene.apache.org Subject: Re: REST calls Solr has 304 support with the last-modified and etag headers. Erik On Jun 30, 2010, at 7:52 PM, Jason Chaffee wrote: In that case, being able to use Accept headers and conditional GET's would make them more powerful and easier to use. The Accept header could be used, if present, otherwise use the query parameter. Or, vice versa. Also, conditional GET's are a big win when you know the data and results are not changing often. Jason -Original Message- From: ysee...@gmail.com [mailto:ysee...@gmail.com] On Behalf Of Yonik Seeley Sent: Wednesday, June 30, 2010 7:12 AM To: solr-user@lucene.apache.org Subject: Re: REST calls Solr's APIs are described as REST-like, and probably do qualify as restful the way the term is commonly used. I'm personally much more interested in making our APIs more powerful and easier to use, regardless of any REST purity tests. -Yonik http://www.lucidimagination.com -- Lance Norskog goks...@gmail.com
RE: REST calls
Cool, I must have configured something wrong then, because it wasn't working for me. Thanks! -Original Message- From: Erik Hatcher [mailto:erik.hatc...@gmail.com] Sent: Wednesday, June 30, 2010 7:51 PM To: solr-user@lucene.apache.org Subject: Re: REST calls Solr has 304 support with the last-modified and etag headers. Erik On Jun 30, 2010, at 7:52 PM, Jason Chaffee wrote: In that case, being able to use Accept headers and conditional GET's would make them more powerful and easier to use. The Accept header could be used, if present, otherwise use the query parameter. Or, vice versa. Also, conditional GET's are a big win when you know the data and results are not changing often. Jason -Original Message- From: ysee...@gmail.com [mailto:ysee...@gmail.com] On Behalf Of Yonik Seeley Sent: Wednesday, June 30, 2010 7:12 AM To: solr-user@lucene.apache.org Subject: Re: REST calls Solr's APIs are described as REST-like, and probably do qualify as restful the way the term is commonly used. I'm personally much more interested in making our APIs more powerful and easier to use, regardless of any REST purity tests. -Yonik http://www.lucidimagination.com
Re: REST calls
On Wed, Jun 30, 2010 at 12:39 AM, Don Werve d...@madwombat.com wrote: 2010/6/27 Jason Chaffee jchaf...@ebates.com The solr docs say it is RESTful, yet it seems that it doesn't use http headers in a RESTful way. For example, it doesn't seem to use the Accept: request header to determine the media-type to be returned. Instead, it requires a query parameter to be used in the URL. Also, it doesn't seem to use return 304 Not Modified if the request header if-modified-since is used. The summary: Solr is restful, and does a very good job of it. I'm not so sure... The long version: There is no official 'REST' standard that dictates the behavior of the implementation; rather, REST is a set of guidelines on building APIs that are both discoverable and easily usable without having to resort to third-party libraries. Generally speaking, an application is RESTful if it provides an API that accepts arguments passed as HTTP form variables, returns results in an open format (XML, JSON, YAML, etc.), and respects certain semantics relating to HTTP verbs; e.g., GET/HEAD return the resource without modification, DELETEs are destructive, POST creates a resource, PUT alters it. Solr meets all of these requirements. With fairly limited knowledge of Solr (I'm a lucene user), I'd like to offer an alternate view. - Solr seems to violate the hypermedia-driven constraint. (e.g. it seems not to be hypertext driven at all) [1] - Solr seems to violate the uniform interface constraint and the identification of resources constraint.(E.g. by having commands in the entity body instead of exposing resources with state that is manipulated through the standard methods and, I gather, overloading methods instead of using standard ones (e.g. deletes). I'd conclude Solr is not RESTful. The representation argument is a bit of a red-herring, btw. Not using Accept for conneg isn't the problem, using agent-driven negotiation without being hypertext driven is [from a REST pov]. --tim [1] - http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven
Re: REST calls
On Wed, Jun 30, 2010 at 9:17 AM, Jak Akdemir jakde...@gmail.com wrote: On Wed, Jun 30, 2010 at 7:39 AM, Don Werve d...@madwombat.com wrote: 2010/6/27 Jason Chaffee jchaf...@ebates.com The solr docs say it is RESTful, yet it seems that it doesn't use http headers in a RESTful way. For example, it doesn't seem to use the Accept: request header to determine the media-type to be returned. Instead, it requires a query parameter to be used in the URL. Also, it doesn't seem to use return 304 Not Modified if the request header if-modified-since is used. The summary: Solr is restful, and does a very good job of it. The long version: There is no official 'REST' standard that dictates the behavior of the implementation; rather, REST is a set of guidelines on building APIs that are both discoverable and easily usable without having to resort to third-party libraries. Generally speaking, an application is RESTful if it provides an API that accepts arguments passed as HTTP form variables, returns results in an open format (XML, JSON, YAML, etc.), and respects certain semantics relating to HTTP verbs; e.g., GET/HEAD return the resource without modification, DELETEs are destructive, POST creates a resource, PUT alters it. Actually it is not a constraint to use all of four *GET*, *PUT*, *POST*, * DELETE.* To define RESTful, using Get and Post requests are enough as Roy Fielding offered. http://roy.gbiv.com/untangled/2009/it-is-okay-to-use-post In Roy's post, I'd point out: POST only becomes an issue when it is used in a situation for which some other method is ideally suited (e.g. DELETE to delete). Also, GET and POST *could* be enough if and only if you took care to design your resources properly[1]. --tim [1] - http://www.amundsen.com/blog/archives/1063
Re: REST calls
Solr's APIs are described as REST-like, and probably do qualify as restful the way the term is commonly used. I'm personally much more interested in making our APIs more powerful and easier to use, regardless of any REST purity tests. -Yonik http://www.lucidimagination.com
Re: REST calls
On Wed, 2010-06-30 at 16:12 +0200, Yonik Seeley wrote: Solr's APIs are described as REST-like, and probably do qualify as restful the way the term is commonly used. I'm personally much more interested in making our APIs more powerful and easier to use, regardless of any REST purity tests. -Yonik http://www.lucidimagination.com Hi Yonik, yes, please - and thanks! I'm again and again positively surprised how efficient and yet simple SOLR's (and Lucene's) query and response language (incl. response formats) is. Some things seem complex/difficult at first (like dismax or function queries) but turn out to be simple/easy to use considering the complexity of the problems they solve. Chantal
Re: REST calls
The stream.file/stream.url/stream.body parameters allow a GET to alter the index. The core management operations are also useable from GET. This allows one to bookmark and mail around a link that changes or blows up the index. Apparently this is not ReStFuL It is IMVHO insane. On Wed, Jun 30, 2010 at 7:45 AM, Chantal Ackermann chantal.ackerm...@btelligent.de wrote: On Wed, 2010-06-30 at 16:12 +0200, Yonik Seeley wrote: Solr's APIs are described as REST-like, and probably do qualify as restful the way the term is commonly used. I'm personally much more interested in making our APIs more powerful and easier to use, regardless of any REST purity tests. -Yonik http://www.lucidimagination.com Hi Yonik, yes, please - and thanks! I'm again and again positively surprised how efficient and yet simple SOLR's (and Lucene's) query and response language (incl. response formats) is. Some things seem complex/difficult at first (like dismax or function queries) but turn out to be simple/easy to use considering the complexity of the problems they solve. Chantal -- Lance Norskog goks...@gmail.com
Re: REST calls
On Wed, Jun 30, 2010 at 4:55 PM, Lance Norskog goks...@gmail.com wrote: Apparently this is not ReStFuL It is IMVHO insane. Patches welcome... -Yonik http://www.lucidimagination.com
Re: REST calls
I've looked at the problem. It's fairly involved. It probably would take several iterations. (But not as many as field collapsing :) On Wed, Jun 30, 2010 at 2:11 PM, Yonik Seeley yo...@lucidimagination.com wrote: On Wed, Jun 30, 2010 at 4:55 PM, Lance Norskog goks...@gmail.com wrote: Apparently this is not ReStFuL It is IMVHO insane. Patches welcome... -Yonik http://www.lucidimagination.com -- Lance Norskog goks...@gmail.com
Re: REST calls
If there is a real desire/need to make things restful in the official sense, it is worth looking at using a REST framework as the controller rather then the current solution. perhaps: http://www.restlet.org/ https://jersey.dev.java.net/ These would be cool since they encapsulate lots of the request plumbing work that it would be better if we could leverage more widely used approaches then support our own. That said, what we have is functional and powerful -- if you are concerned about people editing the index (with GET/POST or whatever) there are plenty of ways to solve this. ryan On Wed, Jun 30, 2010 at 5:31 PM, Lance Norskog goks...@gmail.com wrote: I've looked at the problem. It's fairly involved. It probably would take several iterations. (But not as many as field collapsing :) On Wed, Jun 30, 2010 at 2:11 PM, Yonik Seeley yo...@lucidimagination.com wrote: On Wed, Jun 30, 2010 at 4:55 PM, Lance Norskog goks...@gmail.com wrote: Apparently this is not ReStFuL It is IMVHO insane. Patches welcome... -Yonik http://www.lucidimagination.com -- Lance Norskog goks...@gmail.com
RE: REST calls
Using Accept headers is a pretty standard practice and so are conditional GETs. Quite easy to test with curl: curl -X GET -H Accept:application/xml http://solr.com/search curl -X GET -H Accept:application/json http://solr.com/search Jason -Original Message- From: Don Werve [mailto:d...@madwombat.com] Sent: Tuesday, June 29, 2010 9:40 PM To: solr-user@lucene.apache.org Subject: Re: REST calls 2010/6/27 Jason Chaffee jchaf...@ebates.com The solr docs say it is RESTful, yet it seems that it doesn't use http headers in a RESTful way. For example, it doesn't seem to use the Accept: request header to determine the media-type to be returned. Instead, it requires a query parameter to be used in the URL. Also, it doesn't seem to use return 304 Not Modified if the request header if-modified-since is used. The summary: Solr is restful, and does a very good job of it. The long version: There is no official 'REST' standard that dictates the behavior of the implementation; rather, REST is a set of guidelines on building APIs that are both discoverable and easily usable without having to resort to third-party libraries. Generally speaking, an application is RESTful if it provides an API that accepts arguments passed as HTTP form variables, returns results in an open format (XML, JSON, YAML, etc.), and respects certain semantics relating to HTTP verbs; e.g., GET/HEAD return the resource without modification, DELETEs are destructive, POST creates a resource, PUT alters it. Solr meets all of these requirements. The nature of the result format, and how to change it, is entirely up to the implementer. A common convention is to use a filename extension (.json, .xml) appended to the URL. It's less common to specify the request format as part of the query parameters (like Solr does), but not unheard of. And, to be honest, this is actually the first time I've heard of using the 'Accept' header to change the result format, as it makes it a lot harder to use a web browser, or command-line tools like curl or wget, to debug your API.
RE: REST calls
In that case, being able to use Accept headers and conditional GET's would make them more powerful and easier to use. The Accept header could be used, if present, otherwise use the query parameter. Or, vice versa. Also, conditional GET's are a big win when you know the data and results are not changing often. Jason -Original Message- From: ysee...@gmail.com [mailto:ysee...@gmail.com] On Behalf Of Yonik Seeley Sent: Wednesday, June 30, 2010 7:12 AM To: solr-user@lucene.apache.org Subject: Re: REST calls Solr's APIs are described as REST-like, and probably do qualify as restful the way the term is commonly used. I'm personally much more interested in making our APIs more powerful and easier to use, regardless of any REST purity tests. -Yonik http://www.lucidimagination.com
RE: REST calls
Two more jaxrs solutions: http://www.jboss.org/resteasy http://cxf.apache.org/docs/jax-rs.html However, I am not suggesting changing the core implementation. Just want to make it more powerful by utilizing headers. I can accept the other issues that have been mentioned as not RESTful. Also, I do plan to make patches for the issues I mentioned. I just wanted to know if I was missing anything or someone else already had contributed an extension. Jason -Original Message- From: Ryan McKinley [mailto:ryan...@gmail.com] Sent: Wednesday, June 30, 2010 3:07 PM To: solr-user@lucene.apache.org Subject: Re: REST calls If there is a real desire/need to make things restful in the official sense, it is worth looking at using a REST framework as the controller rather then the current solution. perhaps: http://www.restlet.org/ https://jersey.dev.java.net/ These would be cool since they encapsulate lots of the request plumbing work that it would be better if we could leverage more widely used approaches then support our own. That said, what we have is functional and powerful -- if you are concerned about people editing the index (with GET/POST or whatever) there are plenty of ways to solve this. ryan On Wed, Jun 30, 2010 at 5:31 PM, Lance Norskog goks...@gmail.com wrote: I've looked at the problem. It's fairly involved. It probably would take several iterations. (But not as many as field collapsing :) On Wed, Jun 30, 2010 at 2:11 PM, Yonik Seeley yo...@lucidimagination.com wrote: On Wed, Jun 30, 2010 at 4:55 PM, Lance Norskog goks...@gmail.com wrote: Apparently this is not ReStFuL It is IMVHO insane. Patches welcome... -Yonik http://www.lucidimagination.com -- Lance Norskog goks...@gmail.com
Re: REST calls
Solr has 304 support with the last-modified and etag headers. Erik On Jun 30, 2010, at 7:52 PM, Jason Chaffee wrote: In that case, being able to use Accept headers and conditional GET's would make them more powerful and easier to use. The Accept header could be used, if present, otherwise use the query parameter. Or, vice versa. Also, conditional GET's are a big win when you know the data and results are not changing often. Jason -Original Message- From: ysee...@gmail.com [mailto:ysee...@gmail.com] On Behalf Of Yonik Seeley Sent: Wednesday, June 30, 2010 7:12 AM To: solr-user@lucene.apache.org Subject: Re: REST calls Solr's APIs are described as REST-like, and probably do qualify as restful the way the term is commonly used. I'm personally much more interested in making our APIs more powerful and easier to use, regardless of any REST purity tests. -Yonik http://www.lucidimagination.com
Re: REST calls
Not at all. For one thing, a RESTful service does not allow a GET to alter any data. It is just an HTTP-based web service. On Sat, Jun 26, 2010 at 5:29 PM, Jason Chaffee jchaf...@ebates.com wrote: The solr docs say it is RESTful, yet it seems that it doesn't use http headers in a RESTful way. For example, it doesn't seem to use the Accept: request header to determine the media-type to be returned. Instead, it requires a query parameter to be used in the URL. Also, it doesn't seem to use return 304 Not Modified if the request header if-modified-since is used. Am I doing something wrong or is Solr not truly completely RESTful? thanks, Jason -- Lance Norskog goks...@gmail.com
Re: REST calls
2010/6/27 Jason Chaffee jchaf...@ebates.com The solr docs say it is RESTful, yet it seems that it doesn't use http headers in a RESTful way. For example, it doesn't seem to use the Accept: request header to determine the media-type to be returned. Instead, it requires a query parameter to be used in the URL. Also, it doesn't seem to use return 304 Not Modified if the request header if-modified-since is used. The summary: Solr is restful, and does a very good job of it. The long version: There is no official 'REST' standard that dictates the behavior of the implementation; rather, REST is a set of guidelines on building APIs that are both discoverable and easily usable without having to resort to third-party libraries. Generally speaking, an application is RESTful if it provides an API that accepts arguments passed as HTTP form variables, returns results in an open format (XML, JSON, YAML, etc.), and respects certain semantics relating to HTTP verbs; e.g., GET/HEAD return the resource without modification, DELETEs are destructive, POST creates a resource, PUT alters it. Solr meets all of these requirements. The nature of the result format, and how to change it, is entirely up to the implementer. A common convention is to use a filename extension (.json, .xml) appended to the URL. It's less common to specify the request format as part of the query parameters (like Solr does), but not unheard of. And, to be honest, this is actually the first time I've heard of using the 'Accept' header to change the result format, as it makes it a lot harder to use a web browser, or command-line tools like curl or wget, to debug your API.
REST calls
The solr docs say it is RESTful, yet it seems that it doesn't use http headers in a RESTful way. For example, it doesn't seem to use the Accept: request header to determine the media-type to be returned. Instead, it requires a query parameter to be used in the URL. Also, it doesn't seem to use return 304 Not Modified if the request header if-modified-since is used. Am I doing something wrong or is Solr not truly completely RESTful? thanks, Jason