Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOLR-17518: Deprecate UpdateRequest.getXml() and replace it with XMLRequestWriter #3200

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

psalagnac
Copy link
Contributor

https://issues.apache.org/jira/browse/SOLR-17518

Description

Update request in XML are written directly by UpdateRequest. It would be much cleaner to have a dedicated class, specific to XML, similar to existing BinaryRequestWriter.

Solution

Add XMLRequestWriter.

Methods UpdateRequest.getXML() and UpdateRequest.writeXML() are flagged as deprecated, so the change may be merged in 9x branch. I plan to fully remove them from 10 in another PR.

Copy link
Contributor

@epugh epugh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sharper eyes than I need to weigh in, but I like how it all looks. I love that we are slowly putting XML on the same playing field as JSON and other formats, and getting away from the "special treatment". I tried to add Avro as a request writer once and totally got lost in the path of how writers worked, and that xml was different than other formats!

public class XMLRequestWriter extends RequestWriter {

/**
* Use this to do a push writing instead of pull. If this method returns null {@link
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kind of nit, but what does a "push writing" mean versus pull? Maybe if I read other javadocs it would be clear what that concept is?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe just looking for this javadoc to work a bit harder in explaining things!

Map.Entry<SolrInputDocument, Map<String, Object>> firstDoc =
docs.entrySet().iterator().next();
Map<String, Object> map = firstDoc.getValue();
Integer cw = null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems odd to have both cw and later commitWithin, and since we don't normally abbriveate variables, do commitWithin and overwrite everywhere?

@@ -50,36 +47,14 @@ public interface ContentWriter {
* org.apache.solr.client.solrj.request.RequestWriter#getContentStreams(SolrRequest)} is invoked
* to do a pull write.
*/
public ContentWriter getContentWriter(SolrRequest<?> req) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

/**
* @deprecated Method will be removed in Solr 10.0. Use {@link XMLRequestWriter} instead.
*/
@Deprecated(since = "9.9")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the since, I like seeing those to help remind us when we can clean them up. Plus, you added a reminder in the docs!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants