GithubHelp home page GithubHelp logo

yoopea / django-solr Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sophilabs/django-solr

0.0 2.0 0.0 125 KB

Solr Search Engine ORM for Django

Home Page: http://sophilabs.github.com/django-solr/

License: BSD 3-Clause "New" or "Revised" License

django-solr's Introduction

Solr Search Engine ORM for Django

Usage

Define

from djangosolr import documents

class Movie(documents.Document):
   id = documents.IntegerField(primary_key=True)
   title = documents.CharField()
   director = documents.CharField()
   text = TextField()

Define from an existing django model

from djangosolr import documents
from myapp import models

class Movie(documents.Document):
    class Meta:
        model = models.Movie

Save some movies

Movie(id="1", title='Jurassic Park I', director='Steven Spielberg').save()
Movie(id="2", title='Jurassic Park III', director='Steven Spielberg').save()

Save many movies at once

from djangosolr import solr

solr.save([m1, m2])

Get and update

m = Movie.documents.get(2)
m.director = 'Joe Johnston'
m.save()

Get all movies

ms = Movie.documents.all()

Get the first 10 Steven Spielberg's movies

ms = Movie.documents.q(director__exact='Steven Spielberg').sort('title')[:10]

Get Spielberg's or Johnston's movies

ms = Movie.documents.q(Q(text='spielberg') | Q(text='johnston'))

Delete a movie

m = Movie.documents.get(1)
m.delete()

Delete all movies

Movie.documents.clear()

Getting It

You can get Django Solr by using pip or easy_install

$ pip install django-solr

or $ easy_install django-solr

Comming Soon

  • Facet
  • More Like This

django-solr's People

Contributors

pricco avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.