There are many independent Python bindings for SOLR (see here). Which ones are available for Jython (i.e. are implemented in pure Python as opposed to C-modules) and which one would you recommend?
See also
Solr: best documented, easy to use, stable Python APIs (didn’t get much useful responses so far)
I use SOLR from Python (CPython) and from Scala (JVM). In both cases I use the same API, namely an HTTP client. In other words URLs like http://www.example.com:8080/solr/datacore/select?q=DocID:*&fl=DocID,Descr
The URLs are built up through composition. For the query there is a dict containing fieldnames as keys, and matches as values. For instance the above query would look like {“DocID”:”*”}. This dict is joined with AND between each key. Actually, the values are lists which get joined using OR so a more complex query like
Would turn into a SOLR query like
Composition is done with a simple object where each method returns self for instance:
This then gets used in a method chain like:
Anything more than this is overkill and hides too much of what is happening in an obscure library that you cannot understand without studying its code. It is hard enough just understanding all the power of SOLR’s query language and how to use it effectively. Don’t put a library between you and SOLR when it only takes about a page of code to write some helper methods for constructing a query URL.
By the way, if you do use a library and it requires seeing the SOLR schema in order to function, do not include the SOLR schema in a file with your app. Just get it directly from the server in your app and cache it locally.