Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
@Service
public class ElasticCasePrioritySearch implements IElasticCasePrioritySearch {


@Autowired
protected ElasticCaseSearchConfiguration elasticCaseSearchConfiguration;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,11 @@ protected void buildFullTextQuery(CaseSearchRequest request, BoolQueryBuilder qu
// TODO: improvement? wildcard does not scale good
//String searchText = elasticsearchProperties.isAnalyzerEnabled() ? request.fullText : "*" + request.fullText + "*";
String searchText = "*" + request.fullText + "*";
QueryBuilder fullTextQuery = queryStringQuery(searchText).fields(iElasticCasePrioritySearch.fullTextFields());
Map<String, Float> finalFullTextFieldsMap = new HashMap<>(iElasticCasePrioritySearch.fullTextFields());
if (request.fullTextFields != null) {
request.fullTextFields.forEach(finalFullTextFieldsMap::putIfAbsent);
}
QueryBuilder fullTextQuery = queryStringQuery(searchText).fields(finalFullTextFieldsMap);
query.must(fullTextQuery);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -51,6 +52,8 @@ public class CaseSearchRequest implements Serializable {

public Map<String, String> tags;

public Map<String, Float> fullTextFields;

public CaseSearchRequest(Map<String, Object> request) {
if (request.containsKey("process") && request.get("process") instanceof List) {
List<String> processIdentifiers = (List<String>) request.get("process");
Expand Down Expand Up @@ -94,6 +97,17 @@ public CaseSearchRequest(Map<String, Object> request) {
if (request.containsKey("group") && request.get("group") instanceof List) {
this.group = (List<String>) request.get("group");
}
if (request.containsKey("fullTextFields") && request.get("fullTextFields") instanceof Map) {
Map<?, ?> fields = (Map<?, ?>) request.get("fullTextFields");
Map<String, Float> convertedFields = new HashMap<>();
for (Map.Entry<?, ?> field : fields.entrySet()) {
if (!(field.getKey() instanceof String) || !(field.getValue() instanceof Number)) {
throw new IllegalArgumentException("fullTextFields must map strings to numbers");
}
convertedFields.put((String) field.getKey(), ((Number) field.getValue()).floatValue());
}
this.fullTextFields = convertedFields;
}
}

@Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class CaseViewBody extends ViewBody {
private boolean showCreateCaseButton = true;
private String bannedNetsInCreation;
private boolean showMoreMenu = false;
private List<String> fullTextFields;
private boolean allowHeaderTableMode = true;
private List<String> headersMode = new ArrayList<>(List.of("sort", "edit", "search"));
private String headersDefaultMode = "sort";
Expand Down Expand Up @@ -78,6 +79,10 @@ protected ToDataSetOutcome toDataSetInternal(ToDataSetOutcome outcome) {
this.bannedNetsInCreation);
outcome.putDataSetEntry(CaseViewConstants.FIELD_SHOW_MORE_MENU, FieldType.BOOLEAN,
this.showMoreMenu);
if (this.fullTextFields != null) {
outcome.putDataSetEntry(CaseViewConstants.FIELD_FULLTEXT_FIELDS, FieldType.STRING_COLLECTION,
this.fullTextFields);
}
outcome.putDataSetEntry(CaseViewConstants.FIELD_ALLOW_HEADER_TABLE_MODE, FieldType.BOOLEAN,
this.allowHeaderTableMode);
outcome.putDataSetEntry(CaseViewConstants.FIELD_HEADERS_MODE, FieldType.MULTICHOICE_MAP,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ public class CaseViewConstants extends ViewConstants {
public static final String FIELD_ALL_ALLOWED_NETS = "case_all_allowed_nets";
public static final String FIELD_ALLOWED_NETS = "case_allowed_nets";
public static final String FIELD_INHERIT_ALLOWED_NETS = "case_inherit_allowed_nets";
public static final String FIELD_FULLTEXT_FIELDS = "case_fulltext_fields";
}
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,11 @@
<title name="case_inherit_allowed_nets">Inherit allowed nets?</title>
<init>true</init>
</data>
<data type="stringCollection">
<id>case_fulltext_fields</id>
<title name="case_fulltext_fields">Full-text fields</title>
<desc name="case_fulltext_fields_desc">Fields to consider in a full-text search. You can enter fieldId also with a following '.keyword' suffix.</desc>
</data>

<!-- I18NS -->
<i18n locale="sk">
Expand Down Expand Up @@ -440,6 +445,8 @@
<i18nString name="case_headers_sort_mode_active">Aktívny stĺpec pre zoradenie</i18nString>
<i18nString name="case_headers_sort_mode_active_desc">Napríklad: meta-title</i18nString>
<i18nString name="model_title">Konfigurácia zobrazenia prípadov</i18nString>
<i18nString name="case_fulltext_fields">Full-text polia</i18nString>
<i18nString name="case_fulltext_fields_desc">Polia, ktoré sa použijú pre full-text vyhľadávanie. FieldId môžete zadať aj s príponou „.keyword“.</i18nString>
</i18n>
<i18n locale="de">
<i18nString name="create_case_button_title">Schaltflächentitel "Neuer Fall"</i18nString>
Expand Down Expand Up @@ -490,6 +497,8 @@
<i18nString name="case_headers_sort_mode_active">Aktive Spalte zum Sortieren</i18nString>
<i18nString name="case_headers_sort_mode_active_desc">Beispiel: meta-title</i18nString>
<i18nString name="model_title">Konfiguration der Fallansicht</i18nString>
<i18nString name="case_fulltext_fields">Volltextfelder</i18nString>
<i18nString name="case_fulltext_fields_desc">Bei der Volltextsuche zu berücksichtigende Felder. Sie können die fieldId auch mit einem angehängten „.keyword“-Suffix angeben.</i18nString>
</i18n>

<transition>
Expand Down Expand Up @@ -563,7 +572,7 @@
</layout>
</dataRef>
<dataRef>
<id>case_show_more_menu</id>
<id>case_fulltext_fields</id>
<logic>
<behavior>editable</behavior>
</logic>
Expand All @@ -577,7 +586,7 @@
</layout>
</dataRef>
<dataRef>
<id>case_allow_export</id>
<id>case_show_more_menu</id>
<logic>
<behavior>editable</behavior>
</logic>
Expand All @@ -587,7 +596,7 @@
<rows>1</rows>
<cols>1</cols>
<template>material</template>
<appearance>standard</appearance>
<appearance>outline</appearance>
</layout>
</dataRef>
<dataRef>
Expand Down Expand Up @@ -675,14 +684,28 @@
</layout>
</dataRef>
<dataRef>
<id>advanced_content_form</id>
<id>case_allow_export</id>
<logic>
<behavior>editable</behavior>
</logic>
<layout>
<x>0</x>
<y>3</y>
<rows>1</rows>
<cols>1</cols>
<template>material</template>
<appearance>standard</appearance>
</layout>
</dataRef>
<dataRef>
<id>advanced_content_form</id>
<logic>
<behavior>editable</behavior>
</logic>
<layout>
<x>0</x>
<y>4</y>
<rows>1</rows>
<cols>3</cols>
<template>material</template>
<appearance>outline</appearance>
Expand Down Expand Up @@ -1519,6 +1542,20 @@
<appearance>outline</appearance>
</layout>
</dataRef>
<dataRef>
<id>case_fulltext_fields</id>
<logic>
<behavior>visible</behavior>
</logic>
<layout>
<x>0</x>
<y>26</y>
<rows>1</rows>
<cols>1</cols>
<template>material</template>
<appearance>outline</appearance>
</layout>
</dataRef>
</dataGroup>
</transition>
<place>
Expand Down
Loading