-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Started implementation of staged query REST endpoint.
- Loading branch information
Showing
5 changed files
with
112 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
...itrivr/cineast/api/rest/handlers/actions/segment/FindSegmentSimilarStagedPostHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package org.vitrivr.cineast.api.rest.handlers.actions.segment; | ||
|
||
import io.javalin.http.Context; | ||
import io.javalin.plugin.openapi.dsl.OpenApiBuilder; | ||
import io.javalin.plugin.openapi.dsl.OpenApiDocumentation; | ||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
import org.vitrivr.cineast.api.messages.query.QueryStage; | ||
import org.vitrivr.cineast.api.messages.query.QueryTerm; | ||
import org.vitrivr.cineast.api.messages.query.StagedSimilarityQuery; | ||
import org.vitrivr.cineast.api.messages.result.SimilarityQueryResultBatch; | ||
import org.vitrivr.cineast.api.rest.handlers.interfaces.ParsingPostRestHandler; | ||
import org.vitrivr.cineast.standalone.config.ConstrainedQueryConfig; | ||
import org.vitrivr.cineast.standalone.util.ContinuousRetrievalLogic; | ||
|
||
public class FindSegmentSimilarStagedPostHandler implements ParsingPostRestHandler<StagedSimilarityQuery, SimilarityQueryResultBatch> { | ||
|
||
public static final String ROUTE = "find/segments/similar/staged"; | ||
private final ContinuousRetrievalLogic continuousRetrievalLogic; | ||
|
||
private static final Logger LOGGER = LogManager.getLogger(); | ||
|
||
public FindSegmentSimilarStagedPostHandler(ContinuousRetrievalLogic continuousRetrievalLogic) { | ||
this.continuousRetrievalLogic = continuousRetrievalLogic; | ||
} | ||
|
||
|
||
@Override | ||
public OpenApiDocumentation docs() { | ||
return OpenApiBuilder.document() | ||
.operation(op -> { | ||
op.summary("Find similar segments based on the given staged query"); | ||
op.description("Performs a similarity search based on the formulated query stages, executing each subsequent stage on the results of the previous stage"); | ||
op.operationId("findSegmentSimilarStaged"); | ||
op.addTagsItem("Segments"); | ||
}) | ||
.body(inClass()) | ||
.json("200", outClass()); | ||
} | ||
|
||
@Override | ||
public SimilarityQueryResultBatch performPost(StagedSimilarityQuery query, Context ctx) { | ||
ConstrainedQueryConfig config = ConstrainedQueryConfig.getApplyingConfig(query.getConfig()); | ||
|
||
// TODO: Could staged queries be pushed down to DB to optimize? | ||
This comment has been minimized.
Sorry, something went wrong. |
||
for (QueryStage stage : query.getStages()) { | ||
for (QueryTerm term : stage.terms) { | ||
// TODO | ||
} | ||
} | ||
|
||
return null; | ||
} | ||
|
||
@Override | ||
public Class<StagedSimilarityQuery> inClass() { | ||
return StagedSimilarityQuery.class; | ||
} | ||
|
||
@Override | ||
public Class<SimilarityQueryResultBatch> outClass() { | ||
return SimilarityQueryResultBatch.class; | ||
} | ||
|
||
@Override | ||
public String route() { | ||
return ROUTE; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Since the modules can perform arbitrary operations, no, sorry.