Skip to content
jpmckinney edited this page Mar 29, 2012 · 37 revisions

Table of Contents

In this tutorial, we'll go step-by-step through building the AJAX Solr demo site.

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]

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 contains the Reuters data. 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):

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

Clone this wiki locally