[MGNLEESOLR-56] Search is triggered multiple times during one request if facet component is used on search result page Created: 02/Apr/15  Updated: 27/Apr/15  Resolved: 14/Apr/15

Status: Closed
Project: Solr Search Provider
Component/s: None
Affects Version/s: 2.1
Fix Version/s: 2.2

Type: Bug Priority: Major
Reporter: Milan Divilek Assignee: Milan Divilek
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

facetBox and rangeFacetBox components uses same model class as solrSearchResult component and this model class performs search. So if facetBox and rangeFacetBox components are on solrSearchResult page then search is triggered multiple times.



 Comments   
Comment by Karel de Witte [ 08/Apr/15 ]

There is no easy way of solutioning this, because there is no state conserved on solr side and Magnolia does a request for each component load. For this reason a @sessionscoped annotation and proxied requests were introduced in the facetedsolrsearchprovider. if there is nothing changed in the request, the facets are loaded from teh session stored solr response. Maybe this can be enhanced.

Comment by Milan Divilek [ 09/Apr/15 ]

if there is nothing changed in the request, the facets are loaded from teh session stored solr response.

And that's the problem. Only SolrResponse is stored and it is processed in every model class again. Also every model triggers resolving of suggestions or adding available facets fields(FacetedSearchResultModeladdAllAvailableFacets) into search provider, etc.

Comment by Jan Haderka [ 13/Apr/15 ]
protected void addFacetsToProvider(Map<String, MgnlFacetField> facetFields, Map<String, MgnlFacetField> rangeFacetFields) {
  this.solrSearchProvider.setFacetFields(facetFields);
  this.solrSearchProvider.setRangeFacetFields(rangeFacetFields);
}

Why is model setting something in provider? This looks very wrong.

Generated at Mon Feb 12 10:59:40 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.