I need to index the processed token to a different feild (eg: stanbolResponse), in the same document that's being indexed.
I am looking for a way to retrieve the document.id from the TokenStream so that I can update the same document with new field values. (In my sample code above I'm adding a new document, instead of updating the same document) Any pointers please? Thanks, Dileepa On Tue, Nov 12, 2013 at 12:01 PM, Dileepa Jayakody < dileepajayak...@gmail.com> wrote: > Hi All, > > In my custom filter, I need to index the processed token into a different > field. The processed token is a Stanbol enhancement response. > > The solution I have so far found is to use a Solr client (solj) to add a > new Document with my processed field into Solr. Below is the sample code > segment; > > SolrServer server = new HttpSolrServer("http://localhost:8983/solr/"); > SolrInputDocument doc1 = new SolrInputDocument(); > doc1.addField( "id", "id1", 1.0f ); > doc1.addField("stanbolResponse", response); > try { > server.add(doc1); > server.commit(); > } catch (SolrServerException e) { > e.printStackTrace(); > } > > > This mechanism requires a new HTTP call to the local Solr server for every > token I process for the stanbolRequest field, and I feel it's not very > efficient. > > Is there any other alternative way to invoke a update request to add a new > field to the indexing document within the filter (without making an > explicit HTTP call using Solrj)? > > Thanks, > Dileepa >