// Query parses a PQL query out of the request and executes it.
Query parses a PQL query out of the request and executes it.
// Query parses a PQL query out of the request and executes it .
func (api *API) Query(ctx context.Context, req *QueryRequest) (QueryResponse, error) {
	span, ctx := tracing.StartSpanFromContext(ctx, "API.Query")
	defer span.Finish()
	if err := api.validate(apiQuery); err != nil {
		return QueryResponse{}, errors.Wrap(err, "validating api method")
	}
	q, err := pql.NewParser(strings.NewReader(req.Query)).Parse()
	if err != nil {
		return QueryResponse{}, errors.Wrap(err, "parsing")
	}
	execOpts := &execOptions{
		Remote:          req.Remote,
		ExcludeRowAttrs: req.ExcludeRowAttrs, 
		ExcludeColumns:  req.ExcludeColumns,  
		ColumnAttrs:     req.ColumnAttrs,     
	}
	resp, err := api.server.executor.Execute(ctx, req.Index, q, req.Shards, execOpts)
	if err != nil {
		return QueryResponse{}, errors.Wrap(err, "executing")
	}
	return resp, nil
}
func ( api * API ) Query ( ctx context . Context , req * QueryRequest ) ( QueryResponse , error ) { span , ctx := tracing . StartSpanFromContext ( ctx , " " ) defer span . Finish ( ) if err := api . validate ( apiQuery ) ; err != nil { return QueryResponse { } , errors . Wrap ( err , " " ) } q , err := pql . NewParser ( strings . NewReader ( req . Query ) ) . Parse ( ) if err != nil { return QueryResponse { } , errors . Wrap ( err , " " ) } execOpts := & execOptions { Remote : req . Remote , ExcludeRowAttrs : req . ExcludeRowAttrs , ExcludeColumns : req . ExcludeColumns , ColumnAttrs : req . ColumnAttrs , } resp , err := api . server . executor . Execute ( ctx , req . Index , q , req . Shards , execOpts ) if err != nil { return QueryResponse { } , errors . Wrap ( err , " " ) } return resp , nil }
Query parses a PQL query out of the request and executes it.
Query parses a PQL query out of the request and executes it .
// NOTE: Kept for Pilosa 1.x compat. // NOTE: Kept for Pilosa 1.x compat. // NOTE: Kept for Pilosa 1.x compat.