Nope, there is not.
On 3/3/2011 10:55 AM, Tim Gilbert wrote:
Hi,
I have a unique key within my index, but rather than the default
behavour of overwriting I am wondering if there is a method to "merge"
the two different documents on commit of the second document. I have a
testcase which explains what I'd like to happen:
@Test
public void testMerge() throws SolrServerException, IOException
{
SolrInputDocument doc1 = new SolrInputDocument();
doc1.addField("secid", "testid");
doc1.addField("value1_i", 1);
SolrAllSec.GetSolrServer().add(doc1);
SolrAllSec.GetSolrServer().commit();
SolrInputDocument doc2 = new SolrInputDocument();
doc2.addField("secid", "testid");
doc2.addField("value2_i", 2);
SolrAllSec.GetSolrServer().add(doc2);
SolrAllSec.GetSolrServer().commit();
SolrQuery solrQuery = new SolrQuery();
solrQuery = solrQuery.setQuery("secid:testid");
QueryResponse response =
SolrAllSec.GetSolrServer().query(solrQuery, METHOD.GET);
List<SolrDocument> result = response.getResults();
Assert.isTrue(result.size() == 1);
Assert.isTrue(result.contains("value1"));
Assert.isTrue(result.contains("value2"));
}
Other than reading "doc1" and adding the fields from "doc2" and
recommitting, is there another way?
Thanks in advance,
Tim