customMetadataContent property
To search for objects based on the full-text content of custom metadata, you specify the customMetadataContent
property in a query expression. Criteria that use this property find objects only in namespaces that have full-text indexing of custom metadata enabled.
When custom metadata is indexed for full-text searching, the XML is treated as text, not as a structured document. Similarly, the customMetadataContent
property value is treated as text.
To use the customMetadataContent
property to query for any element name, attribute name, element value, or attribute value that matches a text string, use a query expression with this format:
customMetadataContent:text-string
If the text string consists of more than a single string of alphabetic or numeric characters, enclose the entire value in double quotation marks (").
To query for a combination of elements and attribute names and values, use a query expression with either of these formats:
customMetadataContent:"element-name. attribute-name.attribute-value...element-value.element-name" <![CDATA[customMetadataContent:"<element-name attribute-name=attribute-value...>element-value</element-name>"]]>
The two formats are equivalent. The first format is simpler. The second format uses well-formed XML.
When using the second format, enclose both the property and text string in the square brackets that mark the CDATA content, and enclose the text string in double quotation marks ("). The outer square brackets ([ ]) are also required, as are the outside angle brackets and exclamation mark.
To query for the value of a specific element, specify every attribute and attribute value for the element, not just the element name and value.
To query for the value of a specific attribute, regardless of which element it applies to, use this format:
customMetadataContent:"attribute-name.attribute-value"
You can use the asterisk (*) and question mark (?) wildcard characters when specifying customMetadataContent
property values that are not in quotation marks.
Here is some sample custom metadata that you might want to search:
<?xml version="1.0" ?> <weather> <location>Boston</location> <date>20121130</date> <duration unit="secs">180</duration> <temp> <temp_high unit="deg_F">31</temp_high> <temp_low unit="deg_F">31</temp_low> </temp> <velocity> <velocity_high unit="mph">17</velocity_high> <velocity_low unit="mph">14</velocity_low> </velocity> <conditions>partly cloudy</conditions> </weather>
Here are some examples of query expressions that use the customMetadataContent
property to search the XML:
- This query expression finds objects that have custom metadata with an element name, element value, attribute name, or attribute value that contains
Boston
:customMetadataContent:Boston
- This query expression finds objects that have custom metadata that contains the
location
element with a value ofBoston
:customMetadataContent:"location.Boston.location"
- This query expression finds objects that have custom metadata that contains the
velocity_high
element with a value of17
and theunit
attribute with a value ofmph
:customMetadataContent:"velocity_high.unit.mph.17.velocity_high"
- This query expression returns objects that have custom metadata that contains the
conditions
element with a value ofpartly cloudy
:customMetadataContent:"conditions.partly cloudy.conditions"
- This query expression finds objects that have custom metadata that contains the
date
element with a value of20121130
:<![CDATA[customMetadataContent:"<date>20121130</date>"]]>
- This query expression finds objects that have custom metadata that contains the
temp_high
element with a value of31
and theunit
attribute with a value ofdeg_F
:<![CDATA[customMetadataContent:"<temp_high unit=deg_F>31 </temp_high>"]]>"