Solr index time boost on document date

2019-08-05 17:44发布

问题:

I'm trying to index a wiki (using a direct access to the wiki db) and trying to negatively boost on document date (so that the old documents appear further down in the results). There is a great solr-wiki page on boosting and related topics:

http://wiki.apache.org/solr/SolrRelevancyFAQ

It simply says to do the following:

"Use an index-time boost that is larger for newer documents"

But how and where? Which part of the solr configuration do I have to change to use an index-time boost? Do I have to adapt the DATA import handler?

回答1:

IMO you should not use an index time boost for date.
If you do an index time boost, the boost is fixed stored in the index
Query time boost will provide you the flexibility to boost as well as change the boost at runtime without needing re-indexing

You can use Query time boost which will always boost according to the current date.



回答2:

From Solr relevancy FAQ:

Index-time boosts are assigned with the optional attribute "boost" in the section of the XML updating messages. See UpdateXmlMessages for more information.

Following the UpdateXmlMessages link you can find this:

Optional attributes on "doc"

boost = — default is 1.0 (See Lucene docs for definition of boost.) NOTE: make sure norms are enabled (omitNorms="false" in the schema.xml) for any fields where the index-time boost should be stored.

Optional attributes for "field"

boost = — default is 1.0 (See Lucene docs for definition of boost.) NOTE: make sure norms are enabled (omitNorms="false" in the schema.xml) for any fields where the index-time boost should be stored.