Commit b2e17dbc authored by Eirik Alvær's avatar Eirik Alvær

Fixes #2065 - Search functionality now works

parent c014e1d9
package com.nesstar.rest;
import com.nesstar.rest.resources.SearchResource;
import org.eclipse.jetty.server.session.SessionHandler;
import org.eclipse.jetty.servlets.CrossOriginFilter;
......@@ -12,7 +13,6 @@ import com.nesstar.rest.healthchecks.NesstarHealthCheck;
import com.nesstar.rest.resources.CorrelationResource;
import com.nesstar.rest.resources.CubeResource;
import com.nesstar.rest.resources.DownloadResource;
import com.nesstar.rest.resources.QueryResource;
import com.nesstar.rest.resources.RegressionResource;
import com.nesstar.rest.resources.StudyListResource;
import com.nesstar.rest.resources.StudyResource;
......@@ -57,7 +57,7 @@ public final class NesstarDropService extends Service<NesstarDropConfiguration>
environment.addResource(new VariableGroupResource(serverHandler));
environment.addResource(new VariableResource(serverHandler));
environment.addResource(new CubeResource(serverHandler));
environment.addResource(new QueryResource(serverHandler));
environment.addResource(new SearchResource(serverHandler));
environment.addResource(new DownloadResource(serverHandler));
environment.addResource(new VersionResource());
......
......@@ -32,10 +32,11 @@ import com.yammer.metrics.annotation.Timed;
@Path("search")
@Produces(MediaType.APPLICATION_JSON)
public final class QueryResource extends AbstractResource {
public final class SearchResource extends AbstractResource {
private static final int defaultMaxHits = 1000;
private static Map<String, Class<? extends NesstarObject>> supportedReturnTypes;
public QueryResource(ServerHandler serverHandler) {
public SearchResource(ServerHandler serverHandler) {
super(serverHandler);
}
......@@ -106,8 +107,10 @@ public final class QueryResource extends AbstractResource {
query.setStartIndex(startIndex);
}
if (numHits >= 0) {
if (numHits > 0) {
query.setNumberOfHits(numHits);
} else {
query.setNumberOfHits(defaultMaxHits);
}
return getQueryObject(server.search(query));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment