mneethiraj commented on code in PR #784:
URL: https://github.com/apache/atlas/pull/784#discussion_r4328040291


##########
webapp/src/main/java/org/apache/atlas/web/rest/DiscoveryREST.java:
##########
@@ -1030,4 +1032,62 @@ private String getDateTimeString() {
 
         return formatter.format(localDateTime);
     }
+
+    /**
+     * Semantic search using vector similarity.
+     */
+    @POST
+    @Path("/semantic")
+    @Timed
+    public AtlasSearchResult semanticSearch(SemanticSearchParameters 
searchParameters) throws AtlasBaseException {
+        AtlasPerfTracer perf = null;
+
+        try {
+            if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
+                perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, 
"DiscoveryREST.semanticSearch(" + searchParameters + ")");
+            }
+
+            Servlets.validateQueryParamLength("query", searchParameters != 
null ? searchParameters.getQuery() : null);
+
+            return discoveryService.semanticSearch(searchParameters);
+        } finally {
+            AtlasPerfTracer.log(perf);
+        }
+    }
+
+    /**
+     * Find entities similar to the entity identified by guid.
+     */
+    @GET
+    @Path("/similar")
+    @Timed
+    public AtlasSearchResult similarEntities(@QueryParam("guid") String guid,

Review Comment:
   Instead of `guid`, I suggest using the unique attribute of the entity, such 
as `qualifiedName` - as used in `EntityREST.getByUniqueAttributes()`.



##########
webapp/src/main/java/org/apache/atlas/web/rest/DiscoveryREST.java:
##########
@@ -1030,4 +1032,62 @@ private String getDateTimeString() {
 
         return formatter.format(localDateTime);
     }
+
+    /**
+     * Semantic search using vector similarity.
+     */
+    @POST
+    @Path("/semantic")
+    @Timed
+    public AtlasSearchResult semanticSearch(SemanticSearchParameters 
searchParameters) throws AtlasBaseException {
+        AtlasPerfTracer perf = null;
+
+        try {
+            if (AtlasPerfTracer.isPerfTraceEnabled(PERF_LOG)) {
+                perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, 
"DiscoveryREST.semanticSearch(" + searchParameters + ")");
+            }
+
+            Servlets.validateQueryParamLength("query", searchParameters != 
null ? searchParameters.getQuery() : null);
+
+            return discoveryService.semanticSearch(searchParameters);
+        } finally {
+            AtlasPerfTracer.log(perf);
+        }
+    }
+
+    /**
+     * Find entities similar to the entity identified by guid.
+     */
+    @GET
+    @Path("/similar")

Review Comment:
   If `/similar` search requires semantic search index, I suggest using 
`/semantic/similar` as the API endpoint



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to