Skip to content

Commit

Permalink
Merge pull request Sunbird-Knowlg#1322 from krgauraw/DP-1384
Browse files Browse the repository at this point in the history
DP-1384: changes for auto-creator
  • Loading branch information
amitpriyadarshi authored Feb 1, 2021
2 parents f418a06 + bb58f31 commit 6d196de
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 11 deletions.
2 changes: 1 addition & 1 deletion platform-jobs/samza/auto-creator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>auto-creator</artifactId>
<version>0.0.29</version>
<version>0.0.30</version>

<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,16 @@ private static void validateMimeType(String fileId, String mimeType, String file
throw new ServerException(TaxonomyErrorCodes.ERR_INVALID_UPLOAD_FILE_URL.name(), errMsg);
break;
}
case "audio/mp3" : {
if(!StringUtils.equalsIgnoreCase("audio/mpeg", fileMimeType))
throw new ServerException(TaxonomyErrorCodes.ERR_INVALID_UPLOAD_FILE_URL.name(), errMsg);
break;
}
case "application/vnd.ekstep.html-archive" : {
if(!StringUtils.equalsIgnoreCase("application/x-zip-compressed", fileMimeType))
throw new ServerException(TaxonomyErrorCodes.ERR_INVALID_UPLOAD_FILE_URL.name(), errMsg);
break;
}
default: {
if(!StringUtils.equalsIgnoreCase(mimeType, fileMimeType))
throw new ServerException(TaxonomyErrorCodes.ERR_INVALID_UPLOAD_FILE_URL.name(), errMsg);
Expand Down
4 changes: 2 additions & 2 deletions platform-jobs/samza/distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@
<dependency>
<groupId>org.ekstep</groupId>
<artifactId>auto-creator</artifactId>
<version>0.0.29</version>
<version>0.0.30</version>
<type>tar.gz</type>
<classifier>distribution</classifier>
</dependency>
<dependency>
<groupId>org.ekstep</groupId>
<artifactId>mvc-processor-indexer</artifactId>
<version>1.3.3</version>
<version>1.3.4</version>
<type>tar.gz</type>
<classifier>distribution</classifier>
</dependency>
Expand Down
2 changes: 1 addition & 1 deletion platform-jobs/samza/mvc-processor-indexer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<artifactId>samza</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<version>1.3.3</version>
<version>1.3.4</version>
<artifactId>mvc-processor-indexer</artifactId>
<dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,25 +60,28 @@ public void upsertDocument(String uniqueId, Map<String,Object> jsonIndexDocument
proocessNestedProps(jsonIndexDocument);
String jsonAsString = mapper.writeValueAsString(jsonIndexDocument);
switch (action) {
case "update-es-index":
case "update-es-index": {
// Insert a new doc
ElasticSearchUtil.addDocumentWithId(CompositeSearchConstants.MVC_SEARCH_INDEX,
uniqueId, jsonAsString);
break;
case "update-content-rating" :
}
case "update-content-rating" : {
String resp = ElasticSearchUtil.getDocumentAsStringById(CompositeSearchConstants.MVC_SEARCH_INDEX,
uniqueId);
if (resp.contains(uniqueId)) {
LOGGER.info("ES Document Found With Identifier " + uniqueId +" | Updating Content Rating.");
if (null != resp && resp.contains(uniqueId)) {
LOGGER.info("ES Document Found With Identifier " + uniqueId + " | Updating Content Rating.");
Map<String, Object> metadata = (Map<String, Object>) jsonIndexDocument.get("metadata");
String finalJsonindexasString = mapper.writeValueAsString(metadata);
CompletableFuture.runAsync(() -> {
ElasticSearchUtil.updateDocument(CompositeSearchConstants.MVC_SEARCH_INDEX,
uniqueId, finalJsonindexasString);

});
}
case "update-ml-contenttextvector":
} else
LOGGER.info("ES Document Not Found With Identifier " + uniqueId + " | Skipped Updating Content Rating.");
}
case "update-ml-contenttextvector": {
List<List<Double>> ml_contentTextVectorList;
Set<Double> ml_contentTextVector = null;
ml_contentTextVectorList = jsonIndexDocument.get("ml_contentTextVector") != null ? (List<List<Double>>) jsonIndexDocument.get("ml_contentTextVector") : null;
Expand All @@ -88,13 +91,16 @@ public void upsertDocument(String uniqueId, Map<String,Object> jsonIndexDocument
}
jsonIndexDocument.put("ml_contentTextVector", ml_contentTextVector);
jsonAsString = mapper.writeValueAsString(jsonIndexDocument);
case "update-ml-keywords":
}
case "update-ml-keywords": {
// Update a doc
ElasticSearchUtil.updateDocument(CompositeSearchConstants.MVC_SEARCH_INDEX,
uniqueId, jsonAsString);

break;
}
default:
LOGGER.info("No Action Matched. Skipped Processing Event For " + uniqueId);
}

}
Expand Down

0 comments on commit 6d196de

Please sign in to comment.