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