oneof (replacement character choice)
Use the <oneof>
element to
search for a word or string that contains at least one of a list of a strings.
Unlike the <anystr>
element, the
replacement string in the search value is restricted to a list of acceptable strings.
Each acceptable string is defined by a <choice>
element
The following sample query retrieves all documents that contain any word that:
- Begins with "th".
- Ends with "ing".
- Has one of "ink", "" (an empty string), or "row" as the string between "th" and "n".
<?xml version="1.0" encoding="utf-16"?>
<!-- oneofQuery.xml -->
<query VERSION="4.5" RESULTSPACE="oneofQuery">
<key NAME="FullText">
<elem>
th<oneof>
<choice>ink</choice>
<choice></choice>
<choice>row</choice>
</oneof>ing
</elem>
</key>
</query>
Note:
- Only these three words will trigger the retrieval of a document: "thinking", "thing", or "throwing".
- Words such as "thrashing", "thriving", or "thanking" will not trigger the retrieval of a document.
The following sample query retrieves all documents that contain any string that:
- Begins with "Susan".
- Ends with "Anthony".
- Has " " (a space) or "B." in between "Susan" and "Anthony".
Thus, this query would retrieve documents containing "Susan B. Anthony" or "Susan Anthony" within the <Names> element.
<?xml version="1.0" encoding="utf-16"?>
<!-- oneofQuery.xml -->
<query VERSION="4.5" RESULTSPACE="oneofQuery">
<key NAME="Names">
<elem>
Susan<oneof>
<choice> </choice>
<choice> B. </choice>
</oneof>Anthony
</elem>
</key>
</query>