RouteX Document Router Toolkit
 Main Functions Types & Errors Query Language Demo Home

RouteX Queries

RouteX routes documents based upon rules your code sends to the toolkit. These rules are instructions that RouteX uses to tell which documents should be routed. The rules are based upon traditional query operators. The rules can include logical expressions, sentence fragments, or proximity searches. The following is a list of all the operators RouteX supports in this version and an explanation of each.

& expression & expression Requires that both expressions be found in the document.
| expression | expression Requires that either expressions must be found in the document.
!  ! expression Requires that the expression not be found in the document
^ expression ^ expression Requires that either expressions must be found in the document but not both.
( ) ( expression ) Allows subqueries to be grouped.
""  "expression" Requires that the entire phrase found within the quotation marks be found within the document.
M expression M field Requires that the expression be found in the field named field within the given document.
* term* Requires that documents match any term beginning with the term. So "whale*", for example, would match both "whale" and "whales".
? term? Requires that documents match any term beginning with the term and any other character. So "s?n" would match both "sun" and "son" but not "soon".

Query Terms

RouteX stores query terms (the words you are using in your expression) in a hexadecimal format. It does this to enable you to route documents which may not be text based or to deal with foreign languages that don't use standard ASCII encoding. To convert a regular ASCII query to hexadecimal form call rxConvertQuery. If you wish to write your own RouteX supplies the utility functions rxCharToHex and rxHexToChar which convert standard character sized data to and from hexadecimal format. As an example, using rxConvertQuery on the search query "white & whale" would be result in "0x7768697465 & 0x7768616c65". Note how the actual query operators do not get converted and should not be. They should not be. The terms can also contain wildcard character as are typical in many Grep expressions.


Query Operators

RouteX supports all the standard Boolean operators that you are familiar with along with parenthesis for grouping expressions. An example of a Boolean expression would be "( whale & white ) | (spear & sailor )" which would route all documetns that include both white and whale or those documents that include sailor and spear. Using Boolean operators and parenthesis you can generate very complex rules.

In addition to the standard Boolean operator RouteX also recognizes phrases searches. Phrases are a collection of words that have to appear as they do in your query. They are designated as phrases by enclosing them in double quotation marks. For instance "jane went up" would match that phrase exactly and not merely find documents with "jane" "went" and "up". Phrases can be combined with other Boolean expressions.

Proximity searches are like phrase searches, but instead of the words being next to one an other they need only be near one an other. You can specify how close the words can be. To specify a proximity search enter w: followed by the number of words the two words must be within one an other. For instance "car w: 5 red" finds those documents that have the word red within five words of car.



RouteX supports fields within documents. Fields are simply regions of text that are given a special designation that you name yourself. For instance when routing email documents you might wish to give the TO part of the document the field "to" and the FROM part the field "from". You can then search for text that occurs just in those areas. For instance you might wish to route documents sent to "" but not documents that simply mention that address. Fields let you easily do this. What you have done is convert those regions of your document into fields that behave much as fields in a database engine. For more information on fields see rxStartField and rxEndField.

To search based upon a field simply follow your expression with the M operator. For example if you had designated a field called "name" and wanted to route all documents with names of Bob or Frank you might use the following rule. "(bob | frank) M name". Make sure that if you expression is a complex one that you enclode it within parenthesis. Had we used "bob | frank M name" it isn't clear whether only frank is in a field or both bob and frank are in a field. Always use parenthesis where necessary to clarify your queries.

See Also

rxAddQuery, rxConvertQuery, rxStartField, rxEndField, rxProcessWord, rxCharToHex, rxHexToChar


Previous Main Next Home

Copyright 2000 Lextek International