On Fri, 2007-01-12 at 15:41 -0500, Yonik Seeley wrote:
> On 1/10/07, Chris Hostetter <[EMAIL PROTECTED]> wrote:
> > The one hitch i think to the the notion that updates and queries map
> > cleanlly with something like this...
> >
> >   SolrRequestHandler => SolrUpdateHandler
> >   SolrQueryRequest => SolrUpdateRequest
> >   SolrQueryResponse => SolrUpdateResponse (possibly the same class)
> >   QueryResponseWriter => UpdateResponseWriter (possible the same class)
> >
> > ...is that with queries, the "input" tends to be fairly simple.  very
> > generic code can be run by the query Servlet to get all of the input
> > params and build the SolrQueryRequest ... but with updates this isn't
> > quite as simple.  there's the two issues i spoke of in my earlier mail
> > which should be independenly confiugable:
> >   1) where does the "stream" of update data come from?  is it in the raw
> >      POST body? is it in a POSTed multi-part MIME part? is it a remote
> >      resource refrenced by URL?
> >   2) how should the raw binary stream of update data be parsed?  is it
> >      XML? (in the current update format)  is it a CSV file?  is it a PDF?
> >
> > ...#2 can be what the SolrUpdateHandler interface is all about -- when
> > hitting the update url you specify a "ut" (update type) that determines
> > that logic ... but it should be independed of #1
> 
> Right, you're getting at issues of why I haven't committed my CSV handler yet.
> It currently handles reading a local file (this is more like an SQL
> update handler... only a reference to the data is passed).  But I also
> wanted to be able to handle a POST of the data  , or even a file
> upload from a browser.  Then I realized that this should be generic...
> the same should also apply to XML updates, and potential future update
> formats like JSON.

I do not see the problem here. One just need to add a couple of lines in
the upload servlet and change the csv plugin to input stream (not local
file).

See
https://issues.apache.org/jira/secure/attachment/12347425/solar-85.with.file.upload.diff
...
+        boolean isMultipart = ServletFileUpload
+                .isMultipartContent(new ServletRequestContext(request));
...
+        if (isMultipart) {
+            // Create a new file upload handler
...
+                    commandReader = new BufferedReader(new 
InputStreamReader(stream));

Now instead of 
+                    core.update(commandReader, responseWriter);
one would use the updateHandler for the in the request defined format 
(format=json)

UpdateHandler handler = core.lookupUpdateHandler(format);
handler.update(commandReader, responseWriter);

Or do I miss something?

salu2

Reply via email to