Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
abf05ed
Create Goals.sh
pc0202 Apr 5, 2021
beaa8d8
Create Playlist.sh
pc0202 Apr 5, 2021
16f0d49
Update master_category_create
pc0202 Apr 5, 2021
5449bc5
Update schema.json
pc0202 Apr 5, 2021
12e8f07
Update schema.json
pc0202 Apr 6, 2021
888250a
Update schema.json
pc0202 Apr 6, 2021
0484502
Update schema.json
pc0202 Apr 6, 2021
f7e148c
Update pom.xml
pc0202 Apr 12, 2021
c708846
Update StorageService.scala
pc0202 Apr 12, 2021
127a62b
Update StorageService.scala
pc0202 Apr 12, 2021
81cf617
Update XmlParser.scala
pc0202 Apr 12, 2021
ac4e4c8
Update H5PMimeTypeMgrImpl.scala
pc0202 Apr 12, 2021
741c1b2
Update schema.json
pc0202 Apr 12, 2021
14088ea
Update pom.xml
pc0202 Apr 19, 2021
16df195
SC-2226 Event and EventSet APIs
univermal Feb 25, 2021
9769bc5
SC-2226 Event and EventSet APIs
univermal Feb 25, 2021
de34737
SC-2226 Add EventActor to TestModule
univermal Mar 1, 2021
5042e96
SC-2226 Added unit tests
univermal Mar 2, 2021
f3d2079
SC-2226 Added Draft mode and renamed event set schema to lower case
univermal Mar 2, 2021
e242b48
SC-2226 Added publis APIs
univermal Mar 3, 2021
ed7e8f7
SC-2226 update publish flow and validations
univermal Mar 15, 2021
9b62708
SC-2226 update publish flow and validations
univermal Mar 15, 2021
75b46ad
SC-2226 update publish flow and validations
univermal Mar 15, 2021
8f88d63
SC-2226 update publish flow and validations
univermal Mar 15, 2021
795f809
removed cloud-store-sdk dependencies
pc0202 Apr 29, 2021
c099fef
Update pom.xml
pc0202 Apr 30, 2021
750fd2a
Update schema.json
amit-kumaryadav Jun 30, 2021
ca5e3cb
Update schema.json
amit-kumaryadav Jun 30, 2021
2ad45dc
Update ContentController.scala
amit-kumaryadav Jun 30, 2021
16c48a1
Update ContentController.scala
amit-kumaryadav Jun 30, 2021
ceae7fb
Merge pull request #1 from amit-kumaryadav/release-3.7.0
Haritest Jul 2, 2021
41ca375
Search related changes
amit-kumaryadav Jul 5, 2021
2c57111
Revert "Search related changes"
amit-kumaryadav Jul 5, 2021
e7b8f56
Reverting the changes
amit-kumaryadav Jul 5, 2021
1cc679e
Revert "Reverting the changes"
amit-kumaryadav Jul 5, 2021
094d0a4
Update HtmlMimeTypeMgrImpl.scala
pc0202 Jul 20, 2021
c7f0731
Update HtmlMimeTypeMgrImpl.scala
pc0202 Jul 20, 2021
a1d6834
Update RetireManager.scala
pc0202 Jul 29, 2021
a143799
Merge pull request #2 from pritha-tarento/index-validation
Haritest Jul 29, 2021
5b11ef2
Update RetireManager.scala
pc0202 Jul 29, 2021
8353d7d
Merge pull request #3 from pritha-tarento/index-validation
Haritest Jul 29, 2021
d1dea78
Added multi Filter in SearchActor
pc0202 Aug 15, 2021
e5da71c
Added multi filter in SearchDTO
pc0202 Aug 15, 2021
e78064b
Added multi filter in SearchProcessor
pc0202 Aug 15, 2021
1168a49
Merge pull request #4 from pritha-tarento/index-validation
karthik-tarento Aug 16, 2021
78614b1
Update SearchProcessor.java
pc0202 Aug 16, 2021
d9df49c
Update SearchActor.java
pc0202 Aug 16, 2021
6c472dd
Merge pull request #5 from pritha-tarento/index-validation
Haritest Aug 23, 2021
2571afc
Added nested field aggregation
amit-kumaryadav Aug 23, 2021
7e0bc6a
Nested fields aggregations.
amit-kumaryadav Aug 23, 2021
67ada25
Update SearchProcessor.java
amit-kumaryadav Aug 23, 2021
6078089
Update ElasticSearchUtil.java
amit-kumaryadav Aug 23, 2021
1bcbcd6
Create ElasticSearchUtil.java
amit-kumaryadav Aug 23, 2021
125c20b
Update SearchProcessor.java
amit-kumaryadav Aug 23, 2021
1686f1f
Update ElasticSearchUtil.java
amit-kumaryadav Aug 23, 2021
66e9294
Update ElasticSearchUtil.java
amit-kumaryadav Aug 23, 2021
e3b9d10
Update ElasticSearchUtil.java
amit-kumaryadav Sep 1, 2021
747b2ee
Update SearchProcessor.java
amit-kumaryadav Sep 1, 2021
1db4e79
Merge branch '3.9.0-prod-fix' into aggregation_on_nested_fields
pc0202 Nov 23, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,15 @@ jobs:
- restore_cache:
key: kp-dependency-test-cache-{{ checksum "pom.xml" }}
- run:
name: Setup environment and run tests
command: bash vmsetup.sh
name: Save test results
command: |
mkdir -p ~/test-results/junit/
find . -type f -regex ".*/target/surefire-reports/.*xml" -exec cp {} ~/test-results/junit/ \;
when: always
- store_test_results:
path: ~/test-results
- store_artifacts:
path: ~/test-results/junit
- save_cache:
paths:
- ~/.m2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package org.sunbird.content.actors
import java.util
import java.util.concurrent.CompletionException
import java.io.File

