Skip to content

Commit

Permalink
Feature search / Identify entry points to enable feature searches.
Browse files Browse the repository at this point in the history
  • Loading branch information
fxprunayre committed Jun 17, 2024
1 parent 933b8c6 commit 4212d1f
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static String build(ServiceContext context, String type, boolean isSearch
}

if (!isSearchingForDraft) {
query.append(" AND (draft:n OR draft:e)");
// query.append(" AND (draft:n OR draft:e OR -_exists_:draft)");
}

final String portalFilter = EsFilterBuilder.buildPortalFilter(node);
Expand Down
5 changes: 3 additions & 2 deletions services/src/main/java/org/fao/geonet/api/es/EsHTTPProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,8 @@ private void call(ServiceContext context, HttpSession httpSession, HttpServletRe
String endPoint, String body,
String selectionBucket,
RelatedItemType[] relatedTypes) throws Exception {
final String url = client.getServerUrl() + "/" + defaultIndex + "/" + endPoint + "?";
String index = request.getParameter("index");
final String url = client.getServerUrl() + "/" + (StringUtils.isNotEmpty(index) ? index : defaultIndex) + "/" + endPoint + "?";
// Make query on multiple indices
// final String url = client.getServerUrl() + "/" + defaultIndex + ",gn-features/" + endPoint + "?";
if (SEARCH_ENDPOINT.equals(endPoint) || MULTISEARCH_ENDPOINT.equals(endPoint)) {
Expand Down Expand Up @@ -686,7 +687,7 @@ private void processResponse(ServiceContext context, HttpSession httpSession,
addRelatedTypes(doc, relatedTypes, context);
}

if (doc.has("_source")) {
if (doc.has("_source") && doc.get("_source").has("documentStandard")) {
ObjectNode sourceNode = (ObjectNode) doc.get("_source");

String metadataSchema = doc.get("_source").get("documentStandard").asText();
Expand Down
20 changes: 10 additions & 10 deletions web-ui/src/main/resources/catalog/js/CatController.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,21 +325,21 @@
{
filter: { match: { "cl_status.key": "superseded" } },
weight: 0.3
},
}
// {
// "filter": { "match": { "cl_resourceScope": "service" } },
// "weight": 0.8
// },
// Start boosting down records more than 3 months old
{
gauss: {
changeDate: {
scale: "365d",
offset: "90d",
decay: 0.5
}
}
}
// {
// gauss: {
// changeDate: {
// scale: "365d",
// offset: "90d",
// decay: 0.5
// }
// }
// }
],
score_mode: "multiply"
},
Expand Down
6 changes: 3 additions & 3 deletions web-ui/src/main/resources/catalog/views/default/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@
advancedMode: false,
from: 1,
to: 20,
selectionBucket: "s101",
selectionBucket: "s101&index=gn-*",
viewerMap: viewerMap,
searchMap: searchMap,
mapfieldOption: {
Expand All @@ -562,7 +562,7 @@
hitsperpageValues: gnSearchSettings.hitsperpageValues,
filters: gnSearchSettings.filters,
defaultParams: {
isTemplate: "n",
// isTemplate: "n",
resourceTemporalDateRange: {
range: {
resourceTemporalDateRange: {
Expand All @@ -576,7 +576,7 @@
sortOrder: sortConfig[1] || ""
},
params: {
isTemplate: "n",
// isTemplate: "n",
resourceTemporalDateRange: {
range: {
resourceTemporalDateRange: {
Expand Down
18 changes: 14 additions & 4 deletions web/src/main/webapp/WEB-INF/data/config/index/features.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"match": "ft_*_s",
"mapping": {
"type": "keyword",
"copy_to": "any"
"copy_to": "any.default"
}
}
},
Expand All @@ -85,7 +85,17 @@
],
"properties": {
"any": {
"type": "text"
"type": "object",
"properties": {
"default": {
"type": "text",
"analyzer": "standard"
},
"common": {
"type": "text",
"analyzer": "standard"
}
}
},
"id": {
"type": "keyword"
Expand All @@ -98,11 +108,11 @@
},
"resourceType": {
"type": "keyword",
"copy_to": "any"
"copy_to": ["any.default"]
},
"resourceTitle": {
"type": "text",
"copy_to": "any",
"copy_to": ["any.default"],
"fields": {
"keyword": {
"type": "keyword",
Expand Down

0 comments on commit 4212d1f

Please sign in to comment.