Sun Java System Web Server 6.1 SP9 Administrator's Guide

Search Query Operators

The following table contains the list of search query operators:

Table 18–1 Search Query Operators

Operator 

Description 

Examples 

AND

  • Adds mandatory criteria to the search.

  • Finds documents that have all of the specified words.

Antarctica AND mountain climb  

Finds only documents containing both Antarctica and mountain climb plus all the stemmed variants, such as mountain climbing.

<CONTAINS>

  • Finds documents containing the specified words in a document field. The words must be in the exact same sequential and contiguous order.

  • You can use wildcards. Only alphanumeric values.

  • Does not rank documents for relevance

Title <CONTAINS> higher profit  

Finds documents containing the phrase higher profit in the title. Ignores documents with profits higher in the title.

<ENDS>

  • Finds documents in which a document field ends with a certain string of characters.

  • Does not rank documents for relevance

Title <ENDS> draft 

Finds documents with titles ending in draft.

equals (=)

Finds documents in which a document field matches a specific date or numeric value  

Created = 6-30-06  

Finds documents created on June 30, 2006. 

greater than (>)

Finds documents in which a document field is greater than a specific date or numeric value. 

Created > 6-30-06  

Finds documents created after June 30, 2006.  

greater than or equal to (>=)

Finds documents in which a document field is greater than or equal to a specific date or numeric value. 

Created >= 6-30-06  

Finds documents created on or after June 30, 2006.  

less than (<)

Finds documents in which a document field is less than a specific date or numeric value. 

Created < 6-30-06 Finds documents created before June 30, 2006.  

less than or equal to (<=) 

Finds documents in which a document field is less than or equal to a specific date or numeric value. 

Created <= 6-30-06 Finds documents created on or before June 30, 2006.  

<MATCHES>

  • Finds documents in which a string in a document field matches the character string you specify.

  • Ignores documents that contain partial matches.

  • Does not rank documents for relevance.

<MATCHES> employee  

Finds documents containing employee or any of its stemmed variants such as employees.  

<NEAR>

Finds documents that contain the specified words. The closer the terms are to each other in the document, the higher the document's score. 

stock <NEAR> purchase  

Finds any document containing both stock and purchase, but gives a higher score to a document that has stock purchase than to one that has purchase supplies and stock up.  

<NEAR/N>

Finds documents in which two or more specified words are within N number of words from each other. N can be an integer up to 1000. Also ranks the documents for relevance based on the words' proximity to each other. 

stock <NEAR> purchase 

  • Finds documents containing the phrases stock purchase and purchase stock

  • Ignores documents containing phrases like purchase supplies and stock up because stock and purchase do not appear next to each other.

  • When N is 2 or greater, finds documents that contain the words within the range and gives a higher score for documents which have the words closer together.

NOT

Finds documents that do not contain a specific word or phrase.  


Note –

You can use NOT to modify the OR or the AND operator.


surf AND NOT beach  

Finds documents containing the word surf but not the word beach. 

OR

  • Adds optional criteria to the search.

  • Finds any document that contains at least one of the search values.

apples OR oranges  

Finds documents containing either apples or oranges.  

<PHRASE>

Finds documents that contain the specified phrase. A phrase is a grouping of two or more words that occur in a specific order. 

<PHRASE> (rise "and" fall)  

Finds documents that include the entire phrase rise and fall. The and is in quotes to force the search to interpret it as a literal, not as an operator.  

<STARTS>

  • Finds documents in which a document field starts with a certain string of characters.

  • Does not rank documents for relevance

Title <STARTS> Corp  

Finds documents with titles starting with Corp, such as Corporate and Corporation.  

<STEM>

(English only)  

Finds documents that contain the specified word and its variants.  

<STEM> plan  

Finds documents that contain plan, plans, planned, planning, and other variants with the same meaning stem. Ignores similarly spelled words such as planet and plane that don't come from the same stem.  

<SUBSTRING>

  • Finds documents in which part or all of a string in a document field matches the character string you specify.

  • Similar to <MATCHES>, but can match on a partial string

  • Does not work with wildcards.

  • Does not rank documents for relevance.

 

<SUBSTRING> employ  

Finds documents that can match on all or part of employ, so it can succeed with ploy.  

<WILDCARD>

  • Finds documents that contain the wildcard characters in the search string. You can use this to get words that have some similar spellings but which would not be found by stemming the word.

  • Some characters, such as * and ?, automatically indicate a wildcard-based search, so you don't have to include the word <WILDCARD>

<WILDCARD> plan 

  • Finds documents that contain plan, plane, and planet as well as any word that begins with plan, such as planned, plans, and planetopolis.

  • See the next section for more details and examples.

<WORD>

Finds documents that contain the specified word.  

<WORD> theme  

Finds documents that contain theme, thematic, themes, and other words that stem from theme.