import org.apache.commons.io.FilenameUtils

import javax.inject.Inject
import org.apache.commons.lang3.StringUtils
import org.sunbird.`object`.importer.{ImportConfig, ImportManager}
Expand All @@ -16,6 +16,7 @@ import org.sunbird.common.{ContentParams, Platform, Slug}
import org.sunbird.common.dto.{Request, Response, ResponseHandler}
import org.sunbird.common.exception.ClientException
import org.sunbird.content.dial.DIALManager
import org.sunbird.content.mgr.ImportManager
import org.sunbird.util.RequestUtil
import org.sunbird.content.upload.mgr.UploadManager
import org.sunbird.graph.OntologyEngineContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ object RetireManager {
private def updateNodesToRetire(request: Request, updateMetadataMap: util.Map[String, AnyRef])(implicit ec: ExecutionContext, oec: OntologyEngineContext): Future[Response] = {
RedisCache.delete(request.get(ContentConstants.IDENTIFIER).asInstanceOf[String])
val updateReq = new Request(request)
updateReq.put(ContentConstants.IDENTIFIERS, java.util.Arrays.asList(request.get(ContentConstants.IDENTIFIER).asInstanceOf[String], request.get(ContentConstants.IDENTIFIER).asInstanceOf[String] + HierarchyConstants.IMAGE_SUFFIX))
updateReq.put(ContentConstants.IDENTIFIERS, java.util.Arrays.asList(request.get(ContentConstants.IDENTIFIER).asInstanceOf[String]))
updateReq.put(ContentConstants.METADATA, updateMetadataMap)
DataNode.bulkUpdate(updateReq).map(node => ResponseHandler.OK())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ import org.sunbird.models.UploadParams
import org.sunbird.common.dto.ResponseHandler
import play.api.mvc.ControllerComponents
import utils.{ActorNames, ApiId, JavaJsonUtils}

import org.slf4j.LoggerFactory
import com.fasterxml.jackson.databind.ObjectMapper
import scala.collection.JavaConverters._

import scala.concurrent.{ExecutionContext, Future}

@Singleton
class ContentController @Inject()(@Named(ActorNames.CONTENT_ACTOR) contentActor: ActorRef, @Named(ActorNames.COLLECTION_ACTOR) collectionActor: ActorRef, cc: ControllerComponents, actorSystem: ActorSystem)(implicit exec: ExecutionContext) extends BaseController(cc) {

val LOG = LoggerFactory.getLogger(classOf[ContentController])
val mapper = new ObjectMapper();
val objectType = "Content"
val schemaName: String = "content"
val version = "1.0"
Expand All @@ -24,6 +26,7 @@ class ContentController @Inject()(@Named(ActorNames.CONTENT_ACTOR) contentActor:
val headers = commonHeaders()
val body = requestBody()
val content = body.getOrDefault("content", new java.util.HashMap()).asInstanceOf[java.util.Map[String, Object]];
LOG.warn("Content create request : {}", mapper.writeValueAsString(content))
content.putAll(headers)
val contentRequest = getRequest(content, headers, "createContent", true)
setRequestContext(contentRequest, version, objectType, schemaName)
Expand Down Expand Up @@ -56,6 +59,7 @@ class ContentController @Inject()(@Named(ActorNames.CONTENT_ACTOR) contentActor:
val headers = commonHeaders()
val body = requestBody()
val content = body.getOrDefault("content", new java.util.HashMap()).asInstanceOf[java.util.Map[String, Object]];
LOG.warn("Content Update request : {}", mapper.writeValueAsString(content))
content.putAll(headers)
val contentRequest = getRequest(content, headers, "updateContent")
setRequestContext(contentRequest, version, objectType, schemaName)
Expand All @@ -69,6 +73,7 @@ class ContentController @Inject()(@Named(ActorNames.CONTENT_ACTOR) contentActor:
body.putAll(headers)
val contentRequest = getRequest(body, headers, "addHierarchy")
contentRequest.put("mode", "edit");
LOG.warn("Add Hierarchy request : {}", mapper.writeValueAsString(contentRequest))
setRequestContext(contentRequest, version, objectType, schemaName)
getResult(ApiId.ADD_HIERARCHY, collectionActor, contentRequest)
}
Expand All @@ -89,6 +94,7 @@ class ContentController @Inject()(@Named(ActorNames.CONTENT_ACTOR) contentActor:
val data = body.getOrDefault("data", new java.util.HashMap()).asInstanceOf[java.util.Map[String, Object]]
data.putAll(headers)
val contentRequest = getRequest(data, headers, "updateHierarchy")
LOG.warn("Update Hierarchy request : {}", mapper.writeValueAsString(contentRequest))
setRequestContext(contentRequest, version, objectType, schemaName)
getResult(ApiId.UPDATE_HIERARCHY, collectionActor, contentRequest)
}
Expand Down
1 change: 1 addition & 0 deletions content-api/content-service/test/modules/TestModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class TestModule extends AbstractModule with AkkaGuiceSupport {
bindActor(classOf[TestActor], ActorNames.CHANNEL_ACTOR)
bindActor(classOf[TestActor], ActorNames.CATEGORY_ACTOR)
bindActor(classOf[TestActor], ActorNames.ASSET_ACTOR)

bindActor(classOf[TestActor], ActorNames.APP_ACTOR)
bindActor(classOf[TestActor], ActorNames.EVENT_SET_ACTOR)
bindActor(classOf[TestActor], ActorNames.EVENT_ACTOR)
Expand Down
2 changes: 1 addition & 1 deletion definition-scripts/Goals.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ curl -L -X POST '{{host}}/object/category/definition/v4/create' \
}
}
}
}'
}'
2 changes: 1 addition & 1 deletion definition-scripts/Playlist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ curl -L -X POST '{{host}}/object/category/definition/v4/create' \
}
}
}
}'
}'
14 changes: 13 additions & 1 deletion definition-scripts/master_category_create
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ curl --location --request POST '{{host}}/object/category/v4/create' \
}
}'

