Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plt 1651 search after #3237

Merged
merged 2 commits into from
Jun 12, 2024
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 @@ -174,12 +174,12 @@ public void addSort(String guid, ArrayList sort) {
if(MapUtils.isEmpty(this.searchMetadata)) {
this.searchMetadata = new LinkedHashMap<>();
}
ElasticsearchMetadata v = this.searchMetadata.getOrDefault(guid, new ElasticsearchMetadata());
v.addSort(sort);
ElasticsearchMetadata sortMetadata = this.searchMetadata.getOrDefault(guid, new ElasticsearchMetadata());
sortMetadata.addSort(sort);
if (this.searchMetadata.containsKey(guid)) {
this.searchMetadata.replace(guid, v);
this.searchMetadata.replace(guid, sortMetadata);
} else {
this.searchMetadata.put(guid, v);
this.searchMetadata.put(guid, sortMetadata);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.apache.atlas.model.discovery;

import com.fasterxml.jackson.annotation.JsonInclude;
import org.apache.commons.collections.MapUtils;

import java.util.HashMap;
Expand All @@ -10,6 +11,8 @@
public class ElasticsearchMetadata {

private Map<String, List<String>> highlights;

@JsonInclude(JsonInclude.Include.NON_NULL)
private ArrayList<Object> sort;

public Map<String, List<String>> getHighlights() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public class SearchParams {
Async async = new Async();
boolean showHighlights;

boolean showSearchMetadata;

public String getQuery() {
return getQuery();
}
Expand Down Expand Up @@ -154,10 +156,14 @@ public String getSearchInput() {
return this.requestMetadata.getSearchInput();
}

public boolean isShowHighlights() {
public boolean getShowHighlights() {
return showHighlights;
}

public boolean getShowSearchMetadata() {
return showSearchMetadata;
}


static class RequestMetadata {
private String searchInput;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1098,10 +1098,11 @@ private void prepareSearchResult(AtlasSearchResult ret, DirectIndexQueryResult i
header.setCollapse(collapse);
}
}

if (searchParams.isShowHighlights()) {
if (searchParams.getShowSearchMetadata()) {
ret.addHighlights(header.getGuid(), result.getHighLights());
ret.addSort(header.getGuid(), result.getSort());
} else if (searchParams.getShowHighlights()) {
ret.addHighlights(header.getGuid(), result.getHighLights());
}

ret.addEntity(header);
Expand Down
Loading