Search in sources :

Example 1 with AtlasIndexQuery

use of org.apache.atlas.repository.graphdb.AtlasIndexQuery in project incubator-atlas by apache.

the class EntityDiscoveryService method searchUsingFullTextQuery.

@Override
public AtlasSearchResult searchUsingFullTextQuery(String fullTextQuery, boolean excludeDeletedEntities, int limit, int offset) throws AtlasBaseException {
    AtlasSearchResult ret = new AtlasSearchResult(fullTextQuery, AtlasQueryType.FULL_TEXT);
    QueryParams params = validateSearchParams(limit, offset);
    AtlasIndexQuery idxQuery = toAtlasIndexQuery(fullTextQuery);
    if (LOG.isDebugEnabled()) {
        LOG.debug("Executing Full text query: {}", fullTextQuery);
    }
    ret.setFullTextResult(getIndexQueryResults(idxQuery, params, excludeDeletedEntities));
    return ret;
}
Also used : QueryParams(org.apache.atlas.query.QueryParams) AtlasIndexQuery(org.apache.atlas.repository.graphdb.AtlasIndexQuery) AtlasSearchResult(org.apache.atlas.model.discovery.AtlasSearchResult)

Example 2 with AtlasIndexQuery

use of org.apache.atlas.repository.graphdb.AtlasIndexQuery in project incubator-atlas by apache.

the class GraphRepoMapperScaleTest method searchWithIndex.

private void searchWithIndex(String key, String value) {
    AtlasGraph graph = TestUtils.getGraph();
    long start = System.currentTimeMillis();
    int count = 0;
    try {
        String queryString = "v.\"" + key + "\":(" + value + ")";
        AtlasIndexQuery query = graph.indexQuery(Constants.VERTEX_INDEX, queryString);
        Iterator<AtlasIndexQuery.Result> result = query.vertices();
        while (result.hasNext()) {
            result.next();
            count++;
        }
    } finally {
        System.out.println("Search on [" + key + "=" + value + "] returned results: " + count + ", took " + (System.currentTimeMillis() - start) + " ms");
    }
}
Also used : AtlasIndexQuery(org.apache.atlas.repository.graphdb.AtlasIndexQuery) AtlasGraph(org.apache.atlas.repository.graphdb.AtlasGraph) CreateUpdateEntitiesResult(org.apache.atlas.CreateUpdateEntitiesResult)

Aggregations

AtlasIndexQuery (org.apache.atlas.repository.graphdb.AtlasIndexQuery)2 CreateUpdateEntitiesResult (org.apache.atlas.CreateUpdateEntitiesResult)1 AtlasSearchResult (org.apache.atlas.model.discovery.AtlasSearchResult)1 QueryParams (org.apache.atlas.query.QueryParams)1 AtlasGraph (org.apache.atlas.repository.graphdb.AtlasGraph)1