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
13 changes: 7 additions & 6 deletions geonode_mapstore_client/client/js/api/geonode/v2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import {
paramsSerializer,
getGeoNodeConfig,
getGeoNodeLocalConfig,
API_PRESET
API_PRESET,
getResourcesSearchIndex
} from '@js/utils/APIUtils';
import merge from 'lodash/merge';
import mergeWith from 'lodash/mergeWith';
Expand Down Expand Up @@ -62,7 +63,7 @@ export const getResources = ({
...getQueryParams({...params, f}, customFilters),
...(q && {
search: q,
search_fields: ['title', 'abstract']
search_index: getResourcesSearchIndex()
}),
...(sort && { sort: isArray(sort) ? sort : [ sort ]}),
page,
Expand Down Expand Up @@ -102,7 +103,7 @@ export const getMaps = ({
...params,
...(q && {
search: q,
search_fields: ['title', 'abstract']
search_index: getResourcesSearchIndex()
}),
...(sort && { sort: isArray(sort) ? sort : [ sort ]}),
page,
Expand Down Expand Up @@ -138,7 +139,7 @@ export const getDatasets = ({
'filter{metadata_only}': false,
...(q && {
search: q,
search_fields: ['title', 'abstract']
search_index: getResourcesSearchIndex()
}),
...(sort && { sort: isArray(sort) ? sort : [ sort ]}),
page,
Expand Down Expand Up @@ -171,7 +172,7 @@ export const getDocumentsByDocType = (docType = 'image', {
...params,
...(q && {
search: q,
search_fields: ['title', 'abstract']
search_index: getResourcesSearchIndex()
}),
...(sort && { sort: isArray(sort) ? sort : [ sort ]}),
'filter{subtype}': [docType],
Expand Down Expand Up @@ -335,7 +336,7 @@ export const getGeoApps = ({
...params,
...(q && {
search: q,
search_fields: ['title', 'abstract']
search_index: getResourcesSearchIndex()
}),
...(sort && { sort: isArray(sort) ? sort : [ sort ]}),
page,
Expand Down
4 changes: 4 additions & 0 deletions geonode_mapstore_client/client/js/utils/APIUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ export const paramsSerializer = () => {
};
};

export const getResourcesSearchIndex = () => {
return getGeoNodeLocalConfig('geoNodeSettings.resourcesSearchIndex');
};

export const API_PRESET = {
CATALOGS: 'catalog_list',
DATASETS: 'dataset_list',
Expand Down
1 change: 1 addition & 0 deletions geonode_mapstore_client/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,6 @@ def resource_urls(request):
"SUPPORTED_DATASET_FILE_TYPES": get_supported_datasets_file_types(),
"RESOURCE_PUBLISHING": getattr(settings, "RESOURCE_PUBLISHING", False),
"ADMIN_MODERATE_UPLOADS": getattr(settings, "ADMIN_MODERATE_UPLOADS", False),
"RESOURCES_SEARCH_INDEX": getattr(settings, "RESOURCES_SEARCH_INDEX", "title_abstract"),
}
return defaults
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
let catalogPagePath = geoNodeSettings.CATALOG_PAGE_PATH;
let isPublishedOptionEnabled = geoNodeSettings.RESOURCE_PUBLISHING || false;
let isApprovedOptionEnabled = geoNodeSettings.ADMIN_MODERATE_UPLOADS || false;
let resourcesSearchIndex = geoNodeSettings.RESOURCES_SEARCH_INDEX || 'title_abstract';
let customFilters = geoNodeSettings.CUSTOM_FILTERS || {
"my-resources": {
"filter{owner.pk}": "{state('user') && state('user').pk}"
Expand Down Expand Up @@ -214,7 +215,8 @@
catalogHomeRedirectsTo: catalogHomeRedirectsTo,
catalogPagePath: catalogPagePath,
isPublishedOptionEnabled: isPublishedOptionEnabled,
isApprovedOptionEnabled: isApprovedOptionEnabled
isApprovedOptionEnabled: isApprovedOptionEnabled,
resourcesSearchIndex: resourcesSearchIndex
}
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@
const url = '/api/v2/resources' +
'?page=' + options.page +
'&search=' + options.value +
'&search_fields=title' +
'&search_fields=abstract' +
'&search_index=' + window.__GEONODE_CONFIG__?.localConfig?.geoNodeSettings?.resourcesSearchIndex +
'&filter{metadata_only}=false';
{% endblock %}
request = $.ajax({
Expand Down