Algolia Undeclared Property Filter - algolia

I'd like to filter Algolia by missing properties, is this possible?
At the moment we are using:
filters:(expires=0 OR expires<1506338742)
Which works fine for content that has the expires property, but not all content does, so they get omitted from the results.
Is there a way of adding an extra condition where property expires is not set/undefined? I have tried a few different variations but can't get it to work, and the documentation doesn't seem to cover this.

Algolia offers no way to filter on the presence of an attribute.
As a result, the solution to your issue depends on the expected results.
Here is one way you could return results that have not expiration attribute.
At indexing time, push another attribute has_expiration along with every record.
This attribute should be boolean that will equal true if expiration should be taken into account or false otherwise.
Then you need to adapt your filters query parameter as follow: filters:(expires=0 OR expires<1506338742) OR has_expiration=0

Related

How does giving query parameter "FilterId" filter the Get Sheet API response of Smartsheet API? I see no difference

I am trying to give a particular filterId with a valid value of a manually created filter on a sheet, but the response however remains the same with and without this filter.
On the UI of the sheet, filtration works exactly fine but I do not see the API response getting filtered out. Am I missing out on something? Do I need to look out for something else? Is my understanding wrong here?
[Postman response][1]
I am expecting the same cells (rows and columns) to appear in API response as well as per the filter applied using filterId.
Specifying the filterId parameter in a GET Sheet request will not change the number of rows that the response includes. A GET Sheet response will always include all rows that the sheet contains, regardless of whether the filterId parameter is specified.
So, what does specifying the filterId parameter in a GET Sheet request do? It makes it so that each row in the GET Sheet response contains an attribute named filteredOut with a boolean value (true or false) to indicate the visibility of that row with the specified filter enabled.
"filteredOut": true indicates that the row is not visible with the specified filter applied
"filteredOut": false indicates that the row is visible with the specified filter applied
If you only want to process the rows that are visible when the specified filter is applied, your code will need to read the value of the filteredOut attribute for each row in the GET Sheet response and only process rows where that attribute value is false.
Finally, please note that for specifying the filterId to result in the behavior I've described above, the (user) account issuing the API request must have access to the filter. If another (user) account created the filter in Smartsheet and didn't make it a shared filter, then they are the only user (account) who will be able to access/use that filter.

Is it possible to query when a specific field changed in Azure DevOps?

I have a DateTime field (MyDTField) in my Azure DevOps instance (I am an admin on it, so I can change its schema if necessary). I would like to write a query that returns any items where the above field (MyDTField) changed in the last 7 days. Is this possible to do?
For e.g. the built in "Changed Date" field allows us to write a similar query, but that returns work times where any field value changed. I want to get items where a specific field changed within a specified time period.
Thanks!
You can try to set up a query like as below to see if it can work as expected.
To view more details, you can see:
Query history and discussion fields
Operators and macros supported for each data type
[UPDATE]
As a workaround, you can try like as below on each of the work item types that have the MyDTField field:
Add another custom Date/Time field, for example "MyDTField Latest change Date" field.
Add a work item rule like this. With this rule, once the MyDTField field changed, the value of the MyDTField Latest change Date field will be automatically changed to the current date/time.
Set up the query like as this. With this query, you will get the list of work items as your expectation.

Filtering a datasource using multi select wild character

Does anyone know if there is a wildcard character in AppMaker that can be used for all possible values for a field in a query?
I currently have a datasource that is being filtered based on the status using a multi-select widget. What I would like to accomplish is when all values have been de-selected I want to load all the records of that datasource without clearing the entire query in case other filters have been applied. I have it working in-a-sense that I have to explicitly construct my query as such:
widget.datasource.query.filters.Status._in = ['Status Value 1','Status Value 2','Status Value 3']
My current solution is loading the correct data when a value is selected and it correctly shows the union of the query as the values are modified. However, it selects all of the values in my multi-select; which I know is how it is supposed to work.
I tried using widget.datasource.query.filters.Status._contains = ''; and changing the assignment value to no avail. I even tried the opposite approach using _notContains
The intended outcome is to have a filtering dashboard appear much like any website where when no filtering is selected all records are displayed. I was hoping to find a wildcard character that would load all of the records. Just trying to find a way to mimic other website filters with all records when none are selected.
Thanks for the time!
So the easiest solution here is to set up your Multiselect as follows:
Options binding:
#models.YourModel.fields.Status.possibleValues
or if you don't have the possible Status values in your model then set your options binding to:
['Status Value 1','Status Value 2','Status Value 3']
Values binding:
#datasource.query.filters.Status._in
Now anytime you select any choices in the multiselect, the query will only include records that include the selected choices. And if you deselect all choices the query will ignore that filter or treat it as an empty array of values, therefore returning all records unless you applied other filters.

Google Directory API Search users by custom field not set

According to the Google Directory API you can create custom fields for users and then search users by those fields.
https://developers.google.com/admin-sdk/directory/v1/guides/search-users
You can search for users matching certain attributes with the
users.list method of the Directory API. This method accepts the query
parameter which is a search query combining one or more search
clauses. Each search clause is made up of three parts:
Field
User attribute that is searched. For example, givenName. Custom
fields can be searched by schemaName.fieldName.
Operator
Test that is
performed on the data to provide a match. For example, the : operator
tests if a text attribute contains a value.
Value
The content of the
attribute that is tested. For example, Jane.
Searching for a boolean value appears to only show users that have been explicitly set true or false. Is it possible to search for users that do not have a set value or search for all values not true or not false?
It appears to have changed. When I search on Google APIs Explorer using
GET https:// www.googleapis.com/admin/directory/v1/users?customer=my_customer&projection=full&key={YOUR_API_KEY}
It returns about 70 results but using
GET https:// www.googleapis.com/admin/directory/v1/users?customer=my_customer&projection=full&query=userData.enabled%3Dfalse&key={YOUR_API_KEY}
returns 1 result and
GET https:// www.googleapis.com/admin/directory/v1/users?customer=my_customer&projection=full&query=userData.enabled%3Dtrue&key={YOUR_API_KEY}
returns no results.
I have about a dozen set to true and the rest set to false. There are only a few that I have not explicitly set to true or false.
It appears that you cannot search for values that aren't set explicitly. The only option is to pull the set values and find the difference between the ones that are set and the ones that aren't. For example using php array_udiff or by iterating through all the users and comparing the values.

Filtering by action_target_id on Facebook Ads API

I am using the Facebook Ads API to try to filter out specific action target ids using the follwowing call:
(account-id)/reportstats?date_preset=yesterday&data_columns=["action_target_name","adgroup_id","adgroup_name","spend","actions","adgroup_objective"]&actions_group_by=["action_target_id", "action_destination"]&filters=[{"field": "action_target_id","type": "contains","value": 'insert id'}]
Every time I try to put in a specific ID, I get an empty data set back. Whenever I change the type to "not_contains", I get every piece of data returned. I've also tried the same with action_destination, but it keeps saying value needs to be numeric even though it a string.
It definitely seems like you can filter by action_target_id because when I tried to filter by something random, it told me that filter doesn't exist.
Can anyone help me please?
Unfortunately these values are nested under the actions fields of the results and filters only work on top level field values.