Extensive query syntax allows you to find specific documents.
The following list describes the characters that you can use in enterprise search and content mining applications to refine query results.
Query: computer software
Result: This query returns documents that include the term computer and the term software, or something else depending on the semantics implemented in the application.
Query: ~fort
Result: This query finds documents that include the term fort or one of its synonyms (such as garrison and stronghold).
Query: run~
Result: This query finds documents that include the term run, running, or ran because run is the base form of the verb.
Query: +computer +software
Result: This query returns documents that include the term computer and the term software.
Query: computer -hardware
Result: This query returns documents that include the term computer and not the term hardware.
Query: $language::en -url:qa
Result: This query returns documents in the English language minus documents that have URLs with the string qa.
Query: url:com -url:support
Result: This query returns documents that have URLs with the string com minus those documents that have URLs with the string support.
Query: =apples
Result: This query returns documents if and only if they include the plural term apples.
Query: "program files\\ibm"
Result: This query returns documents that contain the phrase program files\ibm.
Query: *:*
Result: This query returns all available documents in the collection.
Query: app*
Result: This query finds documents that include the terms apple, apples, application, and so on because these words begin with app.
Query: DB2 info*
Result: This query finds all documents that contain DB2 followed by a word that begins with info.
Query: title:tech*
Result: This query finds all documents with titles that begin with tech.
Query: m?re
Result: This query returns documents that contain the terms mare, mere, mire, and more.
Use double quotation marks (") to indicate that a document must contain the exact phrase within the double quotation marks for a match to occur. Words inside phrases are never lemmatized.
You can also add wildcard characters (* or ?) within phrases. The wildcard character must be next to a letter or word. Standalone wildcard characters are not supported. Wildcard character support must be enabled in the administration console.
Query: "computer software programming"
Result: This query finds documents that include the exact phrase computer software programming.
Phrases are designated as required by default. Hence the two queries building "new york" and building +"new york" are equivalent. Phrases can also be forbidden (-) and required but insufficient (^).
Query: "app* pea*"
Result: This query finds documents that include the terms apples pears, appears peaceful, appreciate peas, and so on because these words begin with app and pea. This query does not find documents with apples and pears or other such combinations.
Query: "apple * pear"
Result: This query matches apples and pears or apples or pears, but it does not match apples pears.
To search for phrases that contain double quotation marks (") or backslash characters (\), use the backslash character to escape the restricted character. For example, "\"The Godfather\"" or "hardware\\software requirements".
Query: /country/Japan
Result: This query finds documents that include the facet country with the facet value Japan.
Query: /date/2009/1/15 /location/US/California
Result: This query finds documents that include the facet date with the multiple-level facet values 2009, 1, and 15, and the facet location with the multiple-level facet values US and California.
Query: ibm Germany^5.0
Result: This query finds documents that include the terms IBM and Germany, and increases the relevance of these documents by a factor of 5 in the search results.
Query: ibm analytics~0.5
Result: This query does a fuzzy search and finds documents that include the terms IBM and analytics, IBM and analyze, IBM and analysis, and so on.
Do not use plus signs (+) or minus signs (-) within the parentheses.
Query: +computer (hardware OR software)
Query: +computer (hardware | software)
Result: Both of these queries find documents that include the term computer and at least one of the terms hardware or software.
An OR of terms is designated as required (+) by default. Therefore, the previous queries are equivalent to +computer +(hardware | software).
The following list describes keywords that you can use to limit a search to specific documents or specific parts of documents.
Query: computer IN question “software maintenance” IN answer
Result: This query returns documents that contain the term computer in the question view and contain the phrase software maintenance in the answer view.
Query: /keyword$._word.noun/computer IN question IN answer
Result: This query returns documents that include the noun facet with the facet value computer in the intersection of the question and answer views.
Query: (software maintenance) WITHIN 5 IN answer
Result: This query returns documents that contain the words software and maintenance, or matching forms of the words, in any order, within 5 words of each other in the answer view.
Query: @xmlf2::'<title>IBM computers</title>' IN question
Result: This query returns documents that contains the phrase IBM computers in the <title> element of an XML fragment in the question view.
The query ("a" "b" "c") WITHIN 5 INORDER means that the three words must appear in the same order, and in their exact form, within five words of each other. No lemmatization is performed for the terms a, b, or c.
( x y z ) WITHIN 5
("x" y z ) WITHIN SENTENCE
( x "y z") WITHIN SENTENCE
subject:(world star) WITHIN SENTENCE (lemmatization is done of world and star, in any order)
("Hello" "World") WITHIN SENTENCE INORDER (no lemmatization and order is maintained)
Query: (x y z) ANY 2
Result: This query returns documents that contain at least two of the specified query terms.
Do not include the prefix http:// in a site query.
Query: +laptop site:www.ibm.com
Result: This query finds all documents on the www.ibm.com domain that contain the word laptop.
Query: url:support
Result: This query finds documents that have a URL with the word support, such as http://www.ibm.com/support/fr/.
Query: url:support url:fr
Result: This query finds documents that have a URL with the words support and fr in any order.
Query: url:support&fr
Result: This query finds documents that have a URL with the phrase support fr. This query is similar to using double quotation marks to search for an exact phrase.
Query: link:http://www.ibm.com/us
Result: This query finds all documents that include one or more links to the page http://www.ibm.com/us .
Query: lastname:smith div:software
Result: This query returns all documents about employees with the last name Smith (lastname:smith) who work for the Software division (div:software).
Query: (docid:http://www.ibm.com/solutions/us/ OR docid:http://www.ibm.com/products/us/)
Result: This query finds all documents with the URI http://www.ibm.com/solutions/us/ or the URI http://www.ibm.com/products/us/.
http://mycompany.server1.com/hr/ hr
http://mycompany.server2.com/hr/ hr
http://mycompany.server3.com/hr/ hr
http://mycompany.server1.com/finance/ finance
file:///myfileserver1.com/db2/sales/ sale
file:///myfileserver1.com/websphere/sales/ sale
file:///myfileserver2.com/db2/sales/ sale
file:///myfileserver2.com/websphere/sales/ sale
samegroupas:file:///myfileserver2.com/websphere/sales/mypath/mydoc.txt
All
results for this query will have one of the following prefixes:file:///myfileserver1.com/db2/sales/
file:///myfileserver1.com/websphere/sales/
file:///myfileserver2.com/db2/sales/
file:///myfileserver2.com/websphere/sales/
Query: samegroupas:http://www.ibm.com/solutions/us/
Result: This query finds all documents with URIs, in this case URLs, that belong to the same group as http://www.ibm.com/solutions/us/.
Query: facetName::/”Part of Speech”/Noun/”General Noun”
Result: This query finds documents that include the facet General Noun in a content analytics collection.
Query: facetValue::/”Part of Speech”/Noun/”General Noun”/Car
Result: This query finds documents that include the value Car of the facet General Noun in a content analytics collection.
Query: date::/date/Year/2010
Result: This query finds documents that include the value 2010 for the year time scale of the default date facet in a content analytics collection.
Query: date::/modifieddate/Month/200905
Result: This query finds documents that include the value 200905 for the month time scale of the modifieddate date facet in a content analytics collection.
Query: facet::/country/Japan
Result: This query finds documents that include the facet country with the facet value Japan in an enterprise search collection.
Query: facet::/date/2009/1/15 facet::/location/US/California
Result: This query finds documents that include the facet date with the multiple-level facet values 2009, 1, and 15, and the facet location with the multiple-level facet values US and California.
Query: flag::/"Important"
Result: This query finds documents that are flagged as Important.
Query: scope::/TechSupport
Result: This query finds documents that are in the TechSupport scope.
Root
juice
lemon
apple
Query: rulebased::.juice.lemon
Result: This query returns documents that belong to the rule-based category juice.lemon.
To obtain a list of the available source types for a collection, call the getAvailableAttributeValues(Searchable ATTRIBUTE_SOURCE) method of that collection's Searchable object.
Query: $source::DB2 "computer science"
Result: This query finds documents that were added to a collection by the DB2 crawler and that contain the phrase computer science.
To obtain a list of the available language IDs for a collection, call the getAvailableAttributeValues(Searchable.ATTRIBUTE_LANGUAGE) method of that collection's Searchable object.
Query: $language::en "computer science"
Result: This query finds documents in English that contain the phrase computer science.
To obtain a list of the available document types for a collection, call the getAvailableAttributeValues(Searchable.ATTRIBUTE_DOCTYPE) method of that collection's Searchable object.
Query: $doctype::application/pdf "computer science"
Result: This query finds Portable Document Format (PDF) documents that contain the phrase computer science.
Query: $similar::http://www.ibm.com/solutions/us~1.0
Result: This query finds documents that are highly similar to http://www.ibm.com/solutions/us.
Query: #price::=1700 laptop
Result: This query finds documents that contain the term laptop and a price field with a value equal to 1700.
Query: #price::>1700 laptop
Result: This query finds documents that contain the term laptop and a price field with a value greater than 1700.
Query: #price::<1700 laptop
Result: This query finds documents that contain the term laptop and a price field with a value less than 1700.
Query: #price::>=1700 laptop
Result: This query finds documents that contain the term laptop and a price field with a value greater than or equal to 1700.
Query: #price::<=1700 laptop
Result: This query finds documents that contain the term laptop and a price field with a value less than or equal to 1700.
Query: #price::>1700<3900 laptop
Result: This query finds documents that contain the term laptop and a price field with a value greater than 1700 and less than 3900.
Query: #price::>=1700<=3900 laptop
Result: This query finds documents that contain the term laptop and a price field with a value greater than or equal to 1700 and less than or equal to 3900.
Query: #price::>1700<=3900 laptop
Result: This query finds documents that contain the term laptop and a price field with a value greater than 1700 and less than or equal to 3900.
Query: #price::>=1700<3900 laptop
Result: This query finds documents that contain the term laptop and a price field with a value greater than or equal to 1700 and less than 3900.
Query: #date::>"2007-12-01"
Result: This query finds documents that were created or last modified on 1 December, 2007 or later.
ACL constraints string in setACLConstraints method: (michelle_c | dev_group)
ACL constraints string in setACLConstraints method: michelle_c @SecurityContext::'securityContext'
Query: thinkpad
Result: This query finds documents that include the term thinkpad and the security tokens michelle_c or dev_group in the first case, and michelle_c and the specified security context constraints in the second case.
You can create query syntax for two types of opaque terms. An opaque term is one that is expressed and handled by another query language, such as the XML query languages XML Fragment and XPath. XML Fragment can also be used to query UIMA structures. The sign for an opaque term is expressed with @xmlf2:: (XML fragment) or @xmlxp:: (XPath query). The XML fragment or the XPath query is enclosed in single quotation marks (' ').
The expression xmlf2 is used for XML fragments, and xmlxp is used for XPath terms. An opaque term has the following syntax: @syntax_name::'value'. The expression starts with the @ sign, followed by the syntax name (xmlf2 or xmlxp), two colons (::), and a value that is enclosed in single quotation marks (' '). The value parameter is sometimes preceded by -, +, or ^. If you need to use a single quotation mark in the value section of the expression, escape the single quotation by using a backslash (\), for example, \'.
For negative terms, use a minus sign (−) before the @ symbol, for example, -@xmlf2::'<person>michelle</person>'. However, Watson Content Analytics does not accept negative unique query terms. The query -@xmlf2::'<person>michelle</person>' does not return results. To get results, use one positive term in the query, for example, documentation -@xmlf2::'<person>michelle</person>'.
@xmlf2::'<Element>IBM +computers</Element>'
@xmlf2::'<Element>IBM =computers</Element>'
@xmlf2::'<Element>IBM computers~</Element>'
@xmlxp::'personarecord[country contains("Germany") or title contains("IBM")]'
Query: @xmlf2::'<title>"Data Structures"</title>'
Result: This query finds documents that contain the phrase Data Structures within the span of an indexed annotation called title.
The first query uses double quotation marks. The second query uses single quotation marks. However, each query returns the same results. This query syntax looks for occurrences of tag2 exactly $number levels under tag1.
$number is a positive integer. You can use single quotation marks (' ') or double quotation marks (" ") around the numerical value. This query syntax is not applicable to Unstructured Information Management Architecture (UIMA).
@xmlf2::'<author>Albert Camus<.depth value='1'>
<publisher>Carey Press</publisher></.depth></author>'
<author>Albert Camus
<ISBN>002-12345</ISBN>
<country>USA
<publisher>Carey Press</publisher>
</country>
</author>
will not be returned with the example query because the
publisher (<publisher>) element occurs two levels
under the author (<author>) element.You can define words and phrases within attributes, which is the same as the normal terms of the query. However, you can write expressions only of words and phrases, not of tags. These words or phrases support the same features as the normal terms of the query.
Query: @xmlf2::'<author country="USA"></author>'
Result: This query finds documents where the author originates from the USA.
@xmlf2::'<author country="USA">
<firstName>Michelle</firstName>
<lastName>Ropelatto</lastName></author>'
Result: This query finds documents where the author name is Michelle Ropelatto and is from the USA.
Query: @xmlf2::'+"Graph Theory" -network'
Result: This query finds documents that contain the phrase Graph Theory, and do not contain the term network.
@xmlf2::'<book><author>hemingway</author> -<title>old man</title></book>
Result: This query finds documents that contain a book by Hemingway but not the book The Old Man and the Sea.
Query: @xmlf2::'<book><.or><author>Sylvia Plath</author><title>XML -Microsoft</title></.or></book>'
Result: This query finds documents that specify a book whose author is Sylvia Plath or where the title of the book includes the word XML but not Microsoft.
Query: @xmlf2::'<Report+HoldsDuring> +Pakistan +March +Reuters</Report+HoldsDuring>'
Result: This query finds documents from Reuters about events in Pakistan in March that are contained in the concatenated annotation formed by the "Report" and "HoldsDuring" annotations.
Query: @xmlf2::'<Inhibits* Activates>Aspirin</Inhibits*Activates>'
Result: This query finds documents in which Aspirin occurs in both the 'Inhibits' and 'Activates' annotations.
Query: @xmlxp::'/author[@country="USA"]'
Result: This query finds documents in which USA is included in the character string that is the value of the attribute country that is associated with author.
Query: @xmlxp::'book[author ftcontains("Jose Perez") or title ftcontains("XML -Microsoft")]'
Result: This query finds documents that specify a book whose author is Jose Perez or where the title of the book includes the word XML, but not Microsoft.
Query: @xmlxp::'/books//book/name'
Result: This query finds documents that specify a book element as a descendant of a books element and that specify a name element as a direct child of the book.
Query: @xmlxp::'books[booktitle ftcontains("Data Structures")]'
Result: This query finds documents that contain the phrase "Data Structures" within the span of an indexed annotation called "title."