Search in sources :

Example 1 with FeaturestoreDocType

use of io.hops.hopsworks.common.elastic.FeaturestoreDocType in project hopsworks by logicalclocks.

the class ElasticFeaturestoreBuilder method build.

public ElasticFeaturestoreDTO build(ElasticFeaturestoreRequest req, Integer projectId) throws ElasticException, ServiceException, GenericException {
    checkRequest(req);
    Project project = projectFacade.find(projectId);
    Map<FeaturestoreDocType, Set<Integer>> searchProjects = datasetAccessCtrl.featurestoreSearchContext(project, req.getDocType());
    Map<FeaturestoreDocType, SearchResponse> response = elasticCtrl.featurestoreSearch(req.getTerm(), searchProjects, req.getFrom(), req.getSize());
    DatasetAccessController.DatasetAccessCtrl localProjectOnly = (datasetDetails, projectsCollector) -> projectsCollector.addAccessProject(project);
    ElasticFeaturestoreDTO result = parseResult(response, localProjectOnly);
    result.setFeaturegroupsFrom(req.getFrom());
    result.setTrainingdatasetsFrom(req.getFrom());
    result.setFeaturesFrom(req.getFrom());
    return result;
}
Also used : HopsworksJAXBContext(io.hops.hopsworks.common.util.HopsworksJAXBContext) ProjectFacade(io.hops.hopsworks.common.dao.project.ProjectFacade) FeaturestoreXAttrsConstants(io.hops.hopsworks.common.featurestore.xattr.dto.FeaturestoreXAttrsConstants) Function(java.util.function.Function) Project(io.hops.hopsworks.persistence.entity.project.Project) ArrayList(java.util.ArrayList) Level(java.util.logging.Level) Inject(javax.inject.Inject) TransactionAttributeType(javax.ejb.TransactionAttributeType) Triplet(org.javatuples.Triplet) Text(org.elasticsearch.common.text.Text) TransactionAttribute(javax.ejb.TransactionAttribute) Map(java.util.Map) ElasticException(io.hops.hopsworks.exceptions.ElasticException) SearchResponse(org.elasticsearch.action.search.SearchResponse) HighlightField(org.elasticsearch.search.fetch.subphase.highlight.HighlightField) BiConsumer(java.util.function.BiConsumer) EJB(javax.ejb.EJB) SearchHit(org.elasticsearch.search.SearchHit) Stateless(javax.ejb.Stateless) Set(java.util.Set) ElasticController(io.hops.hopsworks.common.elastic.ElasticController) RESTCodes(io.hops.hopsworks.restutils.RESTCodes) ServiceException(io.hops.hopsworks.exceptions.ServiceException) ElasticFeaturestoreHit(io.hops.hopsworks.common.elastic.ElasticFeaturestoreHit) GenericException(io.hops.hopsworks.exceptions.GenericException) FeaturestoreDocType(io.hops.hopsworks.common.elastic.FeaturestoreDocType) Users(io.hops.hopsworks.persistence.entity.user.Users) Project(io.hops.hopsworks.persistence.entity.project.Project) Set(java.util.Set) FeaturestoreDocType(io.hops.hopsworks.common.elastic.FeaturestoreDocType) SearchResponse(org.elasticsearch.action.search.SearchResponse)

Aggregations

ProjectFacade (io.hops.hopsworks.common.dao.project.ProjectFacade)1 ElasticController (io.hops.hopsworks.common.elastic.ElasticController)1 ElasticFeaturestoreHit (io.hops.hopsworks.common.elastic.ElasticFeaturestoreHit)1 FeaturestoreDocType (io.hops.hopsworks.common.elastic.FeaturestoreDocType)1 FeaturestoreXAttrsConstants (io.hops.hopsworks.common.featurestore.xattr.dto.FeaturestoreXAttrsConstants)1 HopsworksJAXBContext (io.hops.hopsworks.common.util.HopsworksJAXBContext)1 ElasticException (io.hops.hopsworks.exceptions.ElasticException)1 GenericException (io.hops.hopsworks.exceptions.GenericException)1 ServiceException (io.hops.hopsworks.exceptions.ServiceException)1 Project (io.hops.hopsworks.persistence.entity.project.Project)1 Users (io.hops.hopsworks.persistence.entity.user.Users)1 RESTCodes (io.hops.hopsworks.restutils.RESTCodes)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 Set (java.util.Set)1 BiConsumer (java.util.function.BiConsumer)1 Function (java.util.function.Function)1 Level (java.util.logging.Level)1 EJB (javax.ejb.EJB)1 Stateless (javax.ejb.Stateless)1