Search in sources :

Example 6 with AtlasFullTextResult

use of org.apache.atlas.model.discovery.AtlasSearchResult.AtlasFullTextResult in project incubator-atlas by apache.

the class EntityDiscoveryService method getIndexQueryResults.

private List<AtlasFullTextResult> getIndexQueryResults(AtlasIndexQuery query, QueryParams params, boolean excludeDeletedEntities) throws AtlasBaseException {
    List<AtlasFullTextResult> ret = new ArrayList<>();
    Iterator<Result> iter = query.vertices();
    while (iter.hasNext() && ret.size() < params.limit()) {
        Result idxQueryResult = iter.next();
        AtlasVertex vertex = idxQueryResult.getVertex();
        if (skipDeletedEntities(excludeDeletedEntities, vertex)) {
            continue;
        }
        String guid = vertex != null ? vertex.getProperty(Constants.GUID_PROPERTY_KEY, String.class) : null;
        if (guid != null) {
            AtlasEntityHeader entity = entityRetriever.toAtlasEntityHeader(vertex);
            Double score = idxQueryResult.getScore();
            ret.add(new AtlasFullTextResult(entity, score));
        }
    }
    return ret;
}
Also used : AtlasVertex(org.apache.atlas.repository.graphdb.AtlasVertex) AtlasFullTextResult(org.apache.atlas.model.discovery.AtlasSearchResult.AtlasFullTextResult) AtlasEntityHeader(org.apache.atlas.model.instance.AtlasEntityHeader) AtlasFullTextResult(org.apache.atlas.model.discovery.AtlasSearchResult.AtlasFullTextResult) AtlasSearchResult(org.apache.atlas.model.discovery.AtlasSearchResult) Result(org.apache.atlas.repository.graphdb.AtlasIndexQuery.Result) AttributeSearchResult(org.apache.atlas.model.discovery.AtlasSearchResult.AttributeSearchResult)

Aggregations

AtlasSearchResult (org.apache.atlas.model.discovery.AtlasSearchResult)6 AtlasFullTextResult (org.apache.atlas.model.discovery.AtlasSearchResult.AtlasFullTextResult)6 AttributeSearchResult (org.apache.atlas.model.discovery.AtlasSearchResult.AttributeSearchResult)4 AtlasEntityHeader (org.apache.atlas.model.instance.AtlasEntityHeader)4 MultivaluedMapImpl (com.sun.jersey.core.util.MultivaluedMapImpl)2 Result (org.apache.atlas.repository.graphdb.AtlasIndexQuery.Result)2 AtlasVertex (org.apache.atlas.repository.graphdb.AtlasVertex)2 Test (org.testng.annotations.Test)2 AtlasException (org.apache.atlas.AtlasException)1 AtlasServiceException (org.apache.atlas.AtlasServiceException)1