Skip to content

Commit

Permalink
Dont show content when rows less than 0
Browse files Browse the repository at this point in the history
  • Loading branch information
alegauss committed Oct 29, 2024
1 parent 71f3412 commit aa7169e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ private List<TurSNSiteSearchFacetBean> responseFacet(TurSNSiteSearchContext cont
.getFilterQueries().getFq().stream()
.filter(fq -> !fq.startsWith(facet))
.toList());
contextSearchFacet.getTurSEParameters().setRows(1);
contextSearchFacet.getTurSEParameters().setRows(-1);
turSolr.retrieveSolrFromSN(turSolrInstance, contextSearchFacet).ifPresent(turSEFacetResults ->
turSEResults.setFacetResults(turSEResults.getFacetResults().stream()
.map(f -> {
Expand Down Expand Up @@ -568,8 +568,11 @@ private List<TurSNSiteSearchFacetBean> responseFacet(TurSNSiteSearchContext cont
turSNSiteSearchFacetItemBeans.add(facetItemBean);
}
});
turSNSiteSearchFacetBeans.add(getTurSNSiteSearchFacetBean(context, facetMap.get(facet.getFacet()),
turSNSiteSearchFacetItemBeans));
if (!turSNSiteSearchFacetItemBeans.isEmpty()) {
turSNSiteSearchFacetBeans.add(getTurSNSiteSearchFacetBean(context,
facetMap.get(facet.getFacet()),
turSNSiteSearchFacetItemBeans));
}
}
});
return turSNSiteSearchFacetBeans;
Expand Down
8 changes: 6 additions & 2 deletions turing-app/src/main/java/com/viglet/turing/solr/TurSolr.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ public class TurSolr {
public static final String NO_FACET_NAME = "__no_facet_name__";
public static final String OR_OR = "OR-OR";
public static final String OR_AND = "OR-AND";
public static final String AND_OR = "AND-OR";
public static final String ALL = "_all_";
private final TurSNSiteFieldExtRepository turSNSiteFieldExtRepository;
private final TurSNTargetingRules turSNTargetingRules;
Expand Down Expand Up @@ -583,7 +582,12 @@ private void setMLT(TurSNSite turSNSite, List<TurSNSiteFieldExt> turSNSiteMLTFie
}

private void setRows(TurSNSite turSNSite, TurSEParameters turSEParameters) {
if (turSEParameters.getRows() <= 0) turSEParameters.setRows(turSNSite.getRowsPerPage());
if (turSEParameters.getRows() == 0) {
turSEParameters.setRows(turSNSite.getRowsPerPage());
}
else if (turSEParameters.getRows() < 0) {
turSEParameters.setRows(0);
}
}

private void setSortEntry(TurSNSite turSNSite, SolrQuery query, TurSEParameters turSEParameters) {
Expand Down

0 comments on commit aa7169e

Please sign in to comment.