curl --location --request POST '{{host}}/object/category/v4/create' \
--header 'Content-Type: application/json' \
--data-raw '{
"request": {
"objectCategory": {
"name": "Goals",
"description":"Goals for Users"
}
}
}'


curl --location --request POST '{{host}}/object/category/v4/create' \
--header 'Content-Type: application/json' \
--data-raw '{
Expand Down Expand Up @@ -374,4 +386,4 @@ curl --location --request POST '{{host}}/object/category/v4/create' \
"description":"FTB Question"
}
}
}'
}'
18 changes: 16 additions & 2 deletions platform-modules/mimetype-manager/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,22 @@
<scala.major.version>2.11</scala.major.version>
<play2.version>2.7.2</play2.version>
</properties>

<!-- <repositories>
<repository>
<id>cloud-store-sdk_1.3.1-beta</id>
<name>cloud-store-sdk_1.3.1-beta</name>
<url>https://oss.sonatype.org/content/repositories/orgsunbird-1104/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>-->
<dependencies>
<!--<dependency>
<groupId>org.sunbird</groupId>
<artifactId>cloud-store-sdk</artifactId>
<version>1.3.1-beta</version>
</dependency> -->
<dependency>
<groupId>org.sunbird</groupId>
<artifactId>platform-common</artifactId>
Expand Down Expand Up @@ -143,4 +157,4 @@
</plugins>
</build>

