Are you hitting a 1.2 solr index? Using ?commit=true assumes you are
hitting a 1.3 index...
The reason for it is so you can optionally add docs and commit in one call.
ryan
Keene, David wrote:
Hey guys,
I'm not sure why, but the solrj client relies on commit=true on the
querystring for committing an index() call. But with the latest svn
trunk, my index() calls were not committing. I made a patch to add a
<COMMIT/> element to the posted xml so I could index using the solrj
client.
Did I miss something about how to get commits working in 1.3? Anyway,
here's the patch if you want it.
Thanks,
Dave
Index: C:/Documents and
Settings/dkeene/workspace/solr.trunk/client/java/solrj/src/org/apache/so
lr/client/solrj/request/UpdateRequest.java
===================================================================
--- C:/Documents and
Settings/dkeene/workspace/solr.trunk/client/java/solrj/src/org/apache/so
lr/client/solrj/request/UpdateRequest.java (revision 611919)
+++ C:/Documents and
Settings/dkeene/workspace/solr.trunk/client/java/solrj/src/org/apache/so
lr/client/solrj/request/UpdateRequest.java (working copy)
@@ -171,7 +171,14 @@
writer.append( "</delete>" );
}
- // If action is COMMIT or OPTIMIZE, it is sent with params
+ if (action != null ) {
+ if (action == ACTION.OPTIMIZE) {
+
writer.append("<optimize/>");
+ } else if (action == ACTION.COMMIT) {
+
writer.append("<commit/>");
+ }
+ }
+
String xml = writer.toString();
//System.out.println( "SEND:"+xml );
return (xml.length() > 0) ? xml : null;