I admit I only skimmed your post, and at the level you're at I'm not sure how to hook it in, but see: https://issues.apache.org/jira/browse/SOLR-2429(SOLR-3.4) which allows you to specify cache=false which will specifically NOT put the filter into the filter cache at the Solr level.
Best Erick On Fri, Jan 11, 2013 at 11:24 AM, radu <radu.moldo...@atigeo.com> wrote: > Hello & thank you in advance for your help!, > > *Context:* > I have implemented a custom search component that receives 3 parameters > field, termValue and payloadX. > The component should search for a termValue in the requested Lucene field > and for each *termValue* to check *payloadX* in its associated payload the > information. > > *Constraints:* > I don't want to disable filterCache from solconfig.xml the <filterCache > class="solr.FastLRUCache" ....> since I have other searchComponents that > could use the filterCache. > > I have implemented this the payload search using SpanTermQuery and > "attached it" to q:field=termValue > public class MySearchComponent extends XPatternsSearchComponent { > > public void prepare(ResponseBuilder rb){ > ... rb.setQueryString(parameters.**get(CommonParams.Q) ... > } > > public void process(ResponseBuilder rb) { > ... > > SolrIndexSearcher.QueryResult queryResult = new > SolrIndexSearcher.QueryResult(**); // ??? question for help > > *CustomSpanTermQuery* customFilterQuery = new CustomSpanTermQuery(field, > term, payload); //search for payloadCriteria in the payload in a specific > field for a specific term > QueryCommand queryCommand = rb.getQueryCommand().** > setFilterList(filterQuery)); > > rb.req.getSearcher().search(**queryResult, queryCommand); > > ... > } > > *Issue:* > If I call the search component with field1, termValue1 and: > - *payload1*(the first search) the result from filtering it is saved > in filterCache. > - *payload2*(second time) the results from the first > search(filterCache) are returned and not a different expected result set. > > Findings: > I noticed that in SolrIndexSearch, filterCache is private so I can not > change\clear it through inheritance. > Also I tried to use rb.getQueryCommand().**replaceFlags() but > SolrIndexSearch.NO_CHECK_**FILTERCACHE|NO_CHECK_QCACHE|**NO_SET_QCACHE > are not public too. > > *Question*: > How to disable\clear filterCache(from SolrIndexSearcher ) *only *for a > custom search component. > Do I have other options\approaches? > > Best regards, > Radu >