</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class StorageService {
val storageSecret = Platform.config.getString("cephs3_storage_secret")
val endpoint = Platform.config.getString("cephs3_storage_endpoint")
storageService = StorageServiceFactory.getStorageService(new StorageConfig(storageType, storageKey, storageSecret, Option(endpoint)))

}
else throw new ServerException("ERR_INVALID_CLOUD_STORAGE", "Error while initialising cloud storage")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ import org.sunbird.common.exception.ClientException
import org.sunbird.graph.dac.model.Node
import org.sunbird.mimetype.mgr.{BaseMimeTypeManager, MimeTypeManager}
import org.sunbird.telemetry.logger.TelemetryManager
import org.sunbird.common.Platform

import scala.concurrent.{ExecutionContext, Future}

class HtmlMimeTypeMgrImpl(implicit ss: StorageService) extends BaseMimeTypeManager with MimeTypeManager {

override def upload(objectId: String, node: Node, uploadFile: File, filePath: Option[String], params: UploadParams)(implicit ec: ExecutionContext): Future[Map[String, AnyRef]] = {
validateUploadRequest(objectId, node, uploadFile)
if (isValidPackageStructure(uploadFile, List[String]("index.html"))) {
val indexHtmlValidation: Boolean = if (Platform.config.hasPath("indexHtmlValidation.env")) Platform.config.getBoolean("indexHtmlValidation.env") else false
val flag: Boolean = if (indexHtmlValidation) isValidPackageStructure(uploadFile, List[String]("index.html")) else true
if (flag) {
val urls = uploadArtifactToCloud(uploadFile, objectId, filePath)
node.getMetadata.put("s3Key", urls(IDX_S3_KEY))
node.getMetadata.put("artifactUrl", urls(IDX_S3_URL))
Expand Down
2 changes: 1 addition & 1 deletion schemas/asset/1.0/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1249,4 +1249,4 @@
}
}
}
}
}
2 changes: 1 addition & 1 deletion schemas/collection/1.0/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1269,4 +1269,4 @@
}
}
}
}
}
5 changes: 3 additions & 2 deletions schemas/content/1.0/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@
"audio/webm",
"audio/x-wav",
"audio/wav",
"application/json"
"application/json",
"application/quiz"
]
},
"osId": {
Expand Down Expand Up @@ -1370,4 +1371,4 @@
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ private SearchDTO getSearchDTO(Request request) throws Exception {
wordChainsRequest = false;
List<Map> properties = new ArrayList<Map>();
Map<String, Object> filters = (Map<String, Object>) req.get(SearchConstants.filters);
List<Map> multiFilterProperties = new ArrayList<Map>();
Map<String, Object> multiFilters = (Map<String, Object>) req.get("multiFilters");

if (null == filters)
filters = new HashMap<>();
if (filters.containsKey("tags")) {
Expand Down Expand Up @@ -239,6 +242,10 @@ private SearchDTO getSearchDTO(Request request) throws Exception {
searchObj.setSortBy(sortBy);
searchObj.setFacets(facets);
searchObj.setProperties(properties);
if(multiFilters!=null){
multiFilterProperties.addAll(getSearchFilterProperties(multiFilters, wordChainsRequest));
searchObj.setMultiFilterProperties(multiFilterProperties);
}
// Added Implicit Filter Properties To Support Collection content tagging to reuse by tenants.
setImplicitFilters(filters, searchObj);
searchObj.setLimit(limit);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket;
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder;
import org.elasticsearch.search.aggregations.bucket.nested.Nested;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.sunbird.common.Platform;
import org.sunbird.common.exception.ServerException;
Expand Down Expand Up @@ -613,43 +614,50 @@ private static SearchSourceBuilder buildJsonForWildCardQuery(String textKeyWord,

@SuppressWarnings("unchecked")
public static Object getCountFromAggregation(Aggregations aggregations, List<Map<String, Object>> groupByList,
IESResultTransformer transformer) {

Map<String, Object> countMap = new HashMap<String, Object>();
if (aggregations != null) {
for (Map<String, Object> aggregationsMap : groupByList) {
Map<String, Object> parentCountMap = new HashMap<String, Object>();
String groupByParent = (String) aggregationsMap.get("groupByParent");
Terms terms = aggregations.get(groupByParent);
List<Map<String, Object>> parentGroupList = new ArrayList<Map<String, Object>>();
List<Bucket> buckets = (List<Bucket>) terms.getBuckets();
for (Bucket bucket : buckets) {
Map<String, Object> parentCountObject = new HashMap<String, Object>();
parentCountObject.put("count", bucket.getDocCount());
List<String> groupByChildList = (List<String>) aggregationsMap.get("groupByChildList");
Aggregations subAggregations = bucket.getAggregations();
if (null != groupByChildList && !groupByChildList.isEmpty() && null != subAggregations) {
Map<String, Object> groupByChildMap = new HashMap<String, Object>();
for (String groupByChild : groupByChildList) {
Terms subTerms = subAggregations.get(groupByChild);
List<Bucket> childBuckets = (List<Bucket>) subTerms.getBuckets();
Map<String, Long> childCountMap = new HashMap<String, Long>();
for (Bucket childBucket : childBuckets) {
childCountMap.put(childBucket.getKeyAsString(), childBucket.getDocCount());
groupByChildMap.put(groupByChild, childCountMap);
}
}
parentCountObject.putAll(groupByChildMap);
}
parentCountMap.put(bucket.getKeyAsString(), parentCountObject);
parentGroupList.add(parentCountMap);
}

countMap.put(groupByParent, parentCountMap);
}
}
return transformer.getTransformedObject(countMap);
}
IESResultTransformer transformer) {
Map<String, Object> countMap = new HashMap<String, Object>();
if (aggregations != null) {
for (Map<String, Object> aggregationsMap : groupByList) {
Map<String, Object> parentCountMap = new HashMap<String, Object>();
String groupByParent = (String) aggregationsMap.get("groupByParent");
Terms terms = null;
List<Bucket> buckets = null;
if (groupByParent.contains(".")) {

Nested nested = aggregations.get(groupByParent.split("\\.")[0]);
terms = nested.getAggregations().get(groupByParent.split("\\.")[1]);
} else {
terms = aggregations.get(groupByParent);
}
buckets = (List<Bucket>)terms.getBuckets();
List<Map<String, Object>> parentGroupList = new ArrayList<Map<String, Object>>();
for (Bucket bucket : buckets) {
Map<String, Object> parentCountObject = new HashMap<String, Object>();
parentCountObject.put("count", bucket.getDocCount());
List<String> groupByChildList = (List<String>) aggregationsMap.get("groupByChildList");
Aggregations subAggregations = bucket.getAggregations();
if (null != groupByChildList && !groupByChildList.isEmpty() && null != subAggregations) {
Map<String, Object> groupByChildMap = new HashMap<String, Object>();
for (String groupByChild : groupByChildList) {
Terms subTerms = subAggregations.get(groupByChild);
List<Bucket> childBuckets = (List<Bucket>) subTerms.getBuckets();
Map<String, Long> childCountMap = new HashMap<String, Long>();
for (Bucket childBucket : childBuckets) {
childCountMap.put(childBucket.getKeyAsString(), childBucket.getDocCount());
groupByChildMap.put(groupByChild, childCountMap);
}
}
parentCountObject.putAll(groupByChildMap);
}
parentCountMap.put(bucket.getKeyAsString(), parentCountObject);
parentGroupList.add(parentCountMap);
}

countMap.put(groupByParent, parentCountMap);
}
}
return transformer.getTransformedObject(countMap);
}

private static void registerShutdownHook() {
Runtime.getRuntime().addShutdownHook(new Thread() {
Expand Down Expand Up @@ -711,4 +719,4 @@ public static void bulkDeleteDocumentById(String indexName, String documentType,
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class SearchDTO {

@SuppressWarnings("rawtypes")
private List<Map> properties;
private List<Map> multiFilterProperties;
private List<String> facets;
private List<String> fields;
private Map<String, String> sortBy;
Expand All @@ -33,6 +34,14 @@ public SearchDTO(List<Map> properties, String operation, int limit) {
this.operation = operation;
this.limit = limit;
}
public List<Map> getMultiFilterProperties() {
return multiFilterProperties;
}

public void setMultiFilterProperties(List<Map> multiFilterProperties) {
this.multiFilterProperties = multiFilterProperties;
}

@SuppressWarnings("rawtypes")
public List<Map> getProperties() {
return properties;
Expand Down
Loading