[ https://issues.apache.org/jira/browse/SOLR-5313?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Munendra S N resolved SOLR-5313. -------------------------------- Resolution: Won't Do As index times boosts are no longer supported. closing this > json update extract boost from document value > --------------------------------------------- > > Key: SOLR-5313 > URL: https://issues.apache.org/jira/browse/SOLR-5313 > Project: Solr > Issue Type: Improvement > Affects Versions: 3.6 > Reporter: Nicolas Franck > Priority: Minor > Labels: boost, document, json, solr, update > > 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){ > log.info("boost_field found in document with value > '"+b_field.getFirstValue()+"'"); > float boost = > Float.parseFloat((String)b_field.getFirstValue()); > cmd.solrDoc.setDocumentBoost(boost); > cmd.solrDoc.removeField(boost_field); > } > } > //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? -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org