3

I want to build a search query for Google domain users using users.list Google Directory API. I tried to build a query according docs, which will select all users with givenName or familyName starts e.g. on letter "m".
I wrote the query: givenName:m* or familyName:m*, but it doesn't work.
Only givenName:m* familyName:m* works but it inserts "and" operator between clauses.
In docs stays:

Multiple clauses are separated by whitespace and are implicitly joined by an "and" operator.

Can I only write a query with the implicit "and" operator? Is there any way how to write it using "or"?

michal-husak
  • 153
  • 14

2 Answers2

1

After some time experimenting with the API I have found out that I really don't need {{PREFIX}}* or some operators to accomplish my goal.

If you want to search all the users whose given or family name starts e.g. on letter "m", just put a single m (without field name e.g. "givenName:") into the query parameter. It seems that API implicitly searches in all domain users' givenName and familyName fields. It also searches in a substring (before "@") of all email fields (e.g. martin@example.com).

If you put word "example" in the query, it'll gives you all users with email field something@example.com.

It is possible that if you put only some string without any specified fields, the API may also searches in any other field, but I didn't find in which.

I don't know if this is a bug or a feature, but I know it partially gives an answer to my question.

michal-husak
  • 153
  • 14
0

You have to use uppercase:

givenName:m* OR familyName:m*
qtxo
  • 1,378
  • 12
  • 12
  • You are right, it is not working. But my point is the use of "OR" vs "or" (invalid). You can edit your question to correct it and avoid more misunderstandings. – qtxo Jun 20 '15 at 05:03