Tuesday, February 27, 2007

things learned from SOLR api

things learned from SOLR api

I am fortunte to attend Erik Hatcher's one day Lucene/Solr tutorial, what's really attracting me is elegance of SOLR's REST API, which is at the same time concise and consistent. To start with:

-- add/query/delete/commit are all simple REST API.

as an example, delete a record is a simple HTTP POST "<delete><id>SP2514N</id></delete>", do I need to say more?

-- allows different format (but equavalent infoset)
"select?q=ipod&wt=xml" -- returns an xml format
"select?q=ipod&wt=python"
"select?q=ipod&wt=ruby"
"select?q=ipod&&wt=json"

They all return same infoset.

-- the way of controlling returned fields by query

q=video&fl=name,id (return only name and id fields)
q=video&fl=name,id,score (return relevancy score as well)
q=video&fl=*,score (return all stored fields, as well as relevancy score)

So user has control of which fields to return.

-- no xml namespace at all

This is subject to argue, but I tend to think in RPC-oriented application XML namespace doesn't really matter, and in Document-oriented applications XML namespace are important.

-- the way of organizing schema and result.

Basically everything is a field, a field has a datatype, name and value. Such as following result:

<str name="id">IW-02</str>
<bool name="inStock">false</bool>
<str name="manu">Belkin</str>

This bascially allows any fields without XML namespace/schemas.

0 Comments:

Post a Comment

<< Home