Skip to content

Commit

Permalink
#3043: Add geosearch query for reports
Browse files Browse the repository at this point in the history
  • Loading branch information
ysf-simsoft committed Aug 22, 2020
1 parent 509837f commit ea10a6f
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/java/mil/dds/anet/beans/search/ReportSearchQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ public class ReportSearchQuery extends AbstractSearchQuery<ReportSearchSortBy> {
@GraphQLQuery
@GraphQLInputField
private Boolean sensitiveInfo;
@GraphQLQuery
@GraphQLInputField
private String withinPolygon;

// internal search parameter:
private boolean systemSearch;

Expand Down Expand Up @@ -358,6 +362,14 @@ public void setSensitiveInfo(Boolean sensitiveInfo) {
this.sensitiveInfo = sensitiveInfo;
}

public String getWithinPolygon() {
return withinPolygon;
}

public void setWithinPolygon(String withinPolygon) {
this.withinPolygon = withinPolygon;
}

@JsonIgnore
public boolean isSystemSearch() {
return systemSearch;
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/mil/dds/anet/search/AbstractReportSearcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,17 @@ protected void buildQuery(Set<String> subFields, ReportSearchQuery query) {
}
}

if (query.getWithinPolygon() != null) {
addWithinPolygon(query);
}

addOrderByClauses(qb, query);
}

protected abstract void addTextQuery(ReportSearchQuery query);

protected abstract void addWithinPolygon(ReportSearchQuery query);

protected abstract void addBatchClause(ReportSearchQuery query);

@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ protected void addTextQuery(ReportSearchQuery query) {
qb.addSqlArg("fullTextQuery", qb.getFullTextQuery(text));
}

@Override
protected void addWithinPolygon(ReportSearchQuery query) {
addWithinPolygonMssql("locationUuid", query.getWithinPolygon());
}

@Override
protected void addBatchClause(ReportSearchQuery query) {
addBatchClause(outerQb, query);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import mil.dds.anet.beans.Report;
import mil.dds.anet.beans.lists.AnetBeanList;
import mil.dds.anet.beans.search.ISearchQuery.SortOrder;
import mil.dds.anet.beans.search.LocationSearchQuery;
import mil.dds.anet.beans.search.ReportSearchQuery;
import mil.dds.anet.database.mappers.ReportMapper;
import mil.dds.anet.search.AbstractReportSearcher;
Expand Down Expand Up @@ -43,6 +44,11 @@ protected void addTextQuery(ReportSearchQuery query) {
addFullTextSearch("reports", query.getText(), query.isSortByPresent());
}

@Override
protected void addWithinPolygon(ReportSearchQuery query) {
addWithinPolygonPsql("locationUuid", query.getWithinPolygon());
}

@Override
protected void addBatchClause(ReportSearchQuery query) {
addBatchClause(qb, query);
Expand Down

0 comments on commit ea10a6f

Please sign in to comment.