Skip to content

Commit

Permalink
Merge pull request #30 from nimble-platform/staging
Browse files Browse the repository at this point in the history
Pull Request for Release MVP 19.0.4 / FMP 13.0.4
  • Loading branch information
dogukan10 authored Jun 30, 2021
2 parents 07f90f0 + c038edf commit 9564cdf
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 20 deletions.
4 changes: 0 additions & 4 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,6 @@ node('nimble-jenkins-slave') {
sh 'ssh nimble "cd /data/deployment_setup/prod/ && sudo ./run-prod.sh restart-single indexing-service"'
}

stage('Deploy FMP') {
sh 'ssh fmp-prod "cd /srv/nimble-fmp/ && ./run-fmp-prod.sh restart-single indexing-service"'
}

stage('Deploy Efactory') {
sh 'ssh efac-prod "cd /srv/nimble-efac/ && ./run-efac-prod.sh restart-single indexing-service"'
}
Expand Down
43 changes: 28 additions & 15 deletions src/main/java/eu/nimble/indexing/service/impl/SolrServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,16 @@ public SearchResult<T> select(String query, List<String> filterQueries, List<Str
}
}
SearchResult<T> result = select(qCriteria, joinHelper.getFilterQueries(), joinHelper.getFacetFields(), facetLimit, facetMinCount, page);

for (String join : joinHelper.getJoins()) {
// process join facets
if (!joinHelper.getFacetFields(join).isEmpty()) {
// process a query for the joined facet fields
joinFacets(result, join, joinHelper.getJoinInfo(join), joinHelper.getFilterQueries(join), joinHelper.getFacetFields(join), facetLimit, facetMinCount, page);

if(result.getTotalElements() > 0){
for (String join : joinHelper.getJoins()) {
// process join facets
if (!joinHelper.getFacetFields(join).isEmpty()) {
// process a query for the joined facet fields
joinFacets(result, join, joinHelper.getJoinInfo(join), joinHelper.getFilterQueries(join), joinHelper.getFacetFields(join), facetLimit, facetMinCount, page);
}

}

}
return result;
}
Expand All @@ -161,8 +163,8 @@ public SearchResult<T> select(String query, List<String> filterQueries, List<Str
if (query.indexOf(":") == -1 && query.indexOf("*") == -1 && query.indexOf(" ") == -1) {
query = String.format("*%s*", query);
}
else if (query.indexOf("classification.") != -1) {
//parse the query with a join on class index for synonyms
//parse the query with a join on class/item index
else if (query.indexOf("classification.") != -1 || query.indexOf("item.") != -1) {
query = joinHelper.parseQuery(query);
}

Expand All @@ -184,13 +186,14 @@ else if (query.indexOf("classification.") != -1) {

SearchResult<T> result = select(qCriteria, joinHelper.getFilterQueries(), joinHelper.getFacetFields(),sortFields, facetLimit, facetMinCount, page);

for (String join : joinHelper.getJoins()) {
// process join facets
if (!joinHelper.getFacetFields(join).isEmpty()) {
// process a query for the joined facet fields
joinFacets(result, join, joinHelper.getJoinInfo(join), joinHelper.getFilterQueries(join), joinHelper.getFacetFields(join), facetLimit, facetMinCount, page);
if(result.getTotalElements() > 0){
for (String join : joinHelper.getJoins()) {
// process join facets
if (!joinHelper.getFacetFields(join).isEmpty()) {
// process a query for the joined facet fields
joinFacets(result, join, joinHelper.getJoinInfo(join), joinHelper.getFilterQueries(join), joinHelper.getFacetFields(join), facetLimit, facetMinCount, page);
}
}

}
return result;
}
Expand Down Expand Up @@ -320,6 +323,16 @@ private SearchResult<T> joinFacets(
//
// }
FacetQuery fq = new SimpleFacetQuery(new SimpleStringCriteria("*:*"), page);
// handle the join for commodity classifications
if (toExtend.getFacets() != null && join.getField().getName().contentEquals(JoinInfo.classification.getField().getName()) && toExtend.getFacets().containsKey(join.getField().getName())) {
StringBuilder facetFilter = new StringBuilder();
FacetResult facetResult = toExtend.getFacets().get(join.getField().getName());
for (FacetResult.Entry entry : facetResult.getEntry()) {
facetFilter.append("\""+entry.getLabel()+"\",");
}
String expression = String.format("(%s)",facetFilter.substring(0,facetFilter.length()-1));
fq.addFilterQuery(new SimpleFilterQuery(Criteria.where(JoinInfo.classification.getJoinedField()).expression(expression)));
}
// we are interested in facets only
fq.setRows(0);
// add filter queries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void addFacetField(String fieldName) {
String joinName = fieldName.substring(0,joinDelimPos);

// find the join info
joinInfo = JoinInfo.getJoinInfo(collection, joinName);
joinInfo = JoinInfo.getJoinInfo(joinName);

if (joinInfo != null) {
// keep the join (mappedName and info)
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/eu/nimble/indexing/solr/query/JoinInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ public enum JoinInfo {
public Field getField() {
return new SimpleField(field);
}
public String getJoinedField(){
return joinedField;
}
public static JoinInfo getJoinInfo(String collection, String mappedName) {
for ( JoinInfo j : values()) {
if ( j.collection.equals(collection)) {
Expand Down

0 comments on commit 9564cdf

Please sign in to comment.