Details
Description
The current JsonLoader in org.apache.solr.handler provides a way to add a boost to a document as a whole. But if you want to add multiple documents,
each with its own boost, you have to create something like this:
{
"add": { "boost":2.0, "doc": {} },
"add": { "boost":2.0, "doc": {} }
..
}
No idea which JSON-writer can do this (I use the one from perl,
that does not support duplicate keys).
Therefore I tried to alter some of the code in JsonLoader::handleAdds.
The code is between "//test - start" and "//test - end":
cmd.solrDoc = parseDoc(ev);
//test - start
if(boost_field != null){
SolrInputField b_field = cmd.solrDoc.getField(boost_field);
if(b_field != null)
}
//test - end
processor.processAdd(cmd);
In this code I try to extract the boost value for the document from the document itself. The default field is configured as "_boost", and is deleted
from the document afterwards.
I tried to subclass JsonLoader, but sadly the class is package-protected
Could this be an interesting contribution?