Skip to content

ajsqr/solrorm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

solrorm : A sort-of solr ORM for python

  • solrpy - deprecated
  • solrorm - currently in dev

Usage

Cores

The first step to interact with solr using solrorm is to define a core. Core objects can be initialized using the solrorm.cores.Core class.

Example
from solrorm.cores import Core
my_core = Core(host='xxx.xx.x.xxx', port = 8983, core_name = 'core_name_here', fields = ['title', 'authors'])

Queries

queries helps us to filter records from solr. Using solrorm, we can pass arguments and various 'magic' arguments to filter records. A few example are shown below. Example
results = my_core.objects.query(organizations="twitter inc", __tag ="it", sentiment="Positive").get(start=10, rows=1)

Double underscore (__) after an argument name means that is is negated. In this case, it means source_tag != "it_news"
' __in' after an argument specifies range query. It can be used to filter for example, records in a certain range of dates.

Response

After a query is executed we will get a response object. The response object will have the following fields.
1) docs : the docs returned from solr
2) total : total counts matching in solr
3) count : the size of a page (useful for pagination)

The response object also offers a handy transform method. Please refer the attached example file to find the usage.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages