You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by "Darren Erik Vengroff (JIRA)" <ji...@apache.org> on 2006/06/02 08:12:30 UTC

[jira] Created: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

A simple Java client with Java APIs for add(), delete(), commit() and optimize().
---------------------------------------------------------------------------------

         Key: SOLR-20
         URL: http://issues.apache.org/jira/browse/SOLR-20
     Project: Solr
        Type: New Feature

  Components: update  
 Environment: all
    Reporter: Darren Erik Vengroff
    Priority: Minor


I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Re: [jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by Mike Klaas <mi...@gmail.com>.
On 3/22/07, Thierry Collogne (JIRA) <ji...@apache.org> wrote:

> I think that is all. If I forgot something, post it here. One remark. The setHighlightSurroundingTags method can only take simple tags,
> no tags containing quotes or such.

Out of curiosity, why is this? Solr should be able to handle it.

-Mike

Re: [jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by Yonik Seeley <yo...@apache.org>.
On 1/25/07, Chris Hostetter <ho...@fucit.org> wrote:
>
> : IMO, we should strive to be nice and not repeat keys when the
> : NamedList is more of the Map variety than the List.
>
> we should try .. but we can't garuntee .. i don't have any compelling
> cases where i've needed to reuse the same name, but i've certainly written
> plenty of code that puts multiple items in a list that have no name.
>
> : > mechanism from the client code like this one -- using XML really is the
> : > safest bet since it's the most expressive of all the formats we currently
> : > have)
> :
> : JSON responses are smaller and can be quite a bit faster to parse.
>
> i won't argue it's not faster or smaller -- just that it's not as
> expressive :)

True, but for most specific client applications, it doesn't matter
because the extra info is redundant.

The extra info can be nice for generic applications... (knowing what
field is a date field, for example).  Erik is solving that in Flare
via naming convention I think...

-Yonik

Re: [jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by Chris Hostetter <ho...@fucit.org>.
: IMO, we should strive to be nice and not repeat keys when the
: NamedList is more of the Map variety than the List.

we should try .. but we can't garuntee .. i don't have any compelling
cases where i've needed to reuse the same name, but i've certainly written
plenty of code that puts multiple items in a list that have no name.

: > mechanism from the client code like this one -- using XML really is the
: > safest bet since it's the most expressive of all the formats we currently
: > have)
:
: JSON responses are smaller and can be quite a bit faster to parse.

i won't argue it's not faster or smaller -- just that it's not as
expressive :)

i'm guessing that if you generated enough JSON markup to be equally
expressive and safe, the size would go up considerably (but still probably
not be as big as XML) and the speed would be affected to some degree as
well -- not to mention the ease of use, accessing the new more complex
JSON structures you would have.


-Hoss


