Searching for documents with specific properties

How to construct a query that retrieves documents with specific properties.

Searching for documents with specific properties is very similar to searching for documents with specific words. Instead of using a <key> element to contain your search terms, use a <property> element.

Here is a <key> element> that searches for documents published by Canada NewsWire:

        <key NAME="Publication">
            <elem>Canada NewsWire</elem>
        </key>

And here is a <property> element that searches for documents whose size (in bytes) is within a specified range of values:

        <property NAME="Size">
            <interval>
                <start INCLUSIVE="True">
                    <number>10000</number>
                </start>
                <end INCLUSIVE="True">
                    <number>19999</number>
                </end>
            </interval>

To learn more about the properties that you can search for, look at TEXTMLSERVER_DOCUMENT_PROPERTIES.DTD:

<!-- ################################## -->
<!-- Document properties -->
<!ELEMENT documentproperties (systemproperties, otherproperties)>
<!ELEMENT systemproperties (collection, name, version, size, indexable, textmldoctype, storagetype, mimetype, creatorinfo, modifierinfo)>
<!ELEMENT collection (#PCDATA)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT version (#PCDATA)>
<!ELEMENT size (#PCDATA)>
<!ELEMENT indexable (#PCDATA)>
<!ELEMENT textmldoctype (#PCDATA)>
<!ELEMENT storagetype (#PCDATA)>
<!ELEMENT mimetype (#PCDATA)>
<!ELEMENT creatorinfo (user, time, date)>
<!ELEMENT modifierinfo (user, time, date)>
<!ELEMENT lockowner (#PCDATA)>
<!ELEMENT user (#PCDATA)>
<!ELEMENT comment (#PCDATA)>
<!ELEMENT time (#PCDATA)>
<!ELEMENT date (#PCDATA)>
<!ELEMENT otherproperties (lockinfo?, versionsinfo)>
<!ELEMENT lockinfo (lockowner, user, comment, time, date)>
<!ELEMENT versionsinfo (currentdocumentversion, previousversionscount, previousversionstotalsize)>
<!ELEMENT currentdocumentversion (#PCDATA)>
<!ELEMENT previousversionscount (#PCDATA)>
<!ELEMENT previousversionstotalsize (#PCDATA)>

You can combine a search for specific properties with a search for specific keys, as the sample query below shows.

Sample query

SampleMultiCriteriaQuery.xml retrieves documents that meet two criteria: the publication must be Canada NewsWire; and the size of the document must be within a specified range:

<?xml version="1.0" encoding="UTF-16"?>
<!-- SampleMultiCriteriaQuery.xml -->
<query VERSION="4.5" RESULTSPACE="Publication and Size Results">
    <andkey>
        <key NAME="Publication">
            <elem>Canada NewsWire</elem>
        </key>
        <property NAME="Size">
            <interval>
                <start INCLUSIVE="True">
                    <number>10000</number>
                </start>
                <end INCLUSIVE="True">
                    <number>19999</number>
                </end>
            </interval>
        </property>
    </andkey>
</query>

All sample queries are located in your Program Files directory for TEXTML Server: [...]\IxiaSoft\TextmlServer[version]\SDK\Queries\*.xml.