Package de.cxp.ocs.util
Class SearchParamsParser
java.lang.Object
de.cxp.ocs.util.SearchParamsParser
Utility class to parse search parameters
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic InternalSearchParams
extractInternalParams
(SearchQuery searchQuery, Map<String, String> filters, SearchContext searchContext) static List
<InternalResultFilter> parseFilters
(Map<String, String> filterValues, FieldConfigIndex fieldConfig, Locale locale) Checks the parameter map for valid filters and extracts them into InternalResultFilter objects.static Optional
<InternalResultFilter> parseSingleFilter
(String paramName, String paramValue, FieldConfigIndex fieldConfig, Locale locale) static List
<SortInstruction> parseSortings
(String paramValue, FieldConfigIndex fields) Parses the sorting parameter into a list of enriched Sorting objects.static InternalResultFilter
toInternalFilter
(Field field, String[] paramValues, Locale locale, boolean isIdFilter, boolean negate) static InternalResultFilter
toInternalFilter
(Field field, String paramValue, Locale locale, boolean isIdFilter)
-
Field Details
-
MAX_RESULT_COUNT
public static final int MAX_RESULT_COUNTMax result count as defined by default Elasticsearch setting 'max_result_window'- See Also:
-
ID_FILTER_SUFFIX
- See Also:
-
NEGATE_FILTER_PREFIX
- See Also:
-
-
Constructor Details
-
SearchParamsParser
public SearchParamsParser()
-
-
Method Details
-
extractInternalParams
public static InternalSearchParams extractInternalParams(SearchQuery searchQuery, Map<String, String> filters, SearchContext searchContext) -
parseFilters
public static List<InternalResultFilter> parseFilters(Map<String, String> filterValues, FieldConfigIndex fieldConfig, Locale locale) Checks the parameter map for valid filters and extracts them into InternalResultFilter objects.- Parameters:
filterValues
- parameters as sent in the requestfieldConfig
- the field configurationlocale
- locale for filter value normalization- Returns:
- validated and enriched filter values for internal usage
-
parseSingleFilter
public static Optional<InternalResultFilter> parseSingleFilter(String paramName, String paramValue, FieldConfigIndex fieldConfig, Locale locale) -
toInternalFilter
public static InternalResultFilter toInternalFilter(Field field, String paramValue, Locale locale, boolean isIdFilter) -
toInternalFilter
public static InternalResultFilter toInternalFilter(Field field, String[] paramValues, Locale locale, boolean isIdFilter, boolean negate) -
parseSortings
Parses the sorting parameter into a list of enriched Sorting objects.- Parameters:
paramValue
- the sorting parameter valuefields
- the field configuration- Returns:
- list of validated sortings
-