You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Iana Atanassova <ia...@gmail.com> on 2012/06/29 15:44:58 UTC

Using custom user-defined caches to store user app data while indexing

Hi,

I'm trying to implement a custom UpdateRequestProcessorFactory class that
works with the XSLT Request handler for indexing.
My UpdateRequestProcessorFactory has to examine some of the document fields
and compare them against some regular expressions that are stored in an
external MySQL database.
Currently, my UpdateRequestProcessorFactory works by establishing a
connection to the database and them retrieving the regular expressions for
every new document that needs to be indexed.

However, I would like to speed up this processing and store the regular
expressions in memory. I tried to define a new user cache in solrconfig.xml
(http://wiki.apache.org/solr/SolrCaching#User.2BAC8-Generic_Caches). As far
as I understand, these caches can be used to store any user application
data. But when I implement the UpdateRequestProcessorFactory, I do not
arrive to access this cache.

What would be the method to read/write into a user defined sorl cache while
indexing? How can I access the current SolrIndexSearcher from my code? Are
there any other solutions that I should look at?

Thanks!

Iana

Re: Using custom user-defined caches to store user app data while indexing

Posted by Chris Hostetter <ho...@fucit.org>.
: If you implement SolrCoreAware interface in your custom
: UpdateRequestProcessorFactory, you could then access your cache via Solr
: Core in the inform method, I think. Haven't tried it myself, but it looks
: logical to me to start from there.

right ... but you really only need to be SolrCoreAware if you have to 
access the SolrCore during "initialization"

You can also access the SolrCore from the SolrQueryRequest -- which is 
probably all you need for your UpdateRequestProcessorFactory.


-Hoss

Re: Using custom user-defined caches to store user app data while indexing

Posted by Dmitry Kan <dm...@gmail.com>.
Hello!

If you implement SolrCoreAware interface in your custom
UpdateRequestProcessorFactory, you could then access your cache via Solr
Core in the inform method, I think. Haven't tried it myself, but it looks
logical to me to start from there.

// Dmitry

On Fri, Jun 29, 2012 at 4:44 PM, Iana Atanassova
<ia...@gmail.com>wrote:

> Hi,
>
> I'm trying to implement a custom UpdateRequestProcessorFactory class that
> works with the XSLT Request handler for indexing.
> My UpdateRequestProcessorFactory has to examine some of the document fields
> and compare them against some regular expressions that are stored in an
> external MySQL database.
> Currently, my UpdateRequestProcessorFactory works by establishing a
> connection to the database and them retrieving the regular expressions for
> every new document that needs to be indexed.
>
> However, I would like to speed up this processing and store the regular
> expressions in memory. I tried to define a new user cache in solrconfig.xml
> (http://wiki.apache.org/solr/SolrCaching#User.2BAC8-Generic_Caches). As
> far
> as I understand, these caches can be used to store any user application
> data. But when I implement the UpdateRequestProcessorFactory, I do not
> arrive to access this cache.
>
> What would be the method to read/write into a user defined sorl cache while
> indexing? How can I access the current SolrIndexSearcher from my code? Are
> there any other solutions that I should look at?
>
> Thanks!
>
> Iana
>



-- 
Regards,

Dmitry Kan