Re: [jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by Yonik Seeley <yo...@apache.org>.
On 1/25/07, Chris Hostetter <ho...@fucit.org> wrote:
> : I'm using a slightly modified version of the json.org code.  It stores
> : things in a LinkedHashMap (to maintain order) and formats dates
> : explicitly.
>
> Uh... watch out with that ... a LinkedHashMap is first and for most a Map,
> so it doesn't support repeated keys.

I currently have some (ugly) code in the response writer that handles
repeated keys, just not nicely.

IMO, we should strive to be nice and not repeat keys when the
NamedList is more of the Map variety than the List.

> (I suspect for a client API that's going to completley hide the transport
> mechanism from the client code like this one -- using XML really is the
> safest bet since it's the most expressive of all the formats we currently
> have)

JSON responses are smaller and can be quite a bit faster to parse.

-Yonik

Re: [jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by Chris Hostetter <ho...@fucit.org>.
: > > * I'm using wt=JSON rather then XML. (It maps to a hash easier)

: I'm using a slightly modified version of the json.org code.  It stores
: things in a LinkedHashMap (to maintain order) and formats dates
: explicitly.

Uh... watch out with that ... a LinkedHashMap is first and for most a Map,
so it doesn't support repeated keys.

(I suspect for a client API that's going to completley hide the transport
mechanism from the client code like this one -- using XML really is the
safest bet since it's the most expressive of all the formats we currently
have)


-Hoss


Re: [jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by Yonik Seeley <yo...@apache.org>.
On 1/24/07, Ken Krugler <kk...@transpac.com> wrote:
> Hi Ryan,
>
> >The big API question/style i'm struggling with is
> >
> >SolrResponse rsp = client.process( req );
> >  vs
> >SolrResponse rsp = req.execute( client );  // execute may not be the
> >right word
> >
> >The first one is more natural, and is how things are actually
> >processed.  The second one allows eliminates the need for lots of
> >casting:
> >
> >SolrQueryResponse rsp = (SolrQueryResponse)client.process( req );
> >vs
> >SolrQueryResponse rsp = queryRequest.execute( client );
> >
> >Any thoughts?
>
> Haven't dug into the client code, but my natural inclination would be
> to go with the latter...it fits better with how I'd write the test
> code if I was implementing such a thing. E.g. create a mock client
> and then use that to test the request object.

I think I agree with the latter, although I probably would have coded
the former just because it would have occured to me first.

The latter allows an easy way to create new request classes w/o having
to couple tightly to the client.  A type of request could make two
calls two calls to the server, and join the responses or process them
in different ways.  I like it!

-Yonik

Re: [jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by Yonik Seeley <yo...@apache.org>.
On 1/25/07, Ryan McKinley <ry...@gmail.com> wrote:
> >
> > On Jan 24, 2007, at 6:53 PM, Ryan McKinley wrote:
> > > new SolrPing().process( server );
> >
> > doesn't
> >
> >    server.ping();
> >
> > look cleaner?
> >
>
> I can't argue with you there!
>
> I may be taking Hoss's point #4 on
> https://issues.apache.org/jira/browse/SOLR-20#action_12464641 too
> seriously.  My revised version is designed totally around Requests
> processing a handler's response.  The server does not even know what
> handlers it may be running - it is just the transport layer between
> the request and the response.
>
> But that may be too big of an abstraction for the simple use case.
>
> server.ping()
> server.add( documents );
> server.delete( id );
> server.select( options );
> ...
>
> are obviously cleaner.

One form doesn't preclude the other either.... you can have both.
For more complex or custom request handlers, keeping the logic (and
library dependencies) out of the server seems like a good idea.

-Yonik

Re: [jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by Ryan McKinley <ry...@gmail.com>.
>
> On Jan 24, 2007, at 6:53 PM, Ryan McKinley wrote:
> > new SolrPing().process( server );
>
> doesn't
>
>    server.ping();
>
> look cleaner?
>

I can't argue with you there!

I may be taking Hoss's point #4 on
https://issues.apache.org/jira/browse/SOLR-20#action_12464641 too
seriously.  My revised version is designed totally around Requests
processing a handler's response.  The server does not even know what
handlers it may be running - it is just the transport layer between
the request and the response.

But that may be too big of an abstraction for the simple use case.

server.ping()
server.add( documents );
server.delete( id );
server.select( options );
...

are obviously cleaner.

ryan

Re: [jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by Edward Summers <eh...@pobox.com>.
On Jan 24, 2007, at 6:53 PM, Ryan McKinley wrote:
> new SolrPing().process( server );

doesn't

   server.ping();

look cleaner?

//Ed

Re: [jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by Ryan McKinley <ry...@gmail.com>.
>
> This might seem outlandish but have you considered modeling a server
> instead of a client? Then you can send request messages to it and get
> back response messages.
>
>    SolrSelectResponse response = server.select(selectOptions);
>

I like the model, but the I want to be able easily write a client for
a custom SolrRequestHandler.  The server model can't be tied directly
to update(), select(), ping() etc

right now I'm working with:

public interface SolrServer
{
  SolrResponse request(
	final String path,
	final METHOD method,
	final RequestParams params,
	final Collection<ContentStream> streams,
	final ResponseStreamProcessor processor ) ;
}

public interface ResponseStreamProcessor
{
  SolrResponse processResponseStream( InputStream body );
}

public interface SolrRequest
{
  SolrResponse process( SolrServer server ) ;
}

- - - - - - - - - -

This would be a sample 'ping' request:

public class SolrPing implements SolrRequest
{	
  public SolrResponse process(SolrServer server)  {
    return (SolrPingResponse)server.request(
      "/admin/ping", METHOD.GET, null, null, new ResponseStreamProcessor()  {
          public SolrResponse processResponseStream(InputStream body)  {
              // something real would actually process the body
              return new SolrPingResponse();
          }
	});
  }
}

And you can call it with:

  new SolrPing().process( server );

Re: [jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by Edward Summers <eh...@pobox.com>.
On Jan 24, 2007, at 4:05 PM, Ken Krugler wrote:
>> SolrQueryResponse rsp = (SolrQueryResponse)client.process( req );
>> vs
>> SolrQueryResponse rsp = queryRequest.execute( client );

This might seem outlandish but have you considered modeling a server  
instead of a client? Then you can send request messages to it and get  
back response messages.

   SolrSelectResponse response = server.select(selectOptions);

//Ed

Re: [jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by Ken Krugler <kk...@transpac.com>.
Hi Ryan,

>The big API question/style i'm struggling with is
>
>SolrResponse rsp = client.process( req );
>  vs
>SolrResponse rsp = req.execute( client );  // execute may not be the 
>right word
>
>The first one is more natural, and is how things are actually
>processed.  The second one allows eliminates the need for lots of
>casting:
>
>SolrQueryResponse rsp = (SolrQueryResponse)client.process( req );
>vs
>SolrQueryResponse rsp = queryRequest.execute( client );
>
>Any thoughts?

Haven't dug into the client code, but my natural inclination would be 
to go with the latter...it fits better with how I'd write the test 
code if I was implementing such a thing. E.g. create a mock client 
and then use that to test the request object.

-- Ken
-- 
Ken Krugler
Krugle, Inc.
+1 530-210-6378
"Find Code, Find Answers"

Re: [jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by Ryan McKinley <ry...@gmail.com>.
>
> > * I'm using wt=JSON rather then XML. (It maps to a hash easier)
> Heh... I quickly checked out the code, but didn't see where you were parsing the code, or where the JSONObject class referenced is.
>
> Anyway, if you want the *best* JSON parser on the planet, check out
> http://www.nabble.com/Apache-Lab-proposal%3A-noggit-tf2701405.html#a7532843
> http://svn.apache.org/repos/asf/labs/noggit/
> :-)
> I haven't had a chance to do the writing side, or the "create full object graph" part, but the parser is screaming fast.
>

I'm using a slightly modified version of the json.org code.  It stores
things in a LinkedHashMap (to maintain order) and formats dates
explicitly.

http://svn.lapnap.net/solr/solrj/src/org/apache/solr/util/json/

I just had a quick look at noggit.  It looks interesting.  If I
understand it correctly, noggit is to XPP as the json.org code is to
DOM


> > * handles multiple ContentStreams using multi-part form upload
> Will a client need to do that?  I had thought a browser would be the only one using multi-part
>

I don't know if it will *need* to do it - but I think the client API
should be as close to the RequestHandler API as possible.  Since (in
SOLR-104) the server side accepts Iterable<ContentStream>, the client
should send Iterable<ContentStream>.  With commons http-client,
sending multi-part data is almost equivolent to sending form data.


> > * You can define and automatically build a solr document with annotations
> Sounds cool
>
> > * Includes a first draft for a HibernateEventListener.
> Sounds *very* cool... it should go in a separate contrib eventually.
>

Yes, it is a single class - quite small really - but has 8MB of
required .jar files to compile and test it!  When it is more stable
and i have some time, i'll seperate it into two projects.

- - - - -

The big API question/style i'm struggling with is

SolrResponse rsp = client.process( req );
  vs
SolrResponse rsp = req.execute( client );  // execute may not be the right word

The first one is more natural, and is how things are actually
processed.  The second one allows eliminates the need for lots of
casting:

SolrQueryResponse rsp = (SolrQueryResponse)client.process( req );
vs
SolrQueryResponse rsp = queryRequest.execute( client );

Any thoughts?

Re: [jira] Resolved: (SOLR-20) A simple Java client for updating and searching

Posted by Ryan McKinley <ry...@gmail.com>.
Just to be clean, you can (and should) keep using 1.2 for the solr 
server; but solrj is only in the trunk (1.3) branch.


John Stewart wrote:
> Aha, 1.3.  Thanks,  I'm using 1.2.
> 
> jds
> 
> On 6/15/07, Ryan McKinley <ry...@gmail.com> wrote:
>>
>> after running "ant dist"
>>
>> you will need:
>>   apache-solr-1.3-dev-common.jar
>>   apache-solr-1.3-dev-solrj.jar
>>   solrj-lib/*.jar
>>
>>
>>
>> John Stewart wrote:
>> > Hi Ryan,
>> >
>> > Forgive me if this is a newbie question.  I just pulled solrj out of 
>> the
>> > main solr trunk.  There's a dependency on import
>> > org.apache.solr.common.util.NamedList.  I can't find this
>> class.  There's a
>> > import org.apache.util.NamedList, but not a package called common.
>> >
>> > Thanks,
>> >
>> > jds
>> >
>> > On 6/15/07, Ryan McKinley (JIRA) <ji...@apache.org> wrote:
>> >>
>> >>
>> >>      [
>> >>
>> https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel 
>>
>> ]
>> >>
>> >>
>> >> Ryan McKinley resolved SOLR-20.
>> >> -------------------------------
>> >>
>> >>     Resolution: Fixed
>> >>
>> >> Added to trunk...  any new problems should get their own issue.
>> >>
>> >> > A simple Java client for updating and searching
>> >> > -----------------------------------------------
>> >> >
>> >> >                 Key: SOLR-20
>> >> >                 URL: https://issues.apache.org/jira/browse/SOLR-20
>> >> >             Project: Solr
>> >> >          Issue Type: New Feature
>> >> >          Components: clients - java
>> >> >         Environment: all
>> >> >            Reporter: Darren Erik Vengroff
>> >> >            Assignee: Ryan McKinley
>> >> >            Priority: Minor
>> >> >         Attachments: DocumentManagerClient.java,
>> >> DocumentManagerClient.java, solr-client-java-2.zip.zip,
>> >> solr-client-java.zip, solr-client-sources.jar, solr-client.zip,
>> >> solr-client.zip, solr-client.zip, solrclient_addqueryfacet.zip,
>> >> SolrClientException.java, SolrServerException.java
>> >> >
>> >> >
>> >> > I wrote a simple little client class that can connect to a Solr
>> server
>> >> and issue add, delete, commit and optimize commands using Java
>> >> methods.  I'm
>> >> posting here for review and comments as suggested by Yonik.
>> >>
>> >> --
>> >> This message is automatically generated by JIRA.
>> >> -
>> >> You can reply to this email to add a comment to the issue online.
>> >>
>> >>
>> >
>>
>>
> 


Re: [jira] Resolved: (SOLR-20) A simple Java client for updating and searching

Posted by John Stewart <ca...@gmail.com>.
Aha, 1.3.  Thanks,  I'm using 1.2.

jds

On 6/15/07, Ryan McKinley <ry...@gmail.com> wrote:
>
> after running "ant dist"
>
> you will need:
>   apache-solr-1.3-dev-common.jar
>   apache-solr-1.3-dev-solrj.jar
>   solrj-lib/*.jar
>
>
>
> John Stewart wrote:
> > Hi Ryan,
> >
> > Forgive me if this is a newbie question.  I just pulled solrj out of the
> > main solr trunk.  There's a dependency on import
> > org.apache.solr.common.util.NamedList.  I can't find this
> class.  There's a
> > import org.apache.util.NamedList, but not a package called common.
> >
> > Thanks,
> >
> > jds
> >
> > On 6/15/07, Ryan McKinley (JIRA) <ji...@apache.org> wrote:
> >>
> >>
> >>      [
> >>
> https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
> ]
> >>
> >>
> >> Ryan McKinley resolved SOLR-20.
> >> -------------------------------
> >>
> >>     Resolution: Fixed
> >>
> >> Added to trunk...  any new problems should get their own issue.
> >>
> >> > A simple Java client for updating and searching
> >> > -----------------------------------------------
> >> >
> >> >                 Key: SOLR-20
> >> >                 URL: https://issues.apache.org/jira/browse/SOLR-20
> >> >             Project: Solr
> >> >          Issue Type: New Feature
> >> >          Components: clients - java
> >> >         Environment: all
> >> >            Reporter: Darren Erik Vengroff
> >> >            Assignee: Ryan McKinley
> >> >            Priority: Minor
> >> >         Attachments: DocumentManagerClient.java,
> >> DocumentManagerClient.java, solr-client-java-2.zip.zip,
> >> solr-client-java.zip, solr-client-sources.jar, solr-client.zip,
> >> solr-client.zip, solr-client.zip, solrclient_addqueryfacet.zip,
> >> SolrClientException.java, SolrServerException.java
> >> >
> >> >
> >> > I wrote a simple little client class that can connect to a Solr
> server
> >> and issue add, delete, commit and optimize commands using Java
> >> methods.  I'm
> >> posting here for review and comments as suggested by Yonik.
> >>
> >> --
> >> This message is automatically generated by JIRA.
> >> -
> >> You can reply to this email to add a comment to the issue online.
> >>
> >>
> >
>
>

Re: [jira] Resolved: (SOLR-20) A simple Java client for updating and searching

Posted by Ryan McKinley <ry...@gmail.com>.
after running "ant dist"

you will need:
  apache-solr-1.3-dev-common.jar
  apache-solr-1.3-dev-solrj.jar
  solrj-lib/*.jar



John Stewart wrote:
> Hi Ryan,
> 
> Forgive me if this is a newbie question.  I just pulled solrj out of the
> main solr trunk.  There's a dependency on import
> org.apache.solr.common.util.NamedList.  I can't find this class.  There's a
> import org.apache.util.NamedList, but not a package called common.
> 
> Thanks,
> 
> jds
> 
> On 6/15/07, Ryan McKinley (JIRA) <ji...@apache.org> wrote:
>>
>>
>>      [
>> https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel] 
>>
>>
>> Ryan McKinley resolved SOLR-20.
>> -------------------------------
>>
>>     Resolution: Fixed
>>
>> Added to trunk...  any new problems should get their own issue.
>>
>> > A simple Java client for updating and searching
>> > -----------------------------------------------
>> >
>> >                 Key: SOLR-20
>> >                 URL: https://issues.apache.org/jira/browse/SOLR-20
>> >             Project: Solr
>> >          Issue Type: New Feature
>> >          Components: clients - java
>> >         Environment: all
>> >            Reporter: Darren Erik Vengroff
>> >            Assignee: Ryan McKinley
>> >            Priority: Minor
>> >         Attachments: DocumentManagerClient.java,
>> DocumentManagerClient.java, solr-client-java-2.zip.zip,
>> solr-client-java.zip, solr-client-sources.jar, solr-client.zip,
>> solr-client.zip, solr-client.zip, solrclient_addqueryfacet.zip,
>> SolrClientException.java, SolrServerException.java
>> >
>> >
>> > I wrote a simple little client class that can connect to a Solr server
>> and issue add, delete, commit and optimize commands using Java 
>> methods.  I'm
>> posting here for review and comments as suggested by Yonik.
>>
>> -- 
>> This message is automatically generated by JIRA.
>> -
>> You can reply to this email to add a comment to the issue online.
>>
>>
> 


Re: [jira] Resolved: (SOLR-20) A simple Java client for updating and searching

Posted by John Stewart <ca...@gmail.com>.
Hi Ryan,

Forgive me if this is a newbie question.  I just pulled solrj out of the
main solr trunk.  There's a dependency on import
org.apache.solr.common.util.NamedList.  I can't find this class.  There's a
import org.apache.util.NamedList, but not a package called common.

Thanks,

jds

On 6/15/07, Ryan McKinley (JIRA) <ji...@apache.org> wrote:
>
>
>      [
> https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel]
>
> Ryan McKinley resolved SOLR-20.
> -------------------------------
>
>     Resolution: Fixed
>
> Added to trunk...  any new problems should get their own issue.
>
> > A simple Java client for updating and searching
> > -----------------------------------------------
> >
> >                 Key: SOLR-20
> >                 URL: https://issues.apache.org/jira/browse/SOLR-20
> >             Project: Solr
> >          Issue Type: New Feature
> >          Components: clients - java
> >         Environment: all
> >            Reporter: Darren Erik Vengroff
> >            Assignee: Ryan McKinley
> >            Priority: Minor
> >         Attachments: DocumentManagerClient.java,
> DocumentManagerClient.java, solr-client-java-2.zip.zip,
> solr-client-java.zip, solr-client-sources.jar, solr-client.zip,
> solr-client.zip, solr-client.zip, solrclient_addqueryfacet.zip,
> SolrClientException.java, SolrServerException.java
> >
> >
> > I wrote a simple little client class that can connect to a Solr server
> and issue add, delete, commit and optimize commands using Java methods.  I'm
> posting here for review and comments as suggested by Yonik.
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>

RE: [jira] Updated: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by Chris Hostetter <ho...@fucit.org>.
: implementation super-simple, though arguably it would have been better to
: skip getLastServerException() and just throw an exception on the client side
: when a non-zero server side status came back.  That would improve thread
: safety.

yeah .. if i remember ight,you have a SOlrClientException right/ .. you
could also have a SolrServerException to distinguish the two cases.

: comes to dealing with errors coming back from the server.  In the standard
: async kind of model with one or more producers (those calling add())
: dropping work into a queue, and one or more consumers pulling work from the
: queue and actually contacting the server, there is little or nothing a
: consumer can do to alert the original producer of an add that a server-side
: error occurred.  Indeed the consumer is unlikely to be able to do much other
: than log the error, hope that is enough, and move on.  In many cases this is

1) given enough information about hte nature of hte error, the producer
could choose to reattempt the operation.

2) i've been told that this is the use case the "Future" interface in
Java1.5 attempts to solve, but i've never had a chance (or a serious need)
to play with it.

: FWIW, in my own work on top of DocumentManagerClient I have just set myself
: up with one DocumentManagerClient per thread and left it at that.  It won't
: work for all applications, but it happens to work for mine at the moment.

I think that may be a pretty legitimate approach to take provided your
goal is for DocumentManagerClient to be a "low level" API (whatever that
may mean) ... "high level" APIs can worry about consuming/queing actions
and managing pools of DocumentManagerClient objects. (or something like
that)

The one thing that you may want to incorporate at the low level is
persistent HTTP connections when clients ask DocumentManagerClient to add
multiple documents at the same time.




: -----Original Message-----
: From: Yonik Seeley [mailto:yseeley@gmail.com]
: Sent: Friday, June 02, 2006 10:39 AM
: To: solr-dev@lucene.apache.org
: Subject: Re: [jira] Updated: (SOLR-20) A simple Java client with Java APIs
: for add(), delete(), commit() and optimize().
:
: Thanks for contributing this Darren!
:
: Some thoughts about future directions:
: How would someone go about maximizing throughput by using multiple
: connections and multiple requests to a Solr server?
:
: There are two cases from the client perspective:
:   1) client has a single thread calling add()
:   2) client has multiple threads generating documents and calling add()
:
: Interface:
:   1) We could have a pool of DocumentManagerClient objects, and create
: a *new* interface that accepts updates and dispatches to an available
: DocumentManagerClient.
:   2) We could make DocumentManagerClient an interface, and have both a
: single threaded version and a multi-threaded, multi-connection version
: (which could simply use multiple single threaded versions).
:   - if we opted for (2), then we should make the single-threaded
: version MT safe so the client wouldn't have to know that one
: implementation is and one isn't.  Wouldn't be too hard - might need to
: get rid of getLastServerException().
:
:
: Implementation:
:   Java5 concurrency classes!
:
: -Yonik
:



-Hoss


RE: [jira] Updated: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by Darren Vengroff <ve...@gmail.com>.
The multi-threaded cases are interesting.  I tried to keep the initial
implementation super-simple, though arguably it would have been better to
skip getLastServerException() and just throw an exception on the client side
when a non-zero server side status came back.  That would improve thread
safety.

One additional issue that comes to mind in option 2 below is that different
kinds of clients may have different requirements or expectations when it
comes to dealing with errors coming back from the server.  In the standard
async kind of model with one or more producers (those calling add())
dropping work into a queue, and one or more consumers pulling work from the
queue and actually contacting the server, there is little or nothing a
consumer can do to alert the original producer of an add that a server-side
error occurred.  Indeed the consumer is unlikely to be able to do much other
than log the error, hope that is enough, and move on.  In many cases this is
perfectly good enough.  But in cases where the original producer actually
cares there was an error, it's problematic.  I suspect we would just punt
and go for the logging solution, but that then drags in log4j or commons
logging or whatever else you want to use, all of which have the feature that
they are different than what someone who wants to call this very low level
client code is using in the rest of their application. Or you could have a
callback mechanism, and let people write logging callbacks if they want.

I'm not saying we shouldn't do all of this, but merely that we should think
about it and have an actual plan.  I think you will agree that it's
significantly more nuanced than the client code we have so far, which more
or less wrote itself.

FWIW, in my own work on top of DocumentManagerClient I have just set myself
up with one DocumentManagerClient per thread and left it at that.  It won't
work for all applications, but it happens to work for mine at the moment.

-D

-----Original Message-----
From: Yonik Seeley [mailto:yseeley@gmail.com] 
Sent: Friday, June 02, 2006 10:39 AM
To: solr-dev@lucene.apache.org
Subject: Re: [jira] Updated: (SOLR-20) A simple Java client with Java APIs
for add(), delete(), commit() and optimize().

Thanks for contributing this Darren!

Some thoughts about future directions:
How would someone go about maximizing throughput by using multiple
connections and multiple requests to a Solr server?

There are two cases from the client perspective:
  1) client has a single thread calling add()
  2) client has multiple threads generating documents and calling add()

Interface:
  1) We could have a pool of DocumentManagerClient objects, and create
a *new* interface that accepts updates and dispatches to an available
DocumentManagerClient.
  2) We could make DocumentManagerClient an interface, and have both a
single threaded version and a multi-threaded, multi-connection version
(which could simply use multiple single threaded versions).
  - if we opted for (2), then we should make the single-threaded
version MT safe so the client wouldn't have to know that one
implementation is and one isn't.  Wouldn't be too hard - might need to
get rid of getLastServerException().


Implementation:
  Java5 concurrency classes!

-Yonik


Re: [jira] Updated: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by Yonik Seeley <ys...@gmail.com>.
Thanks for contributing this Darren!

Some thoughts about future directions:
How would someone go about maximizing throughput by using multiple
connections and multiple requests to a Solr server?

There are two cases from the client perspective:
  1) client has a single thread calling add()
  2) client has multiple threads generating documents and calling add()

Interface:
  1) We could have a pool of DocumentManagerClient objects, and create
a *new* interface that accepts updates and dispatches to an available
DocumentManagerClient.
  2) We could make DocumentManagerClient an interface, and have both a
single threaded version and a multi-threaded, multi-connection version
(which could simply use multiple single threaded versions).
  - if we opted for (2), then we should make the single-threaded
version MT safe so the client wouldn't have to know that one
implementation is and one isn't.  Wouldn't be too hard - might need to
get rid of getLastServerException().


Implementation:
  Java5 concurrency classes!

-Yonik

RE: [jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by Chris Hostetter <ho...@fucit.org>.
: Has anyone thought of adding the docsum time to the qtime or possibly
: adding separate timing information for the real 'solr query time'.

it's pretty much impossible to include in the response a value which
indicates the total amount of time needed to generate the response...

1) the response is getting stream to the client as the ResponseWRiter
   generates it ... so a number like that could be "unfairly" high if the
   network is slow.
2) if the number is part of the response, and Solr needs to compute the
   number based on how long the entire response took to generate/send,
   then there is a catch22 ... at best a response writer could include a time
   value as the *very* last thing it sends, and report the time up to
   that point, but that wouldn't be the *total* time (and wouldn't include
   how long it took to close the connection on the server side)

...this is why log files are usually the best way to get timing info ...
you can log the *real* total time when you are all done.


-Hoss


Re: [jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by Mike Klaas <mi...@gmail.com>.
On 8-Jun-07, at 10:57 AM, Will Johnson wrote:

> Has anyone thought of adding the docsum time to the qtime or possibly
> adding separate timing information for the real 'solr query time'.
> While my bosses are very pleased that most searches seem to take  
> ~5ms it
> does seem a bit misleading.

docsum?  Summarizing?  That is already part of QTime.  However,  
loading document stored fields isn't.  Interestingly, you can force  
it to be part of QTime as a side-effect of specifying  
useLazyFieldLoading=true in solrconfig.xml.  Also, there is a patch  
here which already provide detailed timing data:
http://issues.apache.org/jira/browse/SOLR-176

> I'll take a crack at a patch unless there is a reason not to.

-Mike

RE: [jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by Will Johnson <wj...@GETCONNECTED.COM>.
Has anyone thought of adding the docsum time to the qtime or possibly
adding separate timing information for the real 'solr query time'.
While my bosses are very pleased that most searches seem to take ~5ms it
does seem a bit misleading.

I'll take a crack at a patch unless there is a reason not to.

- will

-----Original Message-----
From: Ryan McKinley (JIRA) [mailto:jira@apache.org] 
Sent: Friday, June 08, 2007 1:09 PM
To: solr-dev@lucene.apache.org
Subject: [jira] Commented: (SOLR-20) A simple Java client for updating
and searching


    [
https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.pl
ugin.system.issuetabpanels:comment-tabpanel#action_12502885 ] 

Ryan McKinley commented on SOLR-20:
-----------------------------------

I don't know if you are on solr-dev, Yonik noted that the QTime does not
include the time to write the response, only the query time.  To get an
accurate number for how long the whole query takes, check your app
server logs
http://www.nabble.com/Re%3A-A-simple-Java-client-for-updating-and-search
ing-tf3890950.html

To get a quick response from solr, try rows=0 or a 404 path.  (Of
course, the speed will depend on you network connection speed between
client-server)

> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java,
DocumentManagerClient.java, solr-client-java-2.zip.zip,
solr-client-java.zip, solr-client-sources.jar, solr-client.zip,
solr-client.zip, solr-client.zip, solrclient_addqueryfacet.zip,
SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server
and issue add, delete, commit and optimize commands using Java methods.
I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Updated: (SOLR-20) A simple Java client for updating and searching

Posted by Chris Hostetter <ho...@fucit.org>.
: Do you think the package name should change?
:
: org.apache.solr.client.SolrClient
: vs
: org.apache.solr.client.solrj.SolrClient;

yeah ... that way if down the road someone comes up with a radically new
Java API (that we can't even fathom yet) they can call it "solrad" and put
it in clients/java/solarad and make the packages be
"org.apache.solr.client.solarad.* and we can be sure there's no potential
for class name collision.

(this is the same model that the Lucene-Java tries to use with contrib
packages: each contribs lives in a seperate directory, but uses unique
packagenames)

: maybe the main ant task could copy a few files from:
:   /src/java/org/apache ...
:   /client/java/org/apache ...

or (as i think someone else mentioned somewhere) refactor some of the code
in src/java so that it compiles into a utility jar that can be shared by
teh war and the client code.

: Perhaps the client should parse the results into a 'NamedList'...

it would certinaly make sense since that's the most direct model of the
data (a list of pairs)

: > 6) what is the purpose of SolrDocumentable being an empty interface?
: > ... it seems like you could replace SolrDocumentable, ...
: >
: > public interface SolrDocument {
: >   public Map<String,Object> getSolrDocumentFields();
: > }
: > public abstract class SolrDocumented implements SolrDocument {
: >   protected abstract SolrDocument getSolrDocument();
: >   public Map<String,Object> getSolrDocumentFields() {
: >     return getSolrDocument().getSolrDocumentFields()
: >   }
: > }
:
: aaah, if only java allowed multiple inheritance!
:
: The two versions arose out of converting existing projects to use
: solr. In some cases it made sense to have the objects make their own
: document, in others id does not.  Originally, i had the structure you
: suggest, but the 'SolrDocumented' objects are already in a fixed
: hierarchy.

ah ... in other words you already have Objects in an inheritence
hierarchy that you want to pass directly to the SolrClient by making them
impliment a simple interface that says they know how to return a
SolrDocument ... i get that you can't change their base class, but why
is it neccessary to pass the orriginal object to the SolrClient? couldn't
we eliminate the SolrDocumented and SolrDocumentable interfaces completly
just be asking clients to write...

      UsersCustomClass {
        SolrDocument someMethodOfTheirChoice();
      }
      ...
      UsersCustomClass bizObject = ...
      solrClient.add(bizObject.someMethodOfTheirChoice());

...instead of...

      UsersCustomClass implements SolrDocumented{
        SolrDocument getSolrDocument();
      }
      ...
      UsersCustomClass bizObject = ...
      solrClient.add(bizObject);

?

: If it were more then one instanceof I would be more worried about
: it... but i'm open to suggestion.

technically there's two...

   if( document instanceof SolrDocument ) {
       fields = ((SolrDocument)document).getSolrDocumentFields();
   }
   else if( document instanceof SolrDocumented ) {
       fields = ((SolrDocumented)document).getSolrDocument().getSolrDocumentFields();
   }
   else {
       throw new RuntimeException( "don't know about SolrDocumentable type: " + document.getClass().getName() );

..the danger being we expose an interface, tell people they can pass
instances of it to a method, and then reject their instance if it's not
one of the two magic interfaces ... not a clean API.

if ther's really a need for SolrDocumented, we should make two seperate
interfaces, with two seperate add methods (one delegating to the other
after fetching the SolrDocument from the SolrDocumented.



-Hoss


Re: [jira] Updated: (SOLR-20) A simple Java client for updating and searching

Posted by Ryan McKinley <ry...@gmail.com>.
Thanks for the feedback!

Should this reply go to the solr-dev or be posted on JIRA?


>
> 1) i like the name solrj, ...
>

Do you think the package name should change?

org.apache.solr.client.SolrClient
vs
org.apache.solr.client.solrj.SolrClient;


>
> 3) I'm really not fond of "ParamNames.java" being a copy ...
>

I agree - but don't know any good solution.

maybe the main ant task could copy a few files from:
  /src/java/org/apache ...
  /client/java/org/apache ...

Perhaps the client should parse the results into a 'NamedList'...


>
> 4) one thing we should really try to support in a client ...
>
> public class AbstractSolrQuery implements SolrQuery {
>    protected abstract SolrParams getSolrParams();
>    public String getQueryString() {
>      ... your current code, looping over getSolrParams() ...
>    }
> }
>

agreed.  thats a good idea

>
> 5) what is the purpose of SolrClientStub ?
>

I use it for testing and to temporarily disable sending stuff to solr.
 I have some hooks set up to send stuff to solr using a SolrClient -
changing to a stub is an easy way to bypass the behavior.

It may not belong in the official release... perhaps under /test.


> 6) what is the purpose of SolrDocumentable being an empty interface?
> ... it seems like you could replace SolrDocumentable, ...
>
> public interface SolrDocument {
>   public Map<String,Object> getSolrDocumentFields();
> }
> public abstract class SolrDocumented implements SolrDocument {
>   protected abstract SolrDocument getSolrDocument();
>   public Map<String,Object> getSolrDocumentFields() {
>     return getSolrDocument().getSolrDocumentFields()
>   }
> }

aaah, if only java allowed multiple inheritance!

The two versions arose out of converting existing projects to use
solr. In some cases it made sense to have the objects make their own
document, in others id does not.  Originally, i had the structure you
suggest, but the 'SolrDocumented' objects are already in a fixed
hierarchy.


>
> Then you wouldn't need that instanceof code in SolrClientImpl
>

If it were more then one instanceof I would be more worried about
it... but i'm open to suggestion.

>
> Note that we should probably support field and document boosts as well, ...
>
>   public int getDocumentBoost();
>   public Map<String,Integer> getFieldBoosts()
>
> ...to SolrDocument.
>

good idea


>
> 7) The ResultsParser and QueryResults classes seem to suffer the same limitation ...
>

Maybe the best is to have the ResultsParser parse a 'NamedList', then
have various QueryResults that know what to do with the results.


> 8) ... i think it's completely practical to focus on client code which currently
> supports only the XmlResponseWriter output -- especially with the solrj ResultsParser class currently having a single public method...
>

agreed.  i'll remove the XML exceptions...


- - - - -

Thanks for your feedback.  I apologize for filling up your inbox these
past few days!

thanks
ryan






On 1/14/07, Hoss Man (JIRA) <ji...@apache.org> wrote:
>
>      [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
>
> Hoss Man updated SOLR-20:
> -------------------------
>
>     Summary: A simple Java client for updating and searching  (was: A simple Java client with Java APIs for add(), delete(), commit() and optimize().)
>
>
> (NOTE: revised summary since this issue has moved beyond just updating)
>
> I *finally* had a chance to look this over, here's a few comments in
> no particular order...
>
> 1) i like the name solrj, i think this code should definitely live in client/java/solrj so that there is the potential for other java client code that is independent (if nothing else, i suspect something like SOLR-86 might be handy) ... we should probably put solrj in the package name as well.
>
> 2) i wouldn't worry about having a special package for the exceptions ... they've got exception in their name, no ones going to be confused.
>
> 3) I'm really not fond of "ParamNames.java" being a copy of the constants in "SolrParams.java", or XML.java being copied, or the xpp jar being duplicated ... it seems like we should just pull in those (compiled) classes at build time ... but that would require that the whole Solr tree be checked out, and there seems to be interest in making it possible to "svn checkout client/lang/impl" and build that in isolation ... perhaps we could use svn:externals to pull in specific utility classes and jars from other places in the tree? (although based on what I've read today, branching for releases would be hard since all of the svn:external props would have to be updated).
>
> what do people think in general about how the client code can/should/shouldn't depend on the core server code?
>
>
> 4) one thing we should really try to support in a client is executing query requests against non-standard request handlers ... handlers that might take in request params that we can't even imagine.  The SolrQuery class has explicit setters for many of the params that the built in request handlers support, but there is no easy way for people to build other queries.  I think it might make sense if SolrQuery was an interface that just defined the methods needed by the SolrClient -- probably just getQueryString().  Then their can be a SimpleSolrQuery that has all of the setters in the current SolrQuery class, possibly using a general baseclass with an impl of getQueryString that uses some SolrParams...
>
> public class AbstractSolrQuery implements SolrQuery {
>    protected abstract SolrParams getSolrParams();
>    public String getQueryString() {
>      ... your current code, looping over getSolrParams() ...
>    }
> }
>
>
> 5) what is the purpose of SolrClientStub ?
>
> 6) what is the purpose of SolrDocumentable being an empty interface? ... it seems like you could replace SolrDocumentable, SolrDocument, and SolrDocumented with something like this...
>
> public interface SolrDocument {
>   public Map<String,Object> getSolrDocumentFields();
> }
> public abstract class SolrDocumented implements SolrDocument {
>   protected abstract SolrDocument getSolrDocument();
>   public Map<String,Object> getSolrDocumentFields() {
>     return getSolrDocument().getSolrDocumentFields()
>   }
> }
>
> Then you wouldn't need that instanceof code in SolrClientImpl
>
> Note that we should probably support field and document boosts as well, but field boosts don't really need to be specified in the Map since they apply to the whole field and not the individual values, so we could just add...
>
>   public int getDocumentBoost();
>   public Map<String,Integer> getFieldBoosts()
>
> ...to SolrDocument.
>
> 7) The ResultsParser and QueryResults classes seem to suffer the same limitation that i was mentioning about the SolrQuery class -- they assume a very specific response structure (only one doc list, an optional facet block, an optional highlighting block, an optional debug block) ... I think since the ResultsParser already understands the all of the various tags that are used, it should be easy to do this as long as the QueryResult object becomes a more general container that any named data can be shoved into (just like SolrQueryResponse is on the server side) ... then a "SimpleQueryResults" class could be written that had the convenience methods that make sense when using StandardRequestHandler or DisMaxRequestHandler.
>
> 8) There was a comment in SOLR-30 regarding the issue of that code only parsing the XML response ... i think it's completely practical to focus on client code which currently supports only the XmlResponseWriter output -- especially with the solrj ResultsParser class currently having a single public method...
>
>     public QueryResults process( Reader reader ) throws SolrClientException, SolrServerException, XmlPullParserException, IOException
>
> ...i think if we removed XmlPullParserException from that list of exceptions (it could always be wrapped in a SolrClientException, or a new SolrClientParseException) we have a really simple API where other ResultParser classes could be written to handle JSON or what not down the road just by adding a simple setResultParser to SolrClient.
>
>
>
> > A simple Java client for updating and searching
> > -----------------------------------------------
> >
> >                 Key: SOLR-20
> >                 URL: https://issues.apache.org/jira/browse/SOLR-20
> >             Project: Solr
> >          Issue Type: New Feature
> >          Components: clients - java
> >         Environment: all
> >            Reporter: Darren Erik Vengroff
> >            Priority: Minor
> >         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, SolrClientException.java, SolrServerException.java
> >
> >
> > I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.
>
> --
> This message is automatically generated by JIRA.
> -
> If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
> -
> For more information on JIRA, see: http://www.atlassian.com/software/jira
>
>
>

[jira] Commented: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by "Ryan McKinley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12463372 ] 

Ryan McKinley commented on SOLR-20:
-----------------------------------

added APL to zip

> A simple Java client with Java APIs for add(), delete(), commit() and optimize().
> ---------------------------------------------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by "Ryan McKinley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12499831 ] 

Ryan McKinley commented on SOLR-20:
-----------------------------------

Hi Ben-

Thanks for the patch.  Will Johnson added the options to the java client on:
http://solrstuff.org/svn/solrj/

This implementation is now quite stable (thanks to lots of help from Will!) and I hope will be integrated into solr trunk shortly after 1.2 (this week?!)

About the   allowDups/overwritePending/overwriteCommited options... what part of them do you use?  In SOLR-60, there is talk of replacing the three options with a (simpler) overwrite=true/false -- maybe we should change the client api to:

  UpdateResponse add( SolrDocument doc, boolean overwrite ) throws SolrServerException;

In anticipation of this change?

> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, solrclient_addqueryfacet.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SOLR-20) A simple Java client for updating and searching

Posted by "Walter Ferrara (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Walter Ferrara updated SOLR-20:
-------------------------------

    Comment: was deleted

> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, solrclient_addqueryfacet.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by "Walter Ferrara (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502470 ] 

Walter Ferrara commented on SOLR-20:
------------------------------------

[I'm new to solrj, so everything I'm write can be useless]

While trying to execute range query, using this query:
Text:Hello +Date:[1895011 TO 18971128] 
[jdk 1.6/netbeans 5.5/solr1.2/solrj revision 125]

I kept getting IllegalArgumentException:
[...]
Caused by: java.lang.IllegalArgumentException: Invalid uri 'http://localhost:8983/solr/select?q=Text:Hello+%2BDate:[1895011+TO+18971128]&fl=ID,Date,score&rows=800&wt=xml&version=2.2': Invalid query
        at org.apache.commons.httpclient.HttpMethodBase.<init>(HttpMethodBase.java:222)
        at org.apache.commons.httpclient.methods.GetMethod.<init>(GetMethod.java:89)
        at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:108)
[...]
It seems related to un-escaped '[' and ']'.

the solution was to patch StrUtils.java, in order to encode square brackets. 
If it is of any use, I'm attaching the patch
-- Walter

====
StrUtils.java.patch

204,207d203
<           case '[': dest.append("%5B"); break; // to allow range query, 20070706 (w)
<           case ']': dest.append("%5D"); break;
<           case '{': dest.append("%7B"); break;
<           case '}': dest.append("%7D"); break;


> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, solrclient_addqueryfacet.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by "Walter Ferrara (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502490 ] 

Walter Ferrara commented on SOLR-20:
------------------------------------

yeah, i eventually modified the function to be just

  public static void partialURLEncodeVal(Appendable dest, String val) throws IOException {
      dest.append(java.net.URLEncoder.encode(val, "UTF-8"));
  }

so exactly the same thing, this way works good on non-english language too. 
-- Walter

> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, solrclient_addqueryfacet.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/SOLR-20?page=comments#action_12415247 ] 

Yonik Seeley commented on SOLR-20:
----------------------------------

Great!  Now we need to figure out where it lives, and how to work out the dependencies (a solr-util.jar that a client could use, or perhaps just pull the needed class or two directly into the solr-client.jar)


> A simple Java client with Java APIs for add(), delete(), commit() and optimize().
> ---------------------------------------------------------------------------------
>
>          Key: SOLR-20
>          URL: http://issues.apache.org/jira/browse/SOLR-20
>      Project: Solr
>         Type: New Feature

>   Components: update
>  Environment: all
>     Reporter: Darren Erik Vengroff
>     Priority: Minor
>  Attachments: DocumentManagerClient.java, DocumentManagerClient.java, SolrClientException.java, SolrServerException.java, solr-client-java.zip
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by "Will Johnson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12490117 ] 

Will Johnson commented on SOLR-20:
----------------------------------

is there an updated package or anyone working on such a thing at the moment?  the solr-client.zip at the top of the thread works like a charm but seems to be very outdated and the bits on the svn://solrstuff.org site have some rather serious bugs.  

i'm happy to do all the leg work of packaging things, fixing bugs, submitting a patch, etc but i wanted to make sure i'm not about to walk right behind someone else.  also, if anyone has any ideas for the best starting point i'm happy to take suggestions.  

- will

> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, solrclient_addqueryfacet.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by "Erik Hatcher (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/SOLR-20?page=all ]

Erik Hatcher updated SOLR-20:
-----------------------------

    Attachment:     (was: DocumentManagerClient.java)

> A simple Java client with Java APIs for add(), delete(), commit() and optimize().
> ---------------------------------------------------------------------------------
>
>          Key: SOLR-20
>          URL: http://issues.apache.org/jira/browse/SOLR-20
>      Project: Solr
>         Type: New Feature

>   Components: update
>  Environment: all
>     Reporter: Darren Erik Vengroff
>     Priority: Minor
>  Attachments: DocumentManagerClient.java, SolrClientException.java
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (SOLR-20) A simple Java client for updating and searching

Posted by "Hoss Man (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hoss Man updated SOLR-20:
-------------------------

    Summary: A simple Java client for updating and searching  (was: A simple Java client with Java APIs for add(), delete(), commit() and optimize().)


(NOTE: revised summary since this issue has moved beyond just updating)

I *finally* had a chance to look this over, here's a few comments in
no particular order... 

1) i like the name solrj, i think this code should definitely live in client/java/solrj so that there is the potential for other java client code that is independent (if nothing else, i suspect something like SOLR-86 might be handy) ... we should probably put solrj in the package name as well.

2) i wouldn't worry about having a special package for the exceptions ... they've got exception in their name, no ones going to be confused.

3) I'm really not fond of "ParamNames.java" being a copy of the constants in "SolrParams.java", or XML.java being copied, or the xpp jar being duplicated ... it seems like we should just pull in those (compiled) classes at build time ... but that would require that the whole Solr tree be checked out, and there seems to be interest in making it possible to "svn checkout client/lang/impl" and build that in isolation ... perhaps we could use svn:externals to pull in specific utility classes and jars from other places in the tree? (although based on what I've read today, branching for releases would be hard since all of the svn:external props would have to be updated).

what do people think in general about how the client code can/should/shouldn't depend on the core server code?


4) one thing we should really try to support in a client is executing query requests against non-standard request handlers ... handlers that might take in request params that we can't even imagine.  The SolrQuery class has explicit setters for many of the params that the built in request handlers support, but there is no easy way for people to build other queries.  I think it might make sense if SolrQuery was an interface that just defined the methods needed by the SolrClient -- probably just getQueryString().  Then their can be a SimpleSolrQuery that has all of the setters in the current SolrQuery class, possibly using a general baseclass with an impl of getQueryString that uses some SolrParams...

public class AbstractSolrQuery implements SolrQuery {
   protected abstract SolrParams getSolrParams();
   public String getQueryString() {
     ... your current code, looping over getSolrParams() ...
   }
}


5) what is the purpose of SolrClientStub ?

6) what is the purpose of SolrDocumentable being an empty interface? ... it seems like you could replace SolrDocumentable, SolrDocument, and SolrDocumented with something like this...

public interface SolrDocument {
  public Map<String,Object> getSolrDocumentFields();
}
public abstract class SolrDocumented implements SolrDocument {
  protected abstract SolrDocument getSolrDocument();
  public Map<String,Object> getSolrDocumentFields() {
    return getSolrDocument().getSolrDocumentFields()
  }
}

Then you wouldn't need that instanceof code in SolrClientImpl

Note that we should probably support field and document boosts as well, but field boosts don't really need to be specified in the Map since they apply to the whole field and not the individual values, so we could just add...
  
  public int getDocumentBoost();
  public Map<String,Integer> getFieldBoosts()

...to SolrDocument.

7) The ResultsParser and QueryResults classes seem to suffer the same limitation that i was mentioning about the SolrQuery class -- they assume a very specific response structure (only one doc list, an optional facet block, an optional highlighting block, an optional debug block) ... I think since the ResultsParser already understands the all of the various tags that are used, it should be easy to do this as long as the QueryResult object becomes a more general container that any named data can be shoved into (just like SolrQueryResponse is on the server side) ... then a "SimpleQueryResults" class could be written that had the convenience methods that make sense when using StandardRequestHandler or DisMaxRequestHandler.

8) There was a comment in SOLR-30 regarding the issue of that code only parsing the XML response ... i think it's completely practical to focus on client code which currently supports only the XmlResponseWriter output -- especially with the solrj ResultsParser class currently having a single public method...
   
    public QueryResults process( Reader reader ) throws SolrClientException, SolrServerException, XmlPullParserException, IOException

...i think if we removed XmlPullParserException from that list of exceptions (it could always be wrapped in a SolrClientException, or a new SolrClientParseException) we have a really simple API where other ResultParser classes could be written to handle JSON or what not down the road just by adding a simple setResultParser to SolrClient.



> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by "Ryan McKinley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12504912 ] 

Ryan McKinley commented on SOLR-20:
-----------------------------------


I'm integrating SOLR-20 with trunk now...

The basic stuff is no problem.  I'm struggling with the best way to:
* included shared libraries (commons-io, etc)
* structure build.xml
* add tests that launch jetty
* package solrj (and dependencies)

I think the best approach is to commit my best effort and then have you 
all review/fix/modify.  Building a useful patch is unrealistic.

ryan



> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Assignee: Ryan McKinley
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, solrclient_addqueryfacet.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by "Ryan McKinley (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/SOLR-20?page=all ]

Ryan McKinley updated SOLR-20:
------------------------------

    Attachment: solr-client.zip

I've attached the client code i have written that merges SOLR-20 & SOLR-30.  It can add, delete, commit, optimize and search.

The main interface is SolrClient.  

It uses the XPP parser to parse the search results.  

If there is interist, i can clean it up some more...  

> A simple Java client with Java APIs for add(), delete(), commit() and optimize().
> ---------------------------------------------------------------------------------
>
>                 Key: SOLR-20
>                 URL: http://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: update
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by "Fuad Efendi (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/SOLR-20?page=comments#action_12461050 ] 
            
Fuad Efendi commented on SOLR-20:
---------------------------------

SOLR-20: add, delete, commit, optimize 
SOLR-30: search

So, should be merged.

HttpClient seems to be right choice (easily configurable; 'follow redirects', 'buffer size', etc.).

Possible improvements: 
- make it independent on implementation (for instance, use interface and HttpClient-based implementation)
- XML-based external configuration file
- no need for JDOM...

Probably, we need separate src/client folder for source files (sources do not depend on SOLR)

> A simple Java client with Java APIs for add(), delete(), commit() and optimize().
> ---------------------------------------------------------------------------------
>
>                 Key: SOLR-20
>                 URL: http://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: update
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by "Ryan McKinley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12474078 ] 

Ryan McKinley commented on SOLR-20:
-----------------------------------

I don't think this one is quite ready to go, but anyone interested can see an updated versions at:

 http://solrstuff.org/svn/solrj/ 
 http://solrstuff.org/svn/solrj-hibernate/

I have extracted the hibernate specific stuff into its own project so solrj is a bit more manageable.

- - - - - 

If you are looking for a stable, simple client "solr-client.zip" is still your best bet.


> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by "Ryan McKinley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12492608 ] 

Ryan McKinley commented on SOLR-20:
-----------------------------------

For anyone interested, I've finished a major overhaul of the client at:
  http://solrstuff.org/svn/solrj/
It is a dramatically different architecture then before.  Essentially it reads each response into a NamedList and each response type knows what the contents mean.

After solr1.2, I'll work on getting something like this into the official apache distribution.

This client source duplicates many classes that will eventually be extracted into an independent solr-utils.jar (SOLR-135).  Everything that is not in "client"
http://solrstuff.org/svn/solrj/src/org/apache/solr/ will be in this .jar

I am using this in production code -- but i don't suggest that it is production ready just yet.  



> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, solrclient_addqueryfacet.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502852 ] 

Yonik Seeley commented on SOLR-20:
----------------------------------

FYI partialURLEncodeVal was meant for readable, yet unambiguous logging... hence a minimum of escaping is done (but enough to easily paste into a browser and let it do the rest of the escaping when you sumbit).

> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, solrclient_addqueryfacet.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by "Walter Ferrara (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502872 ] 

Walter Ferrara commented on SOLR-20:
------------------------------------

Latest rev works perfectly thanks. 
I've been making some time test with this client (only searching), and overall results show high times: this maybe due to my minimal knowledge on solr, but solr seems fast, is data-receiving/parsing on client that seems slow. Even when solr report 0ms (due to cache it I presume) it still take 200ms to get results (QueryResponse .getElapsedTime()). I'm using this code: 

SolrQuery query = new SolrQuery(queryString);
CommonsHttpSolrServer server = new CommonsHttpSolrServer("http://localhost:8983/solr/");
QueryResponse response = server.query(query);
SolrDocumentList list = response.getResults();

The slowdown seems to be in client.executeMethod(method) (CommonsHttpSolrServer) Any way to speed up (assuming I'm not totally wrong on how to use this client...)? Reusing same http connection for multiple queries? Playing with MultiThreadedHttpConnectionManager helped a bit, but doesn't seems the solution

> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, solrclient_addqueryfacet.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by "Ryan McKinley (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ryan McKinley updated SOLR-20:
------------------------------

    Attachment: solr-client.zip

> A simple Java client with Java APIs for add(), delete(), commit() and optimize().
> ---------------------------------------------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by "Erik Hatcher (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/SOLR-20?page=comments#action_12414394 ] 

Erik Hatcher commented on SOLR-20:
----------------------------------

One idea for dealing with multivalued fields is to check the type of the object in the Map and if is an array or Collection then iterate over it rather than just doing .toString() on it.  Would that logic work for your use as well?

> A simple Java client with Java APIs for add(), delete(), commit() and optimize().
> ---------------------------------------------------------------------------------
>
>          Key: SOLR-20
>          URL: http://issues.apache.org/jira/browse/SOLR-20
>      Project: Solr
>         Type: New Feature

>   Components: update
>  Environment: all
>     Reporter: Darren Erik Vengroff
>     Priority: Minor
>  Attachments: DocumentManagerClient.java, DocumentManagerClient.java, SolrClientException.java
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by "Fuad Efendi (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/SOLR-20?page=comments#action_12461517 ] 
            
Fuad Efendi commented on SOLR-20:
---------------------------------

My previous comment is visible to jira-users only, sorry.
Code submitted by Ryan looks great!


> A simple Java client with Java APIs for add(), delete(), commit() and optimize().
> ---------------------------------------------------------------------------------
>
>                 Key: SOLR-20
>                 URL: http://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: update
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/SOLR-20?page=comments#action_12438790 ] 
            
Yonik Seeley commented on SOLR-20:
----------------------------------

Ping... 
any chance you could make your latest version available?


> A simple Java client with Java APIs for add(), delete(), commit() and optimize().
> ---------------------------------------------------------------------------------
>
>                 Key: SOLR-20
>                 URL: http://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: update
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by "Darren Erik Vengroff (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/SOLR-20?page=comments#action_12414414 ] 

Darren Erik Vengroff commented on SOLR-20:
------------------------------------------

Iterating over an array or Collection of values is a great suggestion.  I'll change it and resubmit when I have some time later today.

> A simple Java client with Java APIs for add(), delete(), commit() and optimize().
> ---------------------------------------------------------------------------------
>
>          Key: SOLR-20
>          URL: http://issues.apache.org/jira/browse/SOLR-20
>      Project: Solr
>         Type: New Feature

>   Components: update
>  Environment: all
>     Reporter: Darren Erik Vengroff
>     Priority: Minor
>  Attachments: DocumentManagerClient.java, DocumentManagerClient.java, SolrClientException.java
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Issue Comment Edited: (SOLR-20) A simple Java client for updating and searching

Posted by "Walter Ferrara (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502470 ] 

Walter Ferrara edited comment on SOLR-20 at 6/7/07 11:50 AM:
-------------------------------------------------------------

[I'm new to solrj, so everything I'm writing can be useless]

While trying to execute range query, using this query:
Text:Hello +Date:[1895011 TO 18971128] 
[jdk 1.6/netbeans 5.5/solr1.2/solrj revision 125]

I kept getting IllegalArgumentException:
[...]
Caused by: java.lang.IllegalArgumentException: Invalid uri 'http://localhost:8983/solr/select?q=Text:Hello+%2BDate:[1895011+TO+18971128]&fl=ID,Date,score&rows=800&wt=xml&version=2.2': Invalid query
        at org.apache.commons.httpclient.HttpMethodBase.<init>(HttpMethodBase.java:222)
        at org.apache.commons.httpclient.methods.GetMethod.<init>(GetMethod.java:89)
        at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:108)
[...]
It seems related to un-escaped '[' and ']'.

the solution was to patch StrUtils.java, in order to encode square brackets. 
If it is of any use, I'm attaching the patch
-- Walter

====
StrUtils.java.patch

204,207d203
<           case '[': dest.append("%5B"); break; // to allow range query, 20070706 (w)
<           case ']': dest.append("%5D"); break;
<           case '{': dest.append("%7B"); break;
<           case '}': dest.append("%7D"); break;



 was:
[I'm new to solrj, so everything I'm write can be useless]

While trying to execute range query, using this query:
Text:Hello +Date:[1895011 TO 18971128] 
[jdk 1.6/netbeans 5.5/solr1.2/solrj revision 125]

I kept getting IllegalArgumentException:
[...]
Caused by: java.lang.IllegalArgumentException: Invalid uri 'http://localhost:8983/solr/select?q=Text:Hello+%2BDate:[1895011+TO+18971128]&fl=ID,Date,score&rows=800&wt=xml&version=2.2': Invalid query
        at org.apache.commons.httpclient.HttpMethodBase.<init>(HttpMethodBase.java:222)
        at org.apache.commons.httpclient.methods.GetMethod.<init>(GetMethod.java:89)
        at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:108)
[...]
It seems related to un-escaped '[' and ']'.

the solution was to patch StrUtils.java, in order to encode square brackets. 
If it is of any use, I'm attaching the patch
-- Walter

====
StrUtils.java.patch

204,207d203
<           case '[': dest.append("%5B"); break; // to allow range query, 20070706 (w)
<           case ']': dest.append("%5D"); break;
<           case '{': dest.append("%7B"); break;
<           case '}': dest.append("%7D"); break;


> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, solrclient_addqueryfacet.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by "Frederic Hennequin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12478810 ] 

Frederic Hennequin commented on SOLR-20:
----------------------------------------

Hello, we have been testing the solr-client and think we have found a small bug :

the xml parsers on the query-side is not setup to use "UTF-8" encoding
this resulted in weird characters being returned by the solr-client...
for example : "é" came out like "©" ... not really what we would like...

we fixed it by setting the input stream for the xmlparser to "UTF8" which gave us this code in ResultsParser.java :
[code]
public QueryResults process( InputStream reader ) throws SolrClientException, SolrServerException, XmlPullParserException, IOException
    {
    	QueryResults res = new QueryResults();

		try {
			XmlPullParser xpp = null;
			try {
				xpp = factory.newPullParser();
				xpp.setInput(reader,"UTF-8");
				xpp.nextTag();
			} 
.....
[/code]

notice we changed the argument for this method to InputStream instead of the reader so we could add "UTF-8" to the stream.
by doing this we had to change the reader in SolrClientImpl.java to an inputstream :
[code]
....
InputStream inputStream = urlc.getInputStream();
			try {
				QueryResults res = parser.process( inputStream );
				res.setSolrURL( qurl );
				res.setQuery( query );
				return res;
			}
....
[/code]

in our opinion this was a major bug (since all solr-xml is encoded in utf-8) and we guess somebody just forgot to put it in...

yay, now we can all start using freaky characters without the client actually freaking out :) enjoy


> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by "David Halsted (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/SOLR-20?page=comments#action_12449911 ] 
            
David Halsted commented on SOLR-20:
-----------------------------------

it is a little confusing -- any chance one of the attachments could be designated as the right one?  Thanks!

> A simple Java client with Java APIs for add(), delete(), commit() and optimize().
> ---------------------------------------------------------------------------------
>
>                 Key: SOLR-20
>                 URL: http://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: update
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by "Thierry Collogne (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12483051 ] 

Thierry Collogne commented on SOLR-20:
--------------------------------------

I found that there was no way of adding highlight paramters to an SolrQuery, so I made some modifications to SolrQuery.java and ParamNames.java to allow highlighting

Changes to SolrQuery

First add a new variable

          private HighlightParams _highlight = new HighlightParams();

Than I defined a new innerclass (a bit like FacetParams)

       public static class HighlightParams {
		public List<String> field = new ArrayList<String>();
		public int snippets = 3;
		public int fragsize = 100;
		
		public String simple_pre = "<b>";
		public String simple_post = "</b>";
		
		public boolean isEnabled()
		{
			return field.size() > 0;
		}
	}

Than add the following methods

	public void addHighlightField( String f )
	{
		_highlight.field.add( f );
	}
	
	public void setHighlightSnippets( int snippets )
	{
		_highlight.snippets = snippets;
	}
	
	public void setHighlightFragSize( int fragsize )
	{
		_highlight.fragsize = fragsize;
	}
	
       // ATTENTION : only simple tags. No quotes like in <span class="tag">
	public void setHighlightSurroundingTags( String pre, String post )
	{
		_highlight.simple_pre  = pre;
		_highlight.simple_post = post;
	}

Add the following code to getQueryString method (for example right before return builder.toString();)

              if( _highlight.isEnabled() ) {
			builder.append( '&' ).append( ParamNames.HIGHLIGHT ).append( "=true" );
			builder.append( '&' ).append( ParamNames.HIGHLIGHT_FIELDS ).append( "=" );
			for( String f : _highlight.field ) {
				builder.append( f ).append( ',' );
			}
			builder.append( '&' ).append( ParamNames.HIGHLIGHT_SNIPPETS ).append( "=" ).append( _highlight.snippets );
			builder.append( '&' ).append( ParamNames.HIGHLIGHT_FRAGSIZE ).append( "=" ).append( _highlight.fragsize );
						
			builder.append( '&' ).append( ParamNames.HIGHLIGHT_SIMPLE_PRE ).append( "=" ).append( _highlight.simple_pre );
			builder.append( '&' ).append( ParamNames.HIGHLIGHT_SIMPLE_POST ).append( "=" ).append( _highlight.simple_post );
		}


Changes to ParamNames.java

Add/modify the following variables 

     /** wether to highlight */
     public static final String HIGHLIGHT = "hl";
     /** fields to highlight */
     public static final String HIGHLIGHT_FIELDS = "hl.fl";
     /** maximum highlight fragments to return */
     public static final String HIGHLIGHT_SNIPPETS = "hl.snippets";
     /** override default highlight fragsize */
     public static final String HIGHLIGHT_FRAGSIZE = "hl.fragsize";
     /** override default pre highlight */
     public static final String HIGHLIGHT_SIMPLE_PRE = "hl.simple.pre";
     /** override default post highlight */
     public static final String HIGHLIGHT_SIMPLE_POST = "hl.simple.post";


This can be used as follwed
    SolrClient client = new SolrClientImpl( new URL("http://localhost:8080/solr/") );
    // required
    query.addHighlightField("title");
    query.addHighlightField("content");
    // following is optional
    query.setHighlightFragSize(100);
    query.setHighlightSnippets(3);
    query.setHighlightSurroundingTags("<i>","</i>");


I think that is all. If I forgot something, post it here. One remark. The setHighlightSurroundingTags method can only take simple tags,
no tags containing quotes or such.
 
Greetz.

> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by "Erik Hatcher (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/SOLR-20?page=all ]

Erik Hatcher updated SOLR-20:
-----------------------------

    Attachment:     (was: DocumentManagerClient.java)

> A simple Java client with Java APIs for add(), delete(), commit() and optimize().
> ---------------------------------------------------------------------------------
>
>          Key: SOLR-20
>          URL: http://issues.apache.org/jira/browse/SOLR-20
>      Project: Solr
>         Type: New Feature

>   Components: update
>  Environment: all
>     Reporter: Darren Erik Vengroff
>     Priority: Minor
>  Attachments: DocumentManagerClient.java, SolrClientException.java
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by "carlos orrego (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12488702 ] 

carlos orrego commented on SOLR-20:
-----------------------------------

I am using the client library nad have no issues with adding docs to solr. But when i want to make a simple test query i keep getting this error:

org.apache.solr.client.exception.SolrClientException: unknown type: status

Solr returns and xml with a statis tag in the header wich the client does not know how to handle?

am i right? is this the case?

> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, solrclient_addqueryfacet.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by "Ryan McKinley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12492716 ] 

Ryan McKinley commented on SOLR-20:
-----------------------------------

aaah, It was compiling with java 6.

I just added stax-api-1.0.jar and cleaned up some imports, it should run on java 5 now.

> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, solrclient_addqueryfacet.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (SOLR-20) A simple Java client for updating and searching

Posted by "Ryan McKinley (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ryan McKinley reassigned SOLR-20:
---------------------------------

    Assignee: Ryan McKinley

> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Assignee: Ryan McKinley
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, solrclient_addqueryfacet.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by "J.J. Larrea (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12464648 ] 

J.J. Larrea commented on SOLR-20:
---------------------------------

Regarding Hoss' point #3, perhaps it's time to reorganize into something like

/solr/server/...
/solr/client/...
/solr/webapp/,,, (or /solr/server/webapp)
/solr/shared/...

"To build client XXX check out /solr/client or just /solr/client/java/XXX and /solr/shared"

Shared would include external constants and exceptions.

> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by "Michael Young (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12505304 ] 

Michael Young commented on SOLR-20:
-----------------------------------

We are planning to replace our custom Lucene implementation with Solr in the next release of Liferay. This Java client would be extremely useful to us and we would like to see it in the next stable release. When do you anticipate this, or at least an alpha version?

> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Assignee: Ryan McKinley
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, solrclient_addqueryfacet.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by "Hoss Man (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/SOLR-20?page=comments#action_12450843 ] 
            
Hoss Man commented on SOLR-20:
------------------------------

I don't know that there is a specific "right" one at the moment ... Darren's last comment suggests that he has a better version but it's not quite ready for submission.

FYI: if you click the "All" link at teh top left of the comment listing, you can see where in the flow of time each of the attachemnts was added -- from there it's pretty easy to tell that while solr-client-sources.jar is the most recent attachment, it's the one Darren said should be ignored...

at this moment solr-client-java-2.zip.zip seems to be the most recent "good" version.



> A simple Java client with Java APIs for add(), delete(), commit() and optimize().
> ---------------------------------------------------------------------------------
>
>                 Key: SOLR-20
>                 URL: http://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: update
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by "Ryan McKinley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502885 ] 

Ryan McKinley commented on SOLR-20:
-----------------------------------

I don't know if you are on solr-dev, Yonik noted that the QTime does not include the time to write the response, only the query time.  To get an accurate number for how long the whole query takes, check your app server logs
http://www.nabble.com/Re%3A-A-simple-Java-client-for-updating-and-searching-tf3890950.html

To get a quick response from solr, try rows=0 or a 404 path.  (Of course, the speed will depend on you network connection speed between client-server)

> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, solrclient_addqueryfacet.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by "Erik Hatcher (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12474032 ] 

Erik Hatcher commented on SOLR-20:
----------------------------------

My bad... it was SOLR-86 that interested me, and I've just committed it.    I can't take on these patches just yet.

> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by "Ryan McKinley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12462800 ] 

Ryan McKinley commented on SOLR-20:
-----------------------------------

I just posted a new version of a java client.  This moves things to proper org.apache... packages and adds the waitFlush, waitSearcher suggested by Fuad.  

If people are interested, i think this should sit next to /client/ruby in: /client/java/solrj/

there is a build.xml file that will generate a solr-client.jar file.

As a taste, this is how you perform a search:
<code>
    SolrClient client = new SolrClientImpl( new URL("http://localhost:8983/solr/") );

    SolrQuery query = new SolrQuery();
    query.setQuery( "video" );

    QueryResults results = client.query( query );

    for( ResultDoc doc : results.getDocs() ) {
        System.out.println( "["+doc.getId()+"] "+ doc.getField( "name" ) );
    }
</code>

Also, if there is interest, i can post an example webapp using this client library to search and explore a solr repository.





> A simple Java client with Java APIs for add(), delete(), commit() and optimize().
> ---------------------------------------------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: update
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by "Ryan McKinley (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ryan McKinley updated SOLR-20:
------------------------------

    Attachment: solr-client.zip

> A simple Java client with Java APIs for add(), delete(), commit() and optimize().
> ---------------------------------------------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: update
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by "Ryan McKinley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12490121 ] 

Ryan McKinley commented on SOLR-20:
-----------------------------------

For now, I'd still recommend using solr-client.zip

The code on solrstuff.org is in the middle of a big overhaul (hopefully stable by the end of this week) -- but it will rely on some changes to solr that are not likely to make it into solr-1.2.    

I'll post another message here when that settles down.

thanks
ryan



> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, solrclient_addqueryfacet.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by "Ryan McKinley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12505313 ] 

Ryan McKinley commented on SOLR-20:
-----------------------------------

solr 1.2 was released ~1 week ago so the next official stable release is at least a few months out.

The solrj client is quite stable (I won't say that too strongly until more people are using it) and will be included in solr nightly builds.  While I don't recommend using the solr server nightly builds, the client should be ok.

> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Assignee: Ryan McKinley
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, solrclient_addqueryfacet.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by "Erik Hatcher (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/SOLR-20?page=comments#action_12414382 ] 

Erik Hatcher commented on SOLR-20:
----------------------------------

This looks quite good and well documented!   Thanks for this contribution.  The only issue my current project would have with this is the Map which prevents multiple fields of the same name from being added.  I use a lot of multi-valued fields. 


> A simple Java client with Java APIs for add(), delete(), commit() and optimize().
> ---------------------------------------------------------------------------------
>
>          Key: SOLR-20
>          URL: http://issues.apache.org/jira/browse/SOLR-20
>      Project: Solr
>         Type: New Feature

>   Components: update
>  Environment: all
>     Reporter: Darren Erik Vengroff
>     Priority: Minor
>  Attachments: DocumentManagerClient.java, DocumentManagerClient.java, SolrClientException.java
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Re: [jira] Updated: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Jun 2, 2006, at 1:25 PM, Yonik Seeley wrote:
> On 6/2/06, Erik Hatcher <er...@ehatchersolutions.com> wrote:
>> I'll have to see what makes the most sense in terms of where this
>> will live in the directory structure and how we'll distribute it so
>> it can be used as a stand-alone API for a client.
>
> Yeah, the fewer dependencies the better.
> As for where it lives.... contrib/clients/java?
> alongside contrib/clients/[ruby,python,cpp,etc]?

I think this kind of library is more "core" than contrib.  This would  
be THE way Java clients would interact with Solr, I suspect.  But, of  
course it doesn't really matter much to me as it'll just be a JAR  
file I'll copy into my project once :) [I index with Java, query from  
Rails]

	Erik


>
>>  I noticed it
>> leverages Solr's XML class
>> which makes this a little more tricky for
>> someone to easily use in a standalone Java project, but not a big
>> deal for us to arrange things so all someone would need is a solr-
>> client.jar or something like that.
>
> Hmmm, yeah.  For the Query side of clients, we might want some other
> classes like NamedList too?
>
>
> -Yonik
> http://incubator.apache.org/solr Solr, the open-source Lucene  
> search server


Re: [jira] Updated: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by Yonik Seeley <ys...@gmail.com>.
On 6/2/06, Erik Hatcher <er...@ehatchersolutions.com> wrote:
> Darren (Erik!) - Thanks for this very handy utility!   I'm happy to
> commit it soon (let me use it first) unless someone beats me to it.
>
> I'll have to see what makes the most sense in terms of where this
> will live in the directory structure and how we'll distribute it so
> it can be used as a stand-alone API for a client.

Yeah, the fewer dependencies the better.
As for where it lives.... contrib/clients/java?
alongside contrib/clients/[ruby,python,cpp,etc]?

>  I noticed it
> leverages Solr's XML class
> which makes this a little more tricky for
> someone to easily use in a standalone Java project, but not a big
> deal for us to arrange things so all someone would need is a solr-
> client.jar or something like that.

Hmmm, yeah.  For the Query side of clients, we might want some other
classes like NamedList too?


-Yonik
http://incubator.apache.org/solr Solr, the open-source Lucene search server

Re: [jira] Updated: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by Chris Hostetter <ho...@fucit.org>.
: Sounds like we need a client with the code that is not shared within
: the Solr server, a Solr JAR that is shared across both the client and
: server, and then whatever other dependencies we need like the pull
: parser.

I think the org.apache.solr.util package may be the right boundray ... the
build process for "Solr core" could generate a solr-util.jar which
contains all of that code, and a solr.war (which also contains
that solr-util.jar for use within the Solr) external clients could then
use solr-util.jar as needed.

: With Yonik's further directions with this sort of thing, I think the
: best thing for now is to go with his recommendation of putting it in
: a contrib directory and letting this stuff evolve.  I do see it
: eventually fitting into some core kinda of library without the
: "contrib" label.

I personally don't have an opinion about a "contrib" label .. but as we
talk about making a place for client library code, I wonder wether we want
to distiguish client code intended for executing queries vs. client code
intended for executing updates? (vs. client code that encapsulates both)
... should we encourage a seperation?



-Hoss


Re: [jira] Updated: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Jun 2, 2006, at 1:35 PM, Darren Vengroff wrote:
> I wasn't thrilled about the XML dependency either, but it I figured  
> using
> the class already present in solr was better than adding new code (or
> ripping off code I've written elsewhere) that does more or less the  
> same
> thing.
>
> In situations like this I tend to go for a three jar approach, with  
> a common
> jar with stuff like XML in it, and then independent client and  
> server jars
> built on top of that.  It might be overkill in this case, given  
> there is
> only one small client class, but it is an option.

Sounds like we need a client with the code that is not shared within  
the Solr server, a Solr JAR that is shared across both the client and  
server, and then whatever other dependencies we need like the pull  
parser.

With Yonik's further directions with this sort of thing, I think the  
best thing for now is to go with his recommendation of putting it in  
a contrib directory and letting this stuff evolve.  I do see it  
eventually fitting into some core kinda of library without the  
"contrib" label.

> Maven2, by the way, is really good at managing that kind of  
> interdependent
> set of jars.  But I realize that I got ahead of myself when I proposed
> http://issues.apache.org/jira/browse/SOLR-19?page=all.  I've since  
> made
> improvements that make it much easier for me to use solr in my
> all-Maven2-all-the-time world, but it's somewhat unreasonable to  
> push it
> back on a community that is happy with ant.

I must admit a strong bias against Maven due to my deep ties with  
Ant, but the last time I tried it I was using the first version of  
Maven.  Maven2 has gotten a lot of good PR and is well worth  
considering for Solr and my own Java projects.  At the moment, I  
stick with raw Lucene, Solr, and Ruby on Rails so I don't deal with a  
whole lot of dependencies thankfully.

	Erik


RE: [jira] Updated: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by Darren Vengroff <ve...@gmail.com>.
Thanks Erik.

I wasn't thrilled about the XML dependency either, but it I figured using
the class already present in solr was better than adding new code (or
ripping off code I've written elsewhere) that does more or less the same
thing.

In situations like this I tend to go for a three jar approach, with a common
jar with stuff like XML in it, and then independent client and server jars
built on top of that.  It might be overkill in this case, given there is
only one small client class, but it is an option.

Maven2, by the way, is really good at managing that kind of interdependent
set of jars.  But I realize that I got ahead of myself when I proposed
http://issues.apache.org/jira/browse/SOLR-19?page=all.  I've since made
improvements that make it much easier for me to use solr in my
all-Maven2-all-the-time world, but it's somewhat unreasonable to push it
back on a community that is happy with ant.

-D

-----Original Message-----
From: Erik Hatcher [mailto:erik@ehatchersolutions.com] 
Sent: Friday, June 02, 2006 10:07 AM
To: solr-dev@lucene.apache.org
Subject: Re: [jira] Updated: (SOLR-20) A simple Java client with Java APIs
for add(), delete(), commit() and optimize().

Darren (Erik!) - Thanks for this very handy utility!   I'm happy to  
commit it soon (let me use it first) unless someone beats me to it.

I'll have to see what makes the most sense in terms of where this  
will live in the directory structure and how we'll distribute it so  
it can be used as a stand-alone API for a client.  I noticed it  
leverages Solr's XML class which makes this a little more tricky for  
someone to easily use in a standalone Java project, but not a big  
deal for us to arrange things so all someone would need is a solr- 
client.jar or something like that.

I've deleted the older versions of the file on JIRA.

	Erik


On Jun 2, 2006, at 12:58 PM, Darren Erik Vengroff (JIRA) wrote:
> Here is the latest, incorporating Erik's suggestion about  
> supporting multi-valued fields.
>
> BTW, is there any way to delete the older attached versions of this  
> file from JIRA?  There's no real need for them to be there any more.


Re: [jira] Updated: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
Darren (Erik!) - Thanks for this very handy utility!   I'm happy to  
commit it soon (let me use it first) unless someone beats me to it.

I'll have to see what makes the most sense in terms of where this  
will live in the directory structure and how we'll distribute it so  
it can be used as a stand-alone API for a client.  I noticed it  
leverages Solr's XML class which makes this a little more tricky for  
someone to easily use in a standalone Java project, but not a big  
deal for us to arrange things so all someone would need is a solr- 
client.jar or something like that.

I've deleted the older versions of the file on JIRA.

	Erik


On Jun 2, 2006, at 12:58 PM, Darren Erik Vengroff (JIRA) wrote:
> Here is the latest, incorporating Erik's suggestion about  
> supporting multi-valued fields.
>
> BTW, is there any way to delete the older attached versions of this  
> file from JIRA?  There's no real need for them to be there any more.

[jira] Updated: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by "Darren Erik Vengroff (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/SOLR-20?page=all ]

Darren Erik Vengroff updated SOLR-20:
-------------------------------------

    Attachment: DocumentManagerClient.java

Here is the latest, incorporating Erik's suggestion about supporting multi-valued fields.

BTW, is there any way to delete the older attached versions of this file from JIRA?  There's no real need for them to be there any more.

> A simple Java client with Java APIs for add(), delete(), commit() and optimize().
> ---------------------------------------------------------------------------------
>
>          Key: SOLR-20
>          URL: http://issues.apache.org/jira/browse/SOLR-20
>      Project: Solr
>         Type: New Feature

>   Components: update
>  Environment: all
>     Reporter: Darren Erik Vengroff
>     Priority: Minor
>  Attachments: DocumentManagerClient.java, DocumentManagerClient.java, DocumentManagerClient.java, SolrClientException.java
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by "Otis Gospodnetic (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/SOLR-20?page=comments#action_12457598 ] 
            
Otis Gospodnetic commented on SOLR-20:
--------------------------------------

SOLR-20 and SOLR-30 seem to be lingering in JIRA.
Is the plan to merge them, and get the code into Solr?

> A simple Java client with Java APIs for add(), delete(), commit() and optimize().
> ---------------------------------------------------------------------------------
>
>                 Key: SOLR-20
>                 URL: http://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: update
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by "Fuad Efendi (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/SOLR-20?page=comments#action_12447549 ] 
            
Fuad Efendi commented on SOLR-20:
---------------------------------

I'm dieing... which files should I download?

> A simple Java client with Java APIs for add(), delete(), commit() and optimize().
> ---------------------------------------------------------------------------------
>
>                 Key: SOLR-20
>                 URL: http://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: update
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by "Darren Erik Vengroff (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/SOLR-20?page=all ]

Darren Erik Vengroff updated SOLR-20:
-------------------------------------

    Attachment: DocumentManagerClient.java

Previous version didn't properly escape the query in the deleteByQuery() case.

> A simple Java client with Java APIs for add(), delete(), commit() and optimize().
> ---------------------------------------------------------------------------------
>
>          Key: SOLR-20
>          URL: http://issues.apache.org/jira/browse/SOLR-20
>      Project: Solr
>         Type: New Feature

>   Components: update
>  Environment: all
>     Reporter: Darren Erik Vengroff
>     Priority: Minor
>  Attachments: DocumentManagerClient.java, DocumentManagerClient.java, SolrClientException.java
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by "Darren Erik Vengroff (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/SOLR-20?page=all ]

Darren Erik Vengroff updated SOLR-20:
-------------------------------------

    Attachment: SolrClientException.java

> A simple Java client with Java APIs for add(), delete(), commit() and optimize().
> ---------------------------------------------------------------------------------
>
>          Key: SOLR-20
>          URL: http://issues.apache.org/jira/browse/SOLR-20
>      Project: Solr
>         Type: New Feature

>   Components: update
>  Environment: all
>     Reporter: Darren Erik Vengroff
>     Priority: Minor
>  Attachments: DocumentManagerClient.java, SolrClientException.java
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by "Erik Hatcher (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12474012 ] 

Erik Hatcher commented on SOLR-20:
----------------------------------

I want this on trunk also.  I'll be reviewing it and testing it out this afternoon and committing if all is fine.

> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by "Ryan McKinley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12466970 ] 

Ryan McKinley commented on SOLR-20:
-----------------------------------

I have dramatically reworked the client code to fit with the pluggable ContentStream model in SOLR-104.  This version makes it easy to customize/extend the request/response behavior.  Once it stabilizes and is better tested, I'll upload a zip, but for now, you can preview it:
 
  http://svn.lapnap.net/solr/solrj/


Major changes:

* it is based on commons-httpclient-3.0.1.jar
* I'm using wt=JSON rather then XML.  (It maps to a hash easier)
* I moved some of the common classes to o.a.s.util.  Hopefully the core classes will be refactored to make it easier to share some classes
* handles multiple ContentStreams using multi-part form upload
* Got rid of the SolrDocumentable/SolrDocumented distinction. -- now there is only SolrDocument()
* You can define and automatically build a solr document with annotations
* Includes a first draft for a HibernateEventListener.  When stuff is added/updated/deleted, it gets sent to solr.  (Note, this class should probable not be in the main client as the hibernate prerequisite libraries are substantial - I've included them because its what i need to have working soon)  When this is more stable, it will be something similar to a Compass Hibernate3GpsDevice (http://www.opensymphony.com/compass/versions/1.1RC1/html/gps-hibernate.html) 


The key interfaces are:

public interface SolrClient 
{
	public abstract SolrResponse process( final SolrRequest req );
}

public interface SolrRequest 
{
	public String getMethod();
	public String getHandlerPath();
	public RequestParams getParams();
	public Collection<ContentStream> getContentStreams();
	public SolrResponse parseResponseBody(InputStream in);
	public SolrResponse execute(SolrClient solr);
}

- - - - - - -
Here is some sample usage:

SolrClient client = new CommonsHttpSolrClient( 
	new URL("http://localhost:8983/solr/") );

// Set up a simple query
SolrQuery query = new SolrQuery();
query.setQuery( "solr" );
query.addFacetField( "cat" );
query.setFacetLimit( 15 );
query.setQuery( "video" );
query.setShowDebugInfo( true );

QueryResponse rsp = query.execute( client );
for( ResultDoc doc : rsp.getDocs() ) {
	System.out.println( doc.get( "name" ) );
	System.out.println( doc.getScore() );
	System.out.println( doc.getExplain() );
}

SimpleSolrDoc doc = new SimpleSolrDoc();
doc.setField( "id", "xxx" );
doc.setField( "price", 12.34f );
doc.setField( "cat", new String[] { "aaa", "bbb", "ccc" } );
new AddDocuments( doc ).execute( client );
new CommitIndex().execute( client );

- - - - - - - - - - -

This also includes a utility to make solr documents from annotations.  Given the class:

@SolrSearchable( boost=2.0 )
public class Example
{
  @SolrSearchable
  public String getName()
  {
    return "hello" 
  }
  
  @SolrSearchable( name="cat", boost=3 )
  public String getSomeOtherName()
  {
    return "there" 
  }
}

The DocumentBuilder can automatically make:

<doc boost="2.0">
 <field name="name">hello</field>
 <field name="cat" boost="3">there</field>
</doc>


- - - - - - - - - - -

There are a few parts of the API i think are awkward, I'd love any feedback / review you may have.

thanks
ryan


> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by "Ryan McKinley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12502489 ] 

Ryan McKinley commented on SOLR-20:
-----------------------------------

Hi Walter-

I just updated http://solrstuff.org/svn/solrj/  to use:

  URLEncoder.encode( val, "UTF-8" )

rather then:

  StrUtils.partialURLEncodeVal( val )

Give it a try and let me know if you have problems...   (i have done date range queries successfully with resin/jetty, but netbeans must be different!)

> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, solrclient_addqueryfacet.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by "Ben Incani (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12499730 ] 

Ben Incani commented on SOLR-20:
--------------------------------

The SolrClientImpl does not implement the following optional attributes for "add" as documented in http://wiki.apache.org/solr/UpdateXmlMessages

  allowDups = "true" | "false" — default is "false" 
  overwritePending = "true" | "false" — default is negation of allowDups 
  overwriteCommitted = "true"|"false" — default is negation of allowDups 

Attached is patch for SolrClientImpl.java which implements allowDups.

*** SolrClientImpl.java.patch ***
48a49,55
> 	
> 	/**
> 	 * Optional attributes for "add"
> 	 */
> 	protected boolean allowDups;
> 	protected boolean overwritePending;    // TODO: not implemented
> 	protected boolean overwriteCommitted;  // TODO: not implemented
86a94,97
> 	public SolrClientImpl(URL baseURL) throws Exception {
> 	   this(baseURL, false);
>     }
> 
91a103
> 	 * @param allowDups allow duplicates to be added to the index
95c107
< 	public SolrClientImpl(URL baseURL) throws Exception 
---
> 	public SolrClientImpl(URL baseURL, boolean allowDups) throws Exception 
103c115
< 		
---
>         this.allowDups = allowDups;
243c255,260
< 				writer.write("<add>");
---
> 			    StringBuffer strAdd = new StringBuffer("<add ");
> 			    if (allowDups == true) {
> 			         strAdd.append("allowDups=\"true\"");
> 			    }
> 			    strAdd.append(">");
> 				writer.write(strAdd.toString());
*** SolrClientImpl.java.patch ***


> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, solrclient_addqueryfacet.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by "Darren Erik Vengroff (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/SOLR-20?page=all ]

Darren Erik Vengroff updated SOLR-20:
-------------------------------------

    Attachment: solr-client-sources.jar

Here is the latest version of the client code, in the form of solr-client-source.jar.  The big difference here is that there are now two clients, DocumentManagerClient for adding, inserting, and updating, and SearchClient for searching.  They share the same underlying communication mechanism, which consists of a low-level mechanism for doing queries and parsing responses by reading from an InputStream (see ResponseParser) and a slightly higher level mechanism that handles some of the XML for you (see XmlResponseParser).

I've been building this as a seperate project with a Maven2 dependency on Solr, but if the source is dropped into the Solr source tree at the appropriate place I suspect it will just compile and work.  There are no other outside dependencies.

I have some unit tests as well, but for the moment they are too tied in to my environment to be useful to the broader community.  I will correct this and submit them.

> A simple Java client with Java APIs for add(), delete(), commit() and optimize().
> ---------------------------------------------------------------------------------
>
>                 Key: SOLR-20
>                 URL: http://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: update
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by "Darren Erik Vengroff (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/SOLR-20?page=comments#action_12428555 ] 
            
Darren Erik Vengroff commented on SOLR-20:
------------------------------------------

Please ignore that last attachment.  It contains an earlier version of the code than I intended, and has a couple of serious bugs.  I'm sure that what I'm running now is a lot better, but I'm going to iterate a little more and build some more complete tests before I submit it again.  Unless anyone out there is dieing to be on the bleeding edge of this.

> A simple Java client with Java APIs for add(), delete(), commit() and optimize().
> ---------------------------------------------------------------------------------
>
>                 Key: SOLR-20
>                 URL: http://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: update
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by "Darren Erik Vengroff (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/SOLR-20?page=all ]

Darren Erik Vengroff updated SOLR-20:
-------------------------------------

    Attachment: DocumentManagerClient.java

New client code that uses the new exception.

> A simple Java client with Java APIs for add(), delete(), commit() and optimize().
> ---------------------------------------------------------------------------------
>
>          Key: SOLR-20
>          URL: http://issues.apache.org/jira/browse/SOLR-20
>      Project: Solr
>         Type: New Feature

>   Components: update
>  Environment: all
>     Reporter: Darren Erik Vengroff
>     Priority: Minor
>  Attachments: DocumentManagerClient.java, DocumentManagerClient.java, SolrClientException.java, SolrServerException.java
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12467116 ] 

Yonik Seeley commented on SOLR-20:
----------------------------------

> * it is based on commons-httpclient-3.0.1.jar
Cool, +1

> * I'm using wt=JSON rather then XML. (It maps to a hash easier)
Heh... I quickly checked out the code, but didn't see where you were parsing the code, or where the JSONObject class referenced is.

Anyway, if you want the *best* JSON parser on the planet, check out
http://www.nabble.com/Apache-Lab-proposal%3A-noggit-tf2701405.html#a7532843
http://svn.apache.org/repos/asf/labs/noggit/
:-)
I haven't had a chance to do the writing side, or the "create full object graph" part, but the parser is screaming fast.

> * handles multiple ContentStreams using multi-part form upload
Will a client need to do that?  I had thought a browser would be the only one using multi-part

> * You can define and automatically build a solr document with annotations
Sounds cool

> * Includes a first draft for a HibernateEventListener.
Sounds *very* cool... it should go in a separate contrib eventually.



> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by "Darren Erik Vengroff (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/SOLR-20?page=all ]

Darren Erik Vengroff updated SOLR-20:
-------------------------------------

    Attachment: DocumentManagerClient.java

> A simple Java client with Java APIs for add(), delete(), commit() and optimize().
> ---------------------------------------------------------------------------------
>
>          Key: SOLR-20
>          URL: http://issues.apache.org/jira/browse/SOLR-20
>      Project: Solr
>         Type: New Feature

>   Components: update
>  Environment: all
>     Reporter: Darren Erik Vengroff
>     Priority: Minor
>  Attachments: DocumentManagerClient.java
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by "Ryan McKinley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12493006 ] 

Ryan McKinley commented on SOLR-20:
-----------------------------------

great!  Any feedback/help would be wonderful.

I hope it is not *too* long before this can enter solr trunk, but it will first need two solr1.3 additions SOLR-193 and SOLR-135, until then I can apply any patches necessary.

Re RuntimeException vs SolrServerException, I'm not sure the best choice.  Earlier versions had a client exception and server exception, but in practice those got lumped together (in my case) anyway.  I ended up just using SolrException because it is there.

> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, solrclient_addqueryfacet.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by "Bertrand Delacretaz (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bertrand Delacretaz updated SOLR-20:
------------------------------------

    Component/s:     (was: update)
                 clients - java

> A simple Java client with Java APIs for add(), delete(), commit() and optimize().
> ---------------------------------------------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by "Will Johnson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12492902 ] 

Will Johnson commented on SOLR-20:
----------------------------------

the new api's work great, thanks!  what's the plan for this going forward?  id' like to start doing some work on this as it's rather critical to my current project and an are i've dealt with a lot in the past.  assuming it's not getting dumped into org.apache.* land any time soon are you accepting patches to this code?  if so i have some modifications to the api's that i think will make them easier to use (such as a method to set FacetParams on SolrQuery) and i'll even flush out the SolrServerTest for fun.  

also, i noticed that all the methods on SolrServer throw undeclared SolrExceptions which extends RuntimeException when things so south.  should those throw some other sort of non-ignorable exception like a new SolrServerException?  while it made coding/compiling easier to leave out all the usually required try's and catches it made running/debugging much less enjoyable.

- will

> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, solrclient_addqueryfacet.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by "Darren Erik Vengroff (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/SOLR-20?page=all ]

Darren Erik Vengroff updated SOLR-20:
-------------------------------------

    Attachment: SolrServerException.java

New exception type for reporting server-side exceptions.

> A simple Java client with Java APIs for add(), delete(), commit() and optimize().
> ---------------------------------------------------------------------------------
>
>          Key: SOLR-20
>          URL: http://issues.apache.org/jira/browse/SOLR-20
>      Project: Solr
>         Type: New Feature

>   Components: update
>  Environment: all
>     Reporter: Darren Erik Vengroff
>     Priority: Minor
>  Attachments: DocumentManagerClient.java, DocumentManagerClient.java, SolrClientException.java, SolrServerException.java
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (SOLR-20) A simple Java client for updating and searching

Posted by "Ryan McKinley (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ryan McKinley resolved SOLR-20.
-------------------------------

    Resolution: Fixed

Added to trunk...  any new problems should get their own issue.

> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Assignee: Ryan McKinley
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, solrclient_addqueryfacet.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by "Darren Erik Vengroff (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/SOLR-20?page=all ]

Darren Erik Vengroff updated SOLR-20:
-------------------------------------

    Attachment: solr-client-java.zip

Here's the latest.  There is an abstract base class that handles client connection and request/response and two subclasses.  One is as before, with java APIs, and the other is for cases where you have an XML document you want to transform and send to the server.

> A simple Java client with Java APIs for add(), delete(), commit() and optimize().
> ---------------------------------------------------------------------------------
>
>          Key: SOLR-20
>          URL: http://issues.apache.org/jira/browse/SOLR-20
>      Project: Solr
>         Type: New Feature

>   Components: update
>  Environment: all
>     Reporter: Darren Erik Vengroff
>     Priority: Minor
>  Attachments: DocumentManagerClient.java, DocumentManagerClient.java, SolrClientException.java, SolrServerException.java, solr-client-java.zip
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by "rubdabadub (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12473993 ] 

rubdabadub commented on SOLR-20:
--------------------------------

Hi:

I was really hoping that this patch will make it to trunk soon. I been using it without any problem. I was wondering if there are any specifics that are left for SOLR-20 to make it to trunk? I would be more then happy to help out anyway I can. I need SOLR-20 for Nutch-Solr integration so it would be nice if it was included.

Thankful for your kind attention to SOLR-20.

> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by "Darren Erik Vengroff (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/SOLR-20?page=all ]

Darren Erik Vengroff updated SOLR-20:
-------------------------------------

    Attachment: solr-client-java-2.zip.zip

Good catch Philip.  For the benefit of future downloaders, here's a complete zip file with everything including this fix.

> A simple Java client with Java APIs for add(), delete(), commit() and optimize().
> ---------------------------------------------------------------------------------
>
>                 Key: SOLR-20
>                 URL: http://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: update
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SOLR-20) A simple Java client with Java APIs for add(), delete(), commit() and optimize().

Posted by "Philip Jacob (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/SOLR-20?page=comments#action_12421774 ] 
            
Philip Jacob commented on SOLR-20:
----------------------------------

delete() in the DocumentManagerClient ought to be doing this:

<delete><id>1234</id></delete>

It's currently doing this:

<delete><query>1234</query></delete>

> A simple Java client with Java APIs for add(), delete(), commit() and optimize().
> ---------------------------------------------------------------------------------
>
>                 Key: SOLR-20
>                 URL: http://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: update
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SOLR-20) A simple Java client for updating and searching

Posted by "Will Johnson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12492700 ] 

Will Johnson commented on SOLR-20:
----------------------------------

the trunk version at http://solrstuff.org/svn/solrj/  seems to be missing a dependency and a copy of SolrParams.  ant returns....

compile:
    [javac] Compiling 40 source files to C:\data\workspace\solrj\bin
    [javac] C:\data\workspace\solrj\src\org\apache\solr\client\solrj\impl\XMLResponseParser.java:10: package javax.xml.stream does not exist
    [javac] import javax.xml.stream.XMLInputFactory;

....

[javac] C:\data\workspace\solrj\src\org\apache\solr\client\solrj\query\SolrQuery.java:10: cannot find symbol
    [javac] symbol  : class SolrParams
    [javac] location: package org.apache.solr.util
    [javac] import org.apache.solr.util.SolrParams;

> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, solrclient_addqueryfacet.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SOLR-20) A simple Java client for updating and searching

Posted by "Chen Lei (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-20?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chen Lei updated SOLR-20:
-------------------------

    Attachment: solrclient_addqueryfacet.zip

org.apache.solr.client.impl.ResultsParser.java
org.apache.solr.client.QueryFacet.java (a copy of FieldFacet)
org.apache.solr.client.QueryResults.java
org.apache.solr.client.SolrQuery.java

I changed these four files, add some functions for facet query.
Add a facet query is similar as field query.
Existing methods, new methods:
  SolrQuery.addFacetField()        SolrQuery.addFacetQuery
  QueryResults.getFacets()         QueryResults.getQueryFacets()
  QueryResults.getLimitingFacets   QueryResults.getLimitingFacetsForQueryFacet()


Some code here..
  SolrQuery query = new SolrQuery();
  // ...
  query.addFacetQuery("cat:music card");
  query.addFacetQuery("video");
  
  SolrClient client = ..
  // ...
  QueryResults results = client.query( query );

  for (QueryFacet qf : results.getQueryFacets()) {
      System.out.println("query facet: "+qf.getName() +" "+qf.getValueCount());
          for (org.apache.solr.client.QueryFacet.Count c :  qf.getValues() ) {
          System.out.println("  "+c.getName()+": "+c.getCount());
      }
  }




> A simple Java client for updating and searching
> -----------------------------------------------
>
>                 Key: SOLR-20
>                 URL: https://issues.apache.org/jira/browse/SOLR-20
>             Project: Solr
>          Issue Type: New Feature
>          Components: clients - java
>         Environment: all
>            Reporter: Darren Erik Vengroff
>            Priority: Minor
>         Attachments: DocumentManagerClient.java, DocumentManagerClient.java, solr-client-java-2.zip.zip, solr-client-java.zip, solr-client-sources.jar, solr-client.zip, solr-client.zip, solr-client.zip, solrclient_addqueryfacet.zip, SolrClientException.java, SolrServerException.java
>
>
> I wrote a simple little client class that can connect to a Solr server and issue add, delete, commit and optimize commands using Java methods.  I'm posting here for review and comments as suggested by Yonik.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.