lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peyman Faratin <>
Subject Re: index writer in searchComponent
Date Sun, 01 Jul 2012 03:03:59 GMT
Hi Erik

The workflow I'd like to implement is 

1- search the index using the incoming query
2- the query is of the type "does entity X exist"
3- if X does not exist in the index then I'd like to add X to the index

Currently I am using a custom search component to achieve this by creating a solrserver within
the init (or inform) method of the search component and using that instance to update (and
commit) the index. I am not sure this is the best approach either and thought using the IndexReader
of the search component itself maybe better. 

Is there a better approach in your opinion?

thank you Erik


On Jun 30, 2012, at 8:13 PM, Erick Erickson wrote:

> Lots of the index modification (all of it?) has been removed in 4.0
> from IndexReaders...
> It seems like you could always get the directory and open a
> SolrIndexWriter wherever you wanted,
> but I'm not sure it's a good idea, are there other processes that will
> be writing to the index at the
> same time?
> What's the purpose here anyway? There might be a better approach....
> Best
> Erick
> On Thu, Jun 28, 2012 at 4:02 PM, Peyman Faratin <> wrote:
>> Hi
>> Is it possible to add a new document to the index in a custom SearchComponent (that
also implements a SolrCoreAware)? I can get a reference to the indexReader via the ResponseBuilder
parameter of the process() method using
>> rb.req.getSearcher().getReader()
>> But is it possible to actually add a new document to the index _after_ searching
the index? I.e accessing the indexWriter?
>> thank you
>> Peyman

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message