Re: [jira] Created: (SOLR-1592) Refactor XMLWriter startTag to allow arbitrary attributes to be written
Chris Hostetter wrote: Perhaps instead of making API additions/generalizations to XMLWriter, we should approach the problem differnelty and think about what a good reusable general pupose XML generation toolkit that could be used by custom response writers should look like, and then implement that -- refactoring the existing XMLWriter class to use/extend this new class where possible? I agree completely. Looking at solr/lucene from an XML/XSLT/X... background my first impression is that the XML/XSLT features are just what is absolutely necessary to get it running. As we are going to use solr in an XML based environment, we'll be happy to exchange ideas about full (or at least more xml support. -- Age Jan Kuperus FB ICT / Wageningen UR Library
Re: [jira] Created: (SOLR-1592) Refactor XMLWriter startTag to allow arbitrary attributes to be written
: Sure, but my point was, I am still able to call xmlWriter.writePrim which : lets me write XML tags with unbound names in an arbitrary fashion. In other : words, I can make my field (for XML) instead of spitting out: Oh man ... WTF is writePrim doing marked public ?!?!?!?! ...this is why classes shouldn't be made public without a thorough vetting. I see your point now abotu FieldTypes having an awkward amount of control over the XML generateion ... all i can say is they arent' suppose to have *any* control, it's suppose to be a field type nuetral format that only allows the FieldTypes to render themselves as one of the returnable object types defined as being permited in the SolrQueryResponse... http://lucene.apache.org/solr/api/org/apache/solr/request/SolrQueryResponse.html -Hoss
Re: [jira] Created: (SOLR-1592) Refactor XMLWriter startTag to allow arbitrary attributes to be written
Why don't we make the response writers deal w/ SolrDocument instead of lucene Document? That way we can get rid of a lot of ugly code. SOLR-1516 enables responsewriters to do that On Tue, Nov 24, 2009 at 6:44 AM, Yonik Seeley yo...@lucidimagination.com wrote: On Mon, Nov 23, 2009 at 7:04 PM, Chris Hostetter hossman_luc...@fucit.org wrote: XMLWriter was originally created to be a wrapper arround a java.io.Writer that had convinent heper methods for generating a specific XML response format (ie: wt=xml) back before Solr even supported multiple output types. Indeed - my longer term plans always included getting rid of it and re-implementing as a subclass of TextResponseWriter and getting rid of the XMLWriter set of methods on FieldType: /** * Renders the specified field as XML */ public abstract void write(XMLWriter xmlWriter, String name, Fieldable f) throws IOException; /** * calls back to TextResponseWriter to write the field value */ public abstract void write(TextResponseWriter writer, String name, Fieldable f) throws IOException; ResponseWriters in general have always been very expert level... we change as we need to add new features. The specific implementations certainly not designed to be subclassed by users with any back compat guarantees. People were not even able to subclass XMLWriter in the past. http://search.lucidimagination.com/search/document/4d47d6248a54298d/custom_query_response_writer -Yonik http://www.lucidimagination.com -- - Noble Paul | Principal Engineer| AOL | http://aol.com
Re: [jira] Created: (SOLR-1592) Refactor XMLWriter startTag to allow arbitrary attributes to be written
: Refactor XMLWriter startTag to allow arbitrary attributes to be written ... : There are certain cases in which a user would like to write arbitrary : attributes as part of the XML output for a field tag. Case in point: I'd ...i think here may be a disconnect here between some of the goals you are describing and the purpose of XMLWriter. XMLWriter was originally created to be a wrapper arround a java.io.Writer that had convinent heper methods for generating a specific XML response format (ie: wt=xml) back before Solr even supported multiple output types. The API was never really designed to be useful for generating XML response data cosisting of alternate XML structures. Perhaps instead of making API additions/generalizations to XMLWriter, we should approach the problem differnelty and think about what a good reusable general pupose XML generation toolkit that could be used by custom response writers should look like, and then implement that -- refactoring the existing XMLWriter class to use/extend this new class where possible? -Hoss
Re: [jira] Created: (SOLR-1592) Refactor XMLWriter startTag to allow arbitrary attributes to be written
Hi Chris, Thanks for the inputs: comments inline below: ...i think here may be a disconnect here between some of the goals you are describing and the purpose of XMLWriter. XMLWriter was originally created to be a wrapper arround a java.io.Writer that had convinent heper methods for generating a specific XML response format (ie: wt=xml) back before Solr even supported multiple output types. The API was never really designed to be useful for generating XML response data cosisting of alternate XML structures. Good to know -- I'll open up a new issue that includes a patch with javadoc that states that because it was unclear to me looking at the XMLWriter code. Perhaps instead of making API additions/generalizations to XMLWriter, we should approach the problem differnelty and think about what a good reusable general pupose XML generation toolkit that could be used by custom response writers should look like, and then implement that -- refactoring the existing XMLWriter class to use/extend this new class where possible? Potentially -- my problem is, why is XMLWriter a sacred cow? There's not even a SOLR namespace or DTD to go along with it? Why should users be able to inject their own custom XML into it -- it would seem that FieldTypes have the ability to do this anyways (e.g., I can declare any new type of field and its XML output [without namespaces sure, but still])... Cheers, Chris ++ Chris Mattmann, Ph.D. Senior Computer Scientist NASA Jet Propulsion Laboratory Pasadena, CA 91109 USA Office: 171-266B, Mailstop: 171-246 Email: chris.mattm...@jpl.nasa.gov WWW: http://sunset.usc.edu/~mattmann/ ++ Adjunct Assistant Professor, Computer Science Department University of Southern California, Los Angeles, CA 90089 USA ++
Re: [jira] Created: (SOLR-1592) Refactor XMLWriter startTag to allow arbitrary attributes to be written
: Potentially -- my problem is, why is XMLWriter a sacred cow? There's not I'm not trying to suggest that it should be ... my point wasn't to suggest that we shouldn't modify XMLWriter because it needs to be preserved as is -- my point was that given XMLWriter's origins, trying to shoehorn general purpose functionality into it is prbably going to be an uphill battle, and it might be easier and more beneficial in the long term to approach the problem from a what kind of utilities/helper code would make it easier for people to write custom Response Writers that generate structures of their own choosing in XML? : even a SOLR namespace or DTD to go along with it? Why should users be able : to inject their own custom XML into it -- it would seem that FieldTypes have : the ability to do this anyways (e.g., I can declare any new type of field : and its XML output [without namespaces sure, but still])... i'm not understanding what you mean ... i'm not fond of the way we have FieldType.write(XMLWriter xmlWriter, String name, Fieldable f) and FieldType.write(TextResponseWriter writer, String name, Fieldable f) ... but those methods don't allow custom fieldtypes to inject arbitrary XML, they're still confined to the existing XMLWriter and TextResponseWriter APIs -- those hooks just give the FieldType the ability to call the approraite write method (writeStr, writeInt, etc...) based on the inherient type of the data. -Hoss
Re: [jira] Created: (SOLR-1592) Refactor XMLWriter startTag to allow arbitrary attributes to be written
Hi Hoss, Comments inline: : Potentially -- my problem is, why is XMLWriter a sacred cow? There's not I'm not trying to suggest that it should be ... my point wasn't to suggest that we shouldn't modify XMLWriter because it needs to be preserved as is -- my point was that given XMLWriter's origins, trying to shoehorn general purpose functionality into it is prbably going to be an uphill battle, and it might be easier and more beneficial in the long term to approach the problem from a what kind of utilities/helper code would make it easier for people to write custom Response Writers that generate structures of their own choosing in XML? +1, gotcha. : even a SOLR namespace or DTD to go along with it? Why should users be able : to inject their own custom XML into it -- it would seem that FieldTypes have : the ability to do this anyways (e.g., I can declare any new type of field : and its XML output [without namespaces sure, but still])... i'm not understanding what you mean ... i'm not fond of the way we have FieldType.write(XMLWriter xmlWriter, String name, Fieldable f) and FieldType.write(TextResponseWriter writer, String name, Fieldable f) ... but those methods don't allow custom fieldtypes to inject arbitrary XML, they're still confined to the existing XMLWriter and TextResponseWriter APIs -- those hooks just give the FieldType the ability to call the approraite write method (writeStr, writeInt, etc...) based on the inherient type of the data. Sure, but my point was, I am still able to call xmlWriter.writePrim which lets me write XML tags with unbound names in an arbitrary fashion. In other words, I can make my field (for XML) instead of spitting out: arr name=booya doc int name=booya22/int ... /doc /arr Spit out: ... mycustomtag name=somenamesomeval/mycustomtag ... Using the writePrim method as it stands. So, I'm looking at a near term solution versus a longer term solution. Your proposal is the correct long-term solution, for sure. I would imagine then the XmlWriter that exists would become nothing more than a thin wrapper around our robust XMLReponseWriter framework that we'll write in order to keep backwards compat with XmlWriter peeps, no? Cheers, Chris ++ Chris Mattmann, Ph.D. Senior Computer Scientist NASA Jet Propulsion Laboratory Pasadena, CA 91109 USA Office: 171-266B, Mailstop: 171-246 Email: chris.mattm...@jpl.nasa.gov WWW: http://sunset.usc.edu/~mattmann/ ++ Adjunct Assistant Professor, Computer Science Department University of Southern California, Los Angeles, CA 90089 USA ++
Re: [jira] Created: (SOLR-1592) Refactor XMLWriter startTag to allow arbitrary attributes to be written
On Mon, Nov 23, 2009 at 7:04 PM, Chris Hostetter hossman_luc...@fucit.org wrote: XMLWriter was originally created to be a wrapper arround a java.io.Writer that had convinent heper methods for generating a specific XML response format (ie: wt=xml) back before Solr even supported multiple output types. Indeed - my longer term plans always included getting rid of it and re-implementing as a subclass of TextResponseWriter and getting rid of the XMLWriter set of methods on FieldType: /** * Renders the specified field as XML */ public abstract void write(XMLWriter xmlWriter, String name, Fieldable f) throws IOException; /** * calls back to TextResponseWriter to write the field value */ public abstract void write(TextResponseWriter writer, String name, Fieldable f) throws IOException; ResponseWriters in general have always been very expert level... we change as we need to add new features. The specific implementations certainly not designed to be subclassed by users with any back compat guarantees. People were not even able to subclass XMLWriter in the past. http://search.lucidimagination.com/search/document/4d47d6248a54298d/custom_query_response_writer -Yonik http://www.lucidimagination.com