On Mar 31, 2008, at 2:43 PM, Chris Hostetter wrote:


: > 2. Augment the documents with a field value -- this is a bit more
: > complex and runs the risk of name collisions with fields in your
: > documents.  You can pull the docLIst out from the response and add
: > fields to each document.
:
: this seems more appropriate,
: I'm okay, to resolve name collision , how do I add the field.. any specific
: methods to do that?

I *think* the missing step here is that while DocLists can't easily be
modified, new SolrDocument and SolrDocumentList classes have been
added since 1.2. Solr by defualt doesn't use them, but the built in Solr
ResponseWriters can output them, so your custom component can build a
SolrDocumentList bsed on the DocList, and add whatever fields you want.

I'm not sure if there are any help methods to do the
DocList->SolrDocumentList conversion.

(Ryan: keep my honest if this isn't what you had in mind)


Correct -- there isn't really a clean way to do this.

For an example, you can check the "locallucene" query component:
https://locallucene.svn.sourceforge.net/svnroot/locallucene/trunk/localsolr/src/com/pjaol/search/solr/component/LocalSolrQueryComponent.java
(towards the bottom of process)

that adds a calculated "geo_distance" field to each returned document.

ryan











-Hoss


Reply via email to