views:

175

answers:

5

Want to build a web app using SOLR as the only backend. Most of the data will be stored in SOLR via offline jobs although there is some need for CRUD.

Looking at popular web frameworks today like Rails, Django, web2py etc. despite NoSQL the sweet spot for productivity still seems to be around active record implementations sitting on top of a RDBMS.

What's the best framework, in terms of productivity, for building web apps with SOLR as the backend?

A: 

I would consider using Grails (Java/Groovy based) as it has fantastic XML/JSON (SOLR response formats) parsing support in addition to many other features.

Eric W
+2  A: 

The web2py Database Abstraction layer does not support SOLR at this time which means you cannot use the DAL syntax for accessing SOLR and you cannot use automatically generated forms from a SOLR DB schema. Yet you can generate forms using SQLFORM.factory as-if you had a normal relational database and perform the insert/update/select/update into SOLR manually. web2py includes libraries for parsing/writing both JSON and XMl so it will be easy to implement SOLR APIs in few lines of code. If you bring this up on the web2py mailing list we can help with some examples.

EDIT (copied from the answer on the web2py mailing list):

Normally in web2py you define a model

db.define_table('message',Field('body'))

and then web2py generates and processes forms for you:

form=SQLFORM(db.message)
if form.accepts(request.vars):
      do_something

In your case you would not use define_table because web2py DAL does not support SOLR and you cannot generate forms from the schema but you can install this: http://code.google.com/p/solrpy/ and you can do

#in model
import solr
s = solr.SolrConnection('http://example.org:8083/solr')

#in controller
form=SQLFORM.factory(Field('body'))
if form.accepts(request.vars):
      s.add(mody=request.vars.body)
      s.commit()
      do_something

So the difference is SQLFORM.factory instead of SQLFORM and the extra line after accepts. That is it.

mdipierro
Great - will do that/me is amazed how quickly mdipierro responds to a web2py related question ;)
HarryF
A: 

I would use Sunspot 1.2 and Rails 3.

Sunspot is commonly used as an ActiveRecord extension, but is also designed to be ORM-agnostic. Rails 3 has decoupled ActiveRecord from the framework, making it easy to go entirely ORM-free.

http://outoftime.github.com/sunspot/

Nick Zadrozny
+2  A: 

All three of the above answers are great recommendations for development frameworks. I would flip around your question and ask "Which is best web app framework for me", not "which is best with Solr" and make a decision based on your skills, the community that you have around you, and other soft factors. Especially if you are completely agnostic on which way to go.

If you have friends who love Grails and can help you get started, then Grails might be the way to go. Have a Python group that meets regularly? Then Django has a lot to offer. I personally love Rails, and so I would recommend rails. But that is only a recommendation of "What I like" versus "what is best".

The wonderful thing about Solr is how agnostic it is to the front end. It plays nice in so many environments!

Eric Pugh
A: 

By the way , SphinxSearch is a lot faster than solr/lucence and many unique features. Also search accuracy is a lot better comparing from my experience and independent benchmarks.

it have native, very easy python api and it integrates well with web2py.

but it needs a RDBMS tho . I am using it , web2py + sphinxsearch , building an office files search engine.

You can give a try too.

www.sphinxsearch.com

V3ss0n