Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/docs/cleanup-4.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
mspanik committed Mar 1, 2024
2 parents f41a86a + f0cfb42 commit ffb5a55
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 2 deletions.
12 changes: 10 additions & 2 deletions docs/concepts/matching-rules.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,16 @@ However currently the set of matching rules is built-in in midPoint product.

== Query matching

Note that besides in attribute definitions, matching rules can also be used in queries using the tag _<matching>_.
An example:
Note that besides in attribute definitions, matching rules can also be used in queries. In midPoint Query Language, the matching rules are located right behind filter enclosed in square brackets.

[source,midpoint-query]
----
locality =[origIgnoreCase] "Edinburgh"
----
For more information about matching rules in query see xref:./query/midpoint-query-language/introduction.adoc#_matching_rules[matching rules chapter] in introduction to Midpoint Query Language.

In XML query, the matching rules are represented using the tag _<matching>_.
An example for XML query:

.Matching rule specification
[source,xml]
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions docs/concepts/query/midpoint-query-language/errors/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,39 @@ Select version according your midPoint version. +
In this case search in schema "common/common-3" for "LockoutStatusType"

|====

=== Couldn't count objects
image:err-couldnt-count-objects.png[Error couldn't count objects]

This is error message telling that processing of the query failed somehow during processing.

To know why it failed you need to open the error message and see what happened in the messages below.

==== Unknown matching rule 'stringIgnoreCase'

image:err-couldnt-count-objects.png[Error couldn't count objects]

[cols="15h,50" width=85%]
|====
| Request
| Find all users with locality "Edinburgh" ignoring case. Find all with "edinburgh", "EDINBURGH" or "Edinbugh".

| Query
| `locality =[stringIgnoreCase] "Edinburgh"`

| Error message
| Couldn't count objects +
Unknown matching rule 'stringIgnoreCase'.

| Reason
a| The matching rules relate to attribute type. +
locality is of PolystringType and `stringIgnoreCase` matching rule is defined for strings only. +
For polystring you need to use `origIgnoreCase` matching rule.

| Correct query
| `locality =[origIgnoreCase] "Edinburgh"`

| Troubleshooting hints
a| * For more information about matching rules in query see xref:../introduction.adoc#_matching_rules[matching rules chapter] in introduction to Midpoint Query Language.
* List of all matching rules is defined in xref:../../matching-rules.adoc[matching rules] page.

15 changes: 15 additions & 0 deletions docs/concepts/query/midpoint-query-language/introduction.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,21 @@ less filter - All users which will not be valid after 2021
Comparison filters also supports item path on right side of filter.
For example `activation/validFrom > activation/validTo` should return all objects with incorrectly set activations (activation start is after activation end).

[#_matching_rules]
==== Matching rules
Comparison filter can be even more specified by definition of matching rule in the filter.
The syntax of matching rule in query is: `filter[matchingRuleName]`

.Example of matching rules usage
`givenName =[origIgnoreCase] "Adam"`::
query matches all 'Adam', 'adam' or 'ADAM' in givenName
`emailAddress endsWith[stringIgnoreCase] "@test.com"`::
query matches user with email address ending with specific domain.

See different matching rules in the examples above.
There are different matching rules defined for PolyStringType (givenName) and strings (emailAddress).
List of all matching rules is defined in xref:../../matching-rules.adoc[matching rules] page.

==== String filters

[options="header", cols="15,40", width=70]
Expand Down

0 comments on commit ffb5a55

Please sign in to comment.