2. Today’s Talk
About Solr
Background and overview.
Installing and bringing up Solr.
Configuring Solr.
Playing with queries.
A live demo of Solr.
2
3. What is Solr?
A web application for text search.
A full text search server based on Lucene.
A wrapper around apache Lucene.
XML/HTML, JSON Interfaces.
3
4. What is Lucene?
● High performance, scalable, full-text search library.
● Focuses on Indexing + Searching Documents.
○ Document is just a list of name and value pairs.
● 100% Java, no dependencies, no configuration files.
4
5. Why Solr?
● Robust.
● Reliable.
● Fast.
● Supported. (window, linux, mac)
● Most important: Open Source.
5
6. Solr’s Data model
● Solr maintains collection of documents
● A document is collection of fields and values.
● A field can occur multiple time in a document.
● These documents can be deleted and new versions
of documents can be added, hence it is immutable.
6
9. 9
Adding Documents
HTTP POST to http://localhost:8983/solr/update
<add>
<doc>
<field name=”id”>1</field>
<field name=”name”>kiran</field>
<field name=”gender”>male</field>
</doc>
</add>
10. Deleting by id is most efficient.
<delete>
<id>420</id>
</delete>
Deleting by query.
<delete>
<query>gender:male</query>
</delete>
Deleting Documents
10
11. http://localhost:8983/solr/select/?q=id%3A1
<doc>
<str name="description">Now you are talking</str>
<str name="id">2</str>
<str name="name">Vic 20</str>
<float name="price">14.99</float>
</doc>
<doc>
<str name="description">One for the rubber </str>
<str name="id">3</str>
<str name="name">wifi</str>
<float name="price">49.99</float>
</doc>
Searching
11