Ok, I reverted and ran some index(docs)..

My solr logs say:

Jan 15, 2008 3:09:11 PM org.apache.solr.update.SolrIndexWriter
getDirectory
WARNING: No lockType configured for
/m2/tomcat5.5-temp/solr_data/en/index assuming 'simple'
Jan 15, 2008 3:09:11 PM
org.apache.solr.update.processor.LogUpdateProcessor finish
INFO: {add=[ABC123-ANEW00001_CN-0000000000000001]} 0 9
Jan 15, 2008 3:09:12 PM
org.apache.solr.update.processor.LogUpdateProcessor finish
INFO: {add=[ABC123-DNEW00001_CN-0000000000000001]} 0 7
Jan 15, 2008 3:09:12 PM
org.apache.solr.update.processor.LogUpdateProcessor finish
INFO: {add=[ABC123-KNEW00001_CN-0000000000000001]} 0 6
Jan 15, 2008 3:09:12 PM
org.apache.solr.update.processor.LogUpdateProcessor finish
INFO: {add=[QAQA12-QAQA00001_CN-0000000000000001]} 0 7

It seems to me that if a user does option 1: client.add(docs) they will
get a new UpdateRequest in the add method, setAction(commit) will never
get set on it and it will be processed.  The user's document will get
added but never committed (which is what I see above).


-----Original Message-----
From: Ryan McKinley [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 15, 2008 1:45 PM
To: solr-dev@lucene.apache.org
Subject: Re: solrj patch to COMMIT with xml

right - there are two ways to work with solrj
1. use the standard functions available in SolrServer
2. make your own SolrRequest and call 'process'
http://wiki.apache.org/solr/Solrj

Calling client.add( docs ) is option 1, the example I sent is option 2. 
  For anything custom or advanced, you will need option 2.

-----

I'm still wondering what your logs say when you try to send a commit 
(with the unmodified code)

ryan


Keene, David wrote:
> My problem is that the in the BaseSolrServer the add(Collection,
> Boolean) call does the req.process call inside of it.. so I can't add
a
> setAction to the updateRequest before it processes.  And the add
method
> also creates a *new* update request inside of it, so I can't set the
> action beforehand either.. (the method that gets called is on line 44
of
> the BaseSolrServer):
> 
> public UpdateResponse add(Collection<SolrInputDocument> docs, boolean
> overwrite ) throws SolrServerException, IOException {
>     UpdateRequest req = new UpdateRequest();
>     req.add(docs);
>     req.setOverwrite(overwrite);
>     return req.process(this);
>   }
> 
> So there is no way to get at the action of that request.
> 
> 
> 
> -----Original Message-----
> From: Ryan McKinley [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, January 15, 2008 1:19 PM
> To: solr-dev@lucene.apache.org
> Subject: Re: solrj patch to COMMIT with xml
> 
> hymm - with 1.3, the standard solrj should work without issue.  What
do 
> the logs say when you call commit?  What container are you running?
I
> 
> have tested this extensivly with resin and jetty, but have not touched

> tomcat...
> 
> To add and commit in one shot, try:
> 
>      UpdateRequest up = new UpdateRequest();
>      up.add( docs );
>      up.setAction( ACTION.COMMIT, true, false );
>      up.process( client );
> 
> ryan
> 
> 
> 
> Keene, David wrote:
>> Nope, I'm using 1.3 (synced 2 days ago).  I'm indexing using using
> code
>> similar to below, and it creates 2 connections when doing so.
Perhaps
>> there is a better way to do my indexing so the commit is included
with
>> the add connction.
>>
>> Sample indexing code:
>>
>> UpdateResponse addResponse = client.add( docs );
>> UpdateResponse commitResponse = client.commit();
>>
>> Is there a way to make the client.add(docs) connection add a commit?
>>
>>
>> -----Original Message-----
>> From: Ryan McKinley [mailto:[EMAIL PROTECTED] 
>> Sent: Tuesday, January 15, 2008 12:54 PM
>> To: solr-dev@lucene.apache.org
>> Subject: Re: solrj patch to COMMIT with xml
>>
>> 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;
>>>
>>>
>>
> 
> 

Reply via email to