Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>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.</p> <p>EDIT (copied from the answer on the web2py mailing list):</p> <p>Normally in web2py you define a model</p> <pre><code>db.define_table('message',Field('body')) </code></pre> <p>and then web2py generates and processes forms for you:</p> <pre><code>form=SQLFORM(db.message) if form.accepts(request.vars): do_something </code></pre> <p>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: <a href="http://code.google.com/p/solrpy/" rel="nofollow noreferrer">http://code.google.com/p/solrpy/</a> and you can do</p> <pre><code>#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 </code></pre> <p>So the difference is SQLFORM.factory instead of SQLFORM and the extra line after accepts. That is it. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload