Monday, August 23, 2010

index-time-boosting while posting an xml to solr

Here is a sample XML fle you can HTTP POST to Solr:

<add allowDups="false">
<doc boost="2.0">
<field name="id">5432a</field>
<field name="type" ...</field>
<field name="a_name" boost="0.5"></field>
<!-- the date/time syntax MUST look just like this (ISO-8601)-->
<field name="begin_date">2007-12-31T09:40:00Z</field>
</doc>
<doc>
<doc>
<field name="id">5432a</field>
<field name="type" ...
<field name="begin_date">2007-12-31T09:40:00Z</field>
</doc>
<!-- more here as needed -->
</add>


The allowDups defaults to false to guarantee the uniqueness of values in the feld
that you have designated as the unique feld in the schema (assuming you have such
a feld). If you were to add another document that has the same value for the unique
feld, then this document would override the previous document, whether it is
pending a commit or it's already committed. You will not get an error.
If you are sure that you will be adding a document that is not
a duplicate, then you can set allowDups to true to get a
performance improvement.

Boosting affects the scores of matching documents in order to affect ranking in 
score-sorted search results. Providing a boost value, whether at the document or
feld level, is optional. The default value is 1.0, which is effectively a non-boost.
Technically, documents are not boosted, only felds are. The effective boost value 
of a feld is that specifed for the document multiplied by that specifed for the feld.

Specifying boosts here is called index-time boosting, which is rarely
done as compared to the more fexible query-time boosting. Index-time
boosting is less fexible because such boosting decisions must be decided
at index-time and will apply to all of the queries.



From :
Solr 1.4 Enterprise Search Server (Packt, 2009, 1847195881)

No comments:

Post a Comment