Skip to content
jarielpa edited this page Mar 29, 2012 · 3 revisions

## Table of Contents

In this tutorial, we’ll go step-by-step through building the <abbr title=“asynchronous JavaScript and XML ”>AJAX</abbr> Solr [demo site](evolvingweb.github.com/ajax-solr/examples/reuters/index.html).

Before we start, we write the HTML to which the JavaScript widgets will attach themselves. In practice, this HTML will often be the non-JavaScript version of your search interface, which you now want to improve with unobtrusive JS.

[__[What we have so far]__](evolvingweb.github.com/ajax-solr/examples/reuters/index.0.html)

Now, let's talk to Solr!

### Running the demo locally

If you want to run a local instance of the Solr server used in this demo, [this tarball](github.com/downloads/evolvingweb/ajax-solr/reuters_data.tar.gz) contains the [Reuters data](kdd.ics.uci.edu/databases/reuters21578/reuters21578.html). Replace the ‘data` directory of your Solr instance with this tarball’s ‘data` directory. Then, add the following to your `schema.xml` in the `conf` directory of your Solr instance:

<field name="places" type="string" indexed="true" stored="true" multiValued="true" omitNorms="true" termVectors="true" />
<field name="countryCodes" type="string" indexed="true" stored="true" multiValued="true" omitNorms="true" termVectors="true" />
<field name="topics" type="string" indexed="true" stored="true" multiValued="true" omitNorms="true" termVectors="true" />
<field name="organisations" type="string" indexed="true" stored="true" multiValued="true" omitNorms="true" termVectors="true" />
<field name="exchanges" type="string" indexed="true" stored="true" multiValued="true" omitNorms="true" termVectors="true" />
<field name="companies" type="string" indexed="true" stored="true" multiValued="true" omitNorms="true" termVectors="true" />
<field name="allText" type="text_general" indexed="true" stored="true" multiValued="true" omitNorms="true" termVectors="true" />
<copyField source="title" dest="allText"/>
<copyField source="text" dest="allText"/>
<copyField source="places" dest="allText"/>
<copyField source="topics" dest="allText"/>
<copyField source="companies" dest="allText"/>
<copyField source="exchanges" dest="allText"/>

You may need to replace the ‘date` field definition with the following (changes `type` to `pdate`):

<field name="date" type="pdate" indexed="true" stored="true" multiValued="true" omitNorms="true" termVectors="true" />

And this (Sorl 3.5.0): ‘ <field name=“dateline” type=“string” indexed=“true” stored=“true” multiValued=“true” omitNorms=“true” termVectors=“true” /> `

_(Attribution: The demo site is based on the SolrJS demo site.)_

Clone this wiki locally