You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by rbs <rb...@gmail.com> on 2022/02/15 19:42:09 UTC

Solr: User Defined Caches

Hi,

I've looked and googled, but I have been unable to actually find a working
example of User Defined Caches.

 

I looking for something showing the basics how to define, implement and use
as User Defined Cache.

 

Is there one out there and I have just missed it??

 

Thanks


Re: Solr: User Defined Caches

Posted by Michael Gibney <mi...@michaelgibney.net>.
I'm afraid it's unclear to me what your practical goal is, even at a very
high level. To the extent this may be an underdocumented area of plugin
development, my guess is that that's because it's mainly useful in
highly-specialized use cases. Stock/default caches (filterCache,
queryResultCache, etc.) should suffice for the vast majority of use cases.

Do you have a specific reason to suspect you could _benefit_ from a custom
cache, or are you simply trying to better understand custom caches in order
to determine whether you could benefit from using them? Assuming the
former, it would be really helpful to know more about what specifically
you're trying to achieve. If the latter, I honestly think it's not worth
investigating this area in the absence of a more clearly-defined need.

On Mon, Feb 21, 2022 at 4:13 PM rbsbcsb <rb...@gmail.com> wrote:

> Thank you for the reply, unfortunately, I had looked at the documentation
> and found it lacking since there are no examples...
>
> When I look at filterCache it makes sense on what it does and to a certain
> extent how it does it.  Same goes with queryResultCache.
>
> While both of these provide a list of docIds (unordered and ordered) that
> is then used within a query, they don't really provide the type of
> explanation of what is needed to create, manage and use a private list of
> docIds as a cache and then use it within a query.  I have traced the code
> for filterCache, but I must admit I found it difficult to pin point how and
> where everything did its work...  It may just be over my head for my level
> of Java coding experience and my understanding of the Solr/Lucene inner
> workings.
>
> I was hoping for some sort of working template/example demonstrating how
> to implement the basics of the cache lifecycle and then the use of that
> cache within a query.
>
> Thanks
>
>
>
> -----Original Message-----
> From: Michael Gibney [mailto:michael@michaelgibney.net]
> Sent: Thursday, February 17, 2022 9:02 AM
> To: users@solr.apache.org
> Subject: Re: Solr: User Defined Caches
>
> I just happened to be looking into this as well. I assume you've seen the
> refguide documentation:
>
> https://solr.apache.org/guide/8_11/query-settings-in-solrconfig.html#user-defined-caches
>
> Normally one would not configure a user-defined cache except in support of
> other custom plugins/components. e.g., if you have a custom
> Query/QueryParser implementation that could internally benefit from
> specialized caching strategies or something, in Query.createWeight(...) you
> could cast the provided IndexSearcher to a SolrIndexSearcher (a safe cast
> in most contexts), and use the SolrIndexSearcher to interact with your
> custom cache by name.
>
> Sorry if the response is a bit vague, I hope it's helpful nonetheless! If
> you share more specifically what you're trying to do, this thread could
> _become_ a discussion of a (theoretically) working example of user-defined
> cache :-)
>
> On Tue, Feb 15, 2022 at 2:42 PM rbs <rb...@gmail.com> wrote:
>
> > Hi,
> >
> > I've looked and googled, but I have been unable to actually find a
> working
> > example of User Defined Caches.
> >
> >
> >
> > I looking for something showing the basics how to define, implement and
> use
> > as User Defined Cache.
> >
> >
> >
> > Is there one out there and I have just missed it??
> >
> >
> >
> > Thanks
> >
> >
>
>

RE: Solr: User Defined Caches

Posted by rbsbcsb <rb...@gmail.com>.
Thank you for the reply, unfortunately, I had looked at the documentation and found it lacking since there are no examples...

When I look at filterCache it makes sense on what it does and to a certain extent how it does it.  Same goes with queryResultCache. 

While both of these provide a list of docIds (unordered and ordered) that is then used within a query, they don't really provide the type of explanation of what is needed to create, manage and use a private list of docIds as a cache and then use it within a query.  I have traced the code for filterCache, but I must admit I found it difficult to pin point how and where everything did its work...  It may just be over my head for my level of Java coding experience and my understanding of the Solr/Lucene inner workings.

I was hoping for some sort of working template/example demonstrating how to implement the basics of the cache lifecycle and then the use of that cache within a query.

Thanks



-----Original Message-----
From: Michael Gibney [mailto:michael@michaelgibney.net] 
Sent: Thursday, February 17, 2022 9:02 AM
To: users@solr.apache.org
Subject: Re: Solr: User Defined Caches

I just happened to be looking into this as well. I assume you've seen the
refguide documentation:
https://solr.apache.org/guide/8_11/query-settings-in-solrconfig.html#user-defined-caches

Normally one would not configure a user-defined cache except in support of
other custom plugins/components. e.g., if you have a custom
Query/QueryParser implementation that could internally benefit from
specialized caching strategies or something, in Query.createWeight(...) you
could cast the provided IndexSearcher to a SolrIndexSearcher (a safe cast
in most contexts), and use the SolrIndexSearcher to interact with your
custom cache by name.

Sorry if the response is a bit vague, I hope it's helpful nonetheless! If
you share more specifically what you're trying to do, this thread could
_become_ a discussion of a (theoretically) working example of user-defined
cache :-)

On Tue, Feb 15, 2022 at 2:42 PM rbs <rb...@gmail.com> wrote:

> Hi,
>
> I've looked and googled, but I have been unable to actually find a working
> example of User Defined Caches.
>
>
>
> I looking for something showing the basics how to define, implement and use
> as User Defined Cache.
>
>
>
> Is there one out there and I have just missed it??
>
>
>
> Thanks
>
>


Re: Solr: User Defined Caches

Posted by Michael Gibney <mi...@michaelgibney.net>.
I just happened to be looking into this as well. I assume you've seen the
refguide documentation:
https://solr.apache.org/guide/8_11/query-settings-in-solrconfig.html#user-defined-caches

Normally one would not configure a user-defined cache except in support of
other custom plugins/components. e.g., if you have a custom
Query/QueryParser implementation that could internally benefit from
specialized caching strategies or something, in Query.createWeight(...) you
could cast the provided IndexSearcher to a SolrIndexSearcher (a safe cast
in most contexts), and use the SolrIndexSearcher to interact with your
custom cache by name.

Sorry if the response is a bit vague, I hope it's helpful nonetheless! If
you share more specifically what you're trying to do, this thread could
_become_ a discussion of a (theoretically) working example of user-defined
cache :-)

On Tue, Feb 15, 2022 at 2:42 PM rbs <rb...@gmail.com> wrote:

> Hi,
>
> I've looked and googled, but I have been unable to actually find a working
> example of User Defined Caches.
>
>
>
> I looking for something showing the basics how to define, implement and use
> as User Defined Cache.
>
>
>
> Is there one out there and I have just missed it??
>
>
>
> Thanks
>
>