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

beta, Added from and size controls #3304

Closed
wants to merge 4 commits into from
Closed
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 @@ -18,7 +18,6 @@ public class IndexSearchParams extends SearchParams {
private String purpose;
private String persona;
private String queryString;

/*
* Indexsearch includes all relations (if requested with param attributes) even if relationshipStatus is DELETED
* Changing this behaviour to exclude related attributes which has relationshipStatus as DELETED
Expand All @@ -43,6 +42,20 @@ public void setDsl(Map dsl) {
queryString = AtlasType.toJson(dsl);
}

public Integer getFrom() {
if (dsl != null && dsl.containsKey("from")) {
return (Integer) dsl.get("from");
}
return null;
}

public Integer getSize() {
if (dsl != null && dsl.containsKey("size")) {
return (Integer) dsl.get("size");
}
return null;
}

public boolean isAllowDeletedRelations() {
return allowDeletedRelations;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -540,12 +540,8 @@ public static List<String> getPropagatedVerticesIds (AtlasVertex classificationV
}

public static boolean hasEntityReferences(AtlasVertex classificationVertex) {
boolean ret = false;
Iterator edgeIterator = classificationVertex.query().direction(AtlasEdgeDirection.IN).label(CLASSIFICATION_LABEL).edges(1).iterator();
if (edgeIterator != null && edgeIterator.hasNext()) {
ret = true;
}
return ret;
return edgeIterator != null && edgeIterator.hasNext();
}

public static List<AtlasVertex> getAllPropagatedEntityVertices(AtlasVertex classificationVertex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,14 @@ public AtlasSearchResult indexSearch(@Context HttpServletRequest servletRequest,
throw abe;
}

if (parameters.getFrom() > 10000) {
throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "Invalid search query: 'from' parameter is more than 10000, Use search_after parameter for pagination.");
}

if (parameters.getSize() > 20) {
throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "Invalid search query: 'size' parameter is more than 20, 'size' parameter can only be less than equal to 20");
}

if(LOG.isDebugEnabled()){
LOG.debug("Performing indexsearch for the params ({})", parameters);
}
Expand Down
Loading