This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content
Snippets Groups Projects
Commit 3cea87bb authored by Michael Breu's avatar Michael Breu :speech_balloon:
Browse files

Intermediate commit: Search With ParentId is now supported

parent db4e0284
Branches
Tags
1 merge request!55June Release
......@@ -141,7 +141,7 @@
<dependency>
<groupId>org.codeability.sharing</groupId>
<artifactId>SharingPluginPlatformAPI</artifactId>
<version>0.1.5</version>
<version>0.1.6</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
......
......@@ -21,6 +21,7 @@ import java.util.stream.Stream;
import javax.annotation.PostConstruct;
import javax.ws.rs.NotFoundException;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.codeability.sharing.plugins.api.search.SearchResultDTO;
......@@ -361,6 +362,10 @@ public class MetaDataRepository {
.should(QueryBuilders.prefixQuery(SearchRepositoryConstants.METADATA_FORMATS, term)));
if (formatBuilder.hasClauses())
queryBuilder.must(formatBuilder);
if(!StringUtils.isEmpty(searchInputDTO.getMetadata().getParentId())) {
queryBuilder.must(QueryBuilders.matchQuery(SearchRepositoryConstants.FILE_PARENTID, searchInputDTO.getMetadata().getParentId()));
}
BoolQueryBuilder authorBuilder = QueryBuilders.boolQuery();
if (searchInputDTO.getMetadata().getAuthor() != null)
......@@ -370,7 +375,7 @@ public class MetaDataRepository {
SearchRepositoryConstants.METADATA_PUBLISHER)
.type(MultiMatchQueryBuilder.Type.PHRASE_PREFIX));
if (authorBuilder.hasClauses())
queryBuilder.must(authorBuilder);
queryBuilder.must(QueryBuilders.matchQuery(null, fullTextBuilder));
if (searchInputDTO.getMetadata().getTypes() != null && !searchInputDTO.getMetadata().getTypes().isEmpty()) {
BoolQueryBuilder typeBuilder = QueryBuilders.boolQuery();
......
......@@ -29,6 +29,7 @@ public final class SearchRepositoryConstants {
public static final String METADATA_TYPE = "metadata.type";
public static final String METADATA_LANGUAGE = "metadata.language";
public static final String FILE_PARENTID = "file.parent";
public static final String PROJECT_VISIBILITY = "project.visibility";
public static final String PROJECT_NAMESPACE = "project.namespace";
......
......@@ -45,7 +45,7 @@ public class CheckResource {
if(uo.isEmpty()) {
log.debug("unknown user for triggerInfoMail");
new AccountResource.AccountResourceException("User could not be found");
throw new AccountResource.AccountResourceException("User could not be found");
}
boolean wasSent = mailService.sendInfoMail(uo.get(), true /* even if no content */);
return new MessageDTO(wasSent?"Mail successfully sent to " + uo.get().getEmail():"no relevant content found (or potential mailing problems). No Mail sent to " + uo.get().getEmail());
......
......@@ -66,6 +66,12 @@
</div>
</form>
</div>
<div>
<form name="searchForm" class="form-inline">
<div class="input-group w-100 mt-3"><span jhiTranslate="search.filters.parentId"></span>: {{searchInput.metadata.parentId}}
</div>
</form>
</div>
<div>
<form name="searchForm" class="form-inline">
<div class="nav-item dropdown">
......
......@@ -73,6 +73,10 @@ export class SearchInputComponent implements OnInit, OnDestroy {
debounceTime: SearchInputComponent.DEBOUNCE_TIME,
emptyOn: '',
}),
parentId: qpb.stringParam('p', {
debounceTime: SearchInputComponent.DEBOUNCE_TIME,
emptyOn: '',
}),
};
// add type checkbox support
......
......@@ -8,6 +8,7 @@ export class MetadataSearchInput {
public author: string;
public types: Array<IExerciseType>;
public format: string;
public parentId: string;
public constructor() {
this.keyword = '';
......@@ -17,5 +18,6 @@ export class MetadataSearchInput {
this.author = '';
this.types = [];
this.format = '';
this.parentId = '';
}
}
......@@ -20,6 +20,7 @@ export class SearchInput {
this.metadata.author = value.author;
this.metadata.license = value.license;
this.metadata.format = value.format;
this.metadata.parentId = value.parentId;
this.metadata.naturalLanguage = [];
Object.keys(ILanguages).forEach(typeName => {
......
......@@ -37,7 +37,8 @@
"keywords": "Schlüsselwörter",
"formats": "Formate",
"license": "Lizenz",
"author": "AutorInnen"
"author": "AutorInnen",
"parentId": "Id des übergeordneten Objekts"
}
}
}
......@@ -37,7 +37,8 @@
"keywords": "Keyword(s)",
"formats": "Format(s)",
"license": "License",
"author": "Author(s)"
"author": "Author(s)",
"parentId": "id of parent item"
}
}
}
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