Package: wukong
WukongWukong offers an ORM query engine for Solr and Solr Cloud.Installationpip install wukongUsageCreate Solr CollectionBefore you use wukong, make sure you already created your collection on SolrCloud. For example,curl http://localhost:8080/solr/admin/collections?action=CREATE&name=users&numShards=1&replicationFactor=2A sample schema can be like:<fields>
	<uniqueKey>id</uniqueKey>
  	<field name="id" type="int" indexed="true" stored="true" required="true" />
	<field name="name" type="string" indexed="true" stored="true" required="true"/>
	<field name="city" type="string" indexed="true" stored="true"/>
	<field name="age" type="int" indexed="true" stored="true"/>
	...
</fields>Create a model class for Solr collectionCreate a class for your Solr collection by extending the classSolrDoc. For example,from wukong.models import SolrDoc

class User(SolrDoc):
    collection_name = "users"
    solr_hosts = "localhost:8080,localhost:8081"

    def validate_schema_fields(self, fields):
    	pass

    def get_data_for_solr(self):
    	passYou can overide existing methods to fit your business logic, likevalidate_schema_fields,get_data_for_solr.Use Solr QueryMangerCreat a documentUser.documents.create(User_id=12345, name="Test Name", city="Test City")Update a documentUser.documents.update(User_id=12345, name="Test Name")To index a batch of documentsto your Solr collection, use the container class: SolrDocs. Instead of accessing SOLR
multiple times, it only issues one request to SOLR, which is more efficient.docs = [
		User(User_id=12345, name="Test Name1", city="Test Cit1"),
		User(User_id=123456, name="Test Name2", city="Test City2")
		...
	]
	docs = SolrDocs(docs)
	docs.index()Fetch a documentUser.documents.get(User_id__eq=12345)Fetch multiple documentsUser.documents.filter(name__eq="Test Name", city__wc="Test*").all()Use compounded logicUser.documents.filter(OR(city__wc="Test*", name__eq="Test Name"))Sort by a fieldUser.documents.sort_by("-name").all()Force only return a certain fieldsUser.documents.only("is", "name").all()Force only return the top 10 documentsUser.documents.limit(10).all()Chain the query methodsUser.documents.filter(city__wc="Test*").sort_by("-name").limit(10).all()Delete a documentUser.documents.get(User_id__eq=12345).delete()Batch delete documentsUser.documents.filter(name__eq="Test Name").all().delete()DocumentationsDetailed docs can be found athttp://wukong.readthedocs.io/en/latest/#Release Notes1.1.0Catch RequestsException Instead Of Connection Errors To Allow For Retries during timeouts (#30)1.0.1search():actuallysend the query_dict in the request body as was intended in 1.0.0 (missed a cherry-pick)1.0.0Removed support for Python versions < 3.5 and pypyUse POST instead of GET for /select API calls in order to avoid
exceeding the max uri length for long queries (#26)0.5.1Only add /solr/ to the end of a solr url if it isn't already there0.5.0Simplify the method of making requests, and add logging so it's more visible what's happening (#18)Don't log debugging messages as error messages (#19)Broaden Travis support (#17)Make sure a scheme is always on the solr request (#20)0.4.0Add ability to update extraparams like omitHeader for solr requests0.3.1Collection alias support0.2.2Fix zookeeper cluster state unicode issue0.2.0Zookeeper states for Solr 6handle situations with unknown Solr hostnamessupport stats in the query for Solr 60.1.1Add support for Python 3.x0.0.3initial version for wukong