Query by existence of a field in hibernate search - hibernate-search

I have an index where I need to search whether a field is populated in a class, with what value doesn't matter, just whether it's there or not. Is there any specific way to do this?

Specify a value to be indexed for null values via #Field#indexNullAs() and then use a NOT query with the null value token you've chosen.

Related

How to search on a field that may be empty in zapier

Trying to sync up a postgres record to airtable on create/update. The field has a couple of ids that I would like to check for in airtable to determine whether I should create a new record or update an existing one. The first id (optional_id) I need to search on can possibly be null. This causes the search to fail before it can get to the other id(required_id) that should always be populated. Is there any way I can skip the initial search for optional_id if it turns out to be null in postgres?
My current outline is as follows:
I would use a Formatter > Text > Default Value step in case the input value can be null and then make sure the fallback value is from a record that does not exist.
If further help is needed, feel free to reach out to us here:
https://zapier.com/app/get-help

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.

Dynamic Sorting according to populated value?

There is a table named house which has many-to-many association with location table. Have to sort the list by the value of the location.street. Is there a way to sort the result of the query according to the value of the populated field?
I tried:
House.populateAll().sort("location.street ASC").exec(console.log);
Neither waterline (0.10.22) or sailsjs (v0.11) currently support this.
You would need to process your return variable to reorder the data.
There is a ticket for this at https://github.com/balderdashy/waterline/issues/334

"FindAll" feature in Lucene.net

I have two fields on my web page ie: BookAuthor and BookDescription.On submit,the page searches against lucene index using the given search criteria.
If the user does not type in anything in the two fields and submits the page, how do make Lucene.Net return all the books from my index irrespective of BookAuthor and BookDescription field values?
Thanks!
the correct way to do this is to use a MatchAllDocsQuery:
http://lucene.apache.org/java/2_9_4/api/core/org/apache/lucene/search/MatchAllDocsQuery.html
I'm not sure if this is the correct way but you could add another non nullable term to the index (say BookIsPublished) with a default value and if no search term is entered by the user return all matching items on the BookIsPublished constant field.