Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change 
notification.

The following page has been changed by MatthiasEpheser:
http://wiki.apache.org/solr/SolrJS

------------------------------------------------------------------------------
  
  == Architectural Overview ==
  
- The library is written using the javascript toolkit jQuery 
[http://jquery.com/] (Version 1.2.5). SolrJS is included in one additional 
javascript file "solrjs.js" The idea is to create several (reusable and 
extensible) "widgets" that represent solr queries. A widget is a javascript 
object that is responsible for creating the according solr query as well as 
render the result from the server to html. One manager object acts as a 
container that holds these widgets, performs the actual query using jQueries 
getJSON [http://docs.jquery.com/Ajax/jQuery.getJSON#urldatacallback] method. 
This method creates a dynamic script tag, making cross-domain solr requests 
possible. 
+ The library is written using the javascript toolkit jQuery 
[http://jquery.com/] (Version 1.2.5). After distribution, SolrJS is included in 
one additional javascript file "solrjs.js". The idea is to create several 
(reusable and extensible) "widgets" that represent solr queries. A widget is a 
javascript object that is responsible for creating the according solr query as 
well as render the result from the server to html. One manager object acts as a 
container that holds these widgets, performs the actual query using jQueries 
getJSON [http://docs.jquery.com/Ajax/jQuery.getJSON#urldatacallback] method. 
This method creates a dynamic script tag, making cross-domain solr requests 
possible. 
+ 
+ There are two base types of widgets:
+ 
+  * client side widgets: They get a Javascript JSON response from the server 
and render the needed html for the widget using jQuery javascript code.
+  * server side widgets: They move the rendering logic to the server, using 
the VelocityResponseWriter (see 
[https://issues.apache.org/jira/browse/SOLR-620]. The widget then only "copies" 
the html reponse from the server into the target div.
+ 
+ To make the framework more clearly arranged, the every js "class" lies inside 
a single JS file, they are organized in "packages" like in a Java Application:
+ 
+  * core: The manager and other base classes.
+  * server: server side widgets
+  * client: client side widgets
+ 
+ For distribution, there is a small ant build script provided taht creates one 
single js file out of these snippets. Just run "ant dist". In the future, there 
might be some js compression steps included.
  
  == Examples and source code ==
  
- The best way to get an idea how a widget may look like and how it can be 
integrated into html is to explore the documented source code and the 
test*.html example pages at [http://solrstuff.org/svn/solrjs/trunk].
+ The best way to get an idea how a widget may look like and how it can be 
integrated into html is to explore the documented source code and the 
test*.html example pages at [http://solrstuff.org/svn/solrjs/trunk]. Use the 
testsolr that includes all necessary patches, start it with "java -jar start" 
and point your browser to the example html files inside the "test" directory. 
  
  Despite this, I'll try to describe some important implementation further on 
this page.
  
@@ -47, +60 @@

   * manager.doRequest(startindex) is called
   * a q=... parameter is created by the manager according to the current 
selection
   * the call is delegated to all the widgets. They may extend the query url in 
the getSolrUrl method (eg. adding facet=true..) and then make the http call to 
solr.
-  * json data is returned to the widget and widget.handleResponse(data) is 
called.
+  * json or html data is returned to the widget and 
widget.handleResponse(data) is called.
  
  
  === Widget Inheritance ===

Reply via email to