Commit 889e36af authored by Matija Obreza's avatar Matija Obreza

Exclude NOR051 (SGSV) from DUPLSITE stats

TODOs for AccessionDetails, Taxonomy, ExplorerController#overview
parent 711a7e56
...@@ -46,6 +46,8 @@ public class AccessionDetails { ...@@ -46,6 +46,8 @@ public class AccessionDetails {
private Boolean available; private Boolean available;
private Date createdDate; private Date createdDate;
// FIXME @Field(index = FieldIndex.not_analyzed, type = FieldType.String) // FIXME @Field(index = FieldIndex.not_analyzed, type = FieldType.String)
// TODO Also handle ElasticsearchSearchServiceImpl and move to #isAnalyzed()
// section!
private List<String> duplSite; private List<String> duplSite;
private Boolean mlsStatus; private Boolean mlsStatus;
private Boolean art15; private Boolean art15;
...@@ -61,6 +63,8 @@ public class AccessionDetails { ...@@ -61,6 +63,8 @@ public class AccessionDetails {
@Field(type = FieldType.Nested) @Field(type = FieldType.Nested)
private ArrayList<Alias> aliases; private ArrayList<Alias> aliases;
private Svalbard sgsv; private Svalbard sgsv;
// FIXME TODO Enable inSgsv!
// private boolean inSgsv;
@Field(type = FieldType.Nested, store = false) @Field(type = FieldType.Nested, store = false)
private ArrayList<Remark> remarks; private ArrayList<Remark> remarks;
...@@ -120,6 +124,8 @@ public class AccessionDetails { ...@@ -120,6 +124,8 @@ public class AccessionDetails {
public void svalbard(SvalbardData svalbardData) { public void svalbard(SvalbardData svalbardData) {
this.sgsv = Svalbard.from(svalbardData); this.sgsv = Svalbard.from(svalbardData);
// FIXME TODO inSgsv
// this.inSgsv = this.sgsv != null;
} }
public void remarks(List<AccessionRemark> listAccessionRemarks) { public void remarks(List<AccessionRemark> listAccessionRemarks) {
...@@ -215,7 +221,7 @@ public class AccessionDetails { ...@@ -215,7 +221,7 @@ public class AccessionDetails {
public Boolean getAvailable() { public Boolean getAvailable() {
return available; return available;
} }
public void setAvailable(Boolean available) { public void setAvailable(Boolean available) {
this.available = available; this.available = available;
} }
...@@ -379,12 +385,20 @@ public class AccessionDetails { ...@@ -379,12 +385,20 @@ public class AccessionDetails {
public void setAcqusitionDate(Date acqusitionDate) { public void setAcqusitionDate(Date acqusitionDate) {
this.acqusitionDate = acqusitionDate; this.acqusitionDate = acqusitionDate;
} }
public Boolean getArt15() { public Boolean getArt15() {
return art15; return art15;
} }
public void setArt15(Boolean art15) { public void setArt15(Boolean art15) {
this.art15 = art15; this.art15 = art15;
} }
// TODO FIXME enable #inSgsv
// public boolean isInSgsv() {
// return inSgsv;
// }
// public void setInSgsv(boolean inSgsv) {
// this.inSgsv = inSgsv;
// }
} }
...@@ -13,6 +13,9 @@ public class Taxonomy { ...@@ -13,6 +13,9 @@ public class Taxonomy {
private String genus; private String genus;
@Field(index = FieldIndex.not_analyzed, type = FieldType.String) @Field(index = FieldIndex.not_analyzed, type = FieldType.String)
private String species; private String species;
// TODO FIXME Enable non-indexed access to genus+species
// @Field(index = FieldIndex.not_analyzed, type = FieldType.String)
// private String genusSpecies;
private String spAuthor; private String spAuthor;
private String subtax; private String subtax;
private String subtAuthor; private String subtAuthor;
......
...@@ -116,7 +116,12 @@ public class ElasticsearchSearchServiceImpl implements ElasticService, Initializ ...@@ -116,7 +116,12 @@ public class ElasticsearchSearchServiceImpl implements ElasticService, Initializ
AndFilterBuilder filterBuilder = getFilterBuilder(appliedFilters); AndFilterBuilder filterBuilder = getFilterBuilder(appliedFilters);
FacetRequest termFacetRequest = new TermFacetRequestBuilder("f").applyQueryFilter().fields(term).size(size).build(); FacetRequest termFacetRequest;
if (FilterConstants.DUPLSITE.equals(term)) {
termFacetRequest = new TermFacetRequestBuilder("f").applyQueryFilter().fields(term).excludeTerms("nor051").size(size).build();
} else {
termFacetRequest = new TermFacetRequestBuilder("f").applyQueryFilter().fields(term).size(size).build();
}
SearchQuery searchQuery = new NativeSearchQueryBuilder().withFilter(filterBuilder).withFacet(termFacetRequest).build(); SearchQuery searchQuery = new NativeSearchQueryBuilder().withFilter(filterBuilder).withFacet(termFacetRequest).build();
try { try {
...@@ -138,11 +143,11 @@ public class ElasticsearchSearchServiceImpl implements ElasticService, Initializ ...@@ -138,11 +143,11 @@ public class ElasticsearchSearchServiceImpl implements ElasticService, Initializ
int newSize = size; int newSize = size;
do { do {
termResult = termStatistics(appliedFilters, term, newSize); termResult = termStatistics(appliedFilters, term, newSize);
// Avoid div/0 // Avoid div/0
if (termResult.getTotalCount() == 0) if (termResult.getTotalCount() == 0)
break; break;
double otherPerc = (double) termResult.getOtherCount() / (termResult.getMissingCount() + termResult.getTotalCount()); double otherPerc = (double) termResult.getOtherCount() / (termResult.getMissingCount() + termResult.getTotalCount());
if (otherPerc < 0.1) if (otherPerc < 0.1)
break; break;
......
...@@ -482,6 +482,7 @@ public class ExplorerController extends BaseController { ...@@ -482,6 +482,7 @@ public class ExplorerController extends BaseController {
private void overviewManagement(ModelMap model, AppliedFilters appliedFilters) throws SearchException { private void overviewManagement(ModelMap model, AppliedFilters appliedFilters) throws SearchException {
model.addAttribute("statsStorage", elasticService.termStatisticsAuto(appliedFilters, FilterConstants.STORAGE, 30)); model.addAttribute("statsStorage", elasticService.termStatisticsAuto(appliedFilters, FilterConstants.STORAGE, 30));
model.addAttribute("statsDuplSite", elasticService.termStatisticsAuto(appliedFilters, FilterConstants.DUPLSITE, 10)); model.addAttribute("statsDuplSite", elasticService.termStatisticsAuto(appliedFilters, FilterConstants.DUPLSITE, 10));
model.addAttribute("statsSGSV", elasticService.termStatistics(appliedFilters, FilterConstants.SGSV, 2));
} }
private void overviewComposition(ModelMap model, AppliedFilters appliedFilters) throws SearchException { private void overviewComposition(ModelMap model, AppliedFilters appliedFilters) throws SearchException {
......
...@@ -194,6 +194,16 @@ ...@@ -194,6 +194,16 @@
<c:remove var="termResult" /> <c:remove var="termResult" />
<c:remove var="type" /> <c:remove var="type" />
</div> </div>
<%-- TODO FIXME enable #inSgsv
<div class="col-xs-12 col-sm-6 row-section">
<h4 id="stats-duplsite"><spring:message code="filter.sgsv" /></h4>
<c:set var="type" value="bool" />
<c:set var="termResult" value="${statsSGSV}" />
<%@include file="termresult.jspf"%>
<c:remove var="termResult" />
<c:remove var="type" />
</div>
--%>
</div> </div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment