code: func getWorkItemsByFilterExpression(ctx context.Context, db application.DB, filterExpression string, filterParentexists *bool, offset *int, limit *int) ([]workitem.WorkItem, link.WorkItemLinkList, link.AncestorList, error) {
  	var result []workitem.WorkItem
  	var childLinks link.WorkItemLinkList
  	var parents link.AncestorList
  	err := application.Transactional(db, func(appl application.Application) error {
  		var err error
  		// add tree option to query if not already present
  		var reqMap map[string]interface{}
  		err = json.Unmarshal([]byte(filterExpression), &reqMap)
  		if err != nil {
  			return errs.Errorf("error unmarshalling query expression for CSV filtering: %s", filterExpression)
  		}
  		if _, ok := reqMap["$OPTS"]; !ok {
  			reqMap["$OPTS"] = make(map[string]interface{})
  		}
  		// Set "tree-view" to true. We always want tree-view to be enabled
  		(reqMap["$OPTS"].(map[string]interface{}))["tree-view"] = true
  		updatedFilterExpression, err := json.Marshal(reqMap)
  		if err != nil {
  			return errs.Errorf("error adding tree opt to query expression for CSV filtering: %s", filterExpression)
  		}
  		// execute query
  		result, _, parents, childLinks, err = appl.SearchItems().Filter(ctx, string(updatedFilterExpression), filterParentexists, offset, limit)
  		if err != nil {
  			log.Error(ctx, map[string]interface{}{
  				"err":               err,
  				"filter_expression": filterExpression,
  			}, "unable to list the work items")
  			return errs.Wrapf(err, "error executing filter expression for CSV filtering: %s", filterExpression)
  		}
  		return nil
  	})
  	return result, childLinks, parents, err
  }
docs: // getWorkItemsByFilterExpression retrieves Work Items, children and parents for a given expression and parameters