Input Forms

Input forms have a double role. They determine what fields are displayed to the user (what HTML form is presented), and they determine how the parameters entered by the user have to be interpreted.

Consequently, when using query-meta, there are two important variables regarding the forms:

  • render.form: Specifies which form will be presented to the user. For example, as shown in Query Conversion, we've set it to tutorial-form.

It is important to understand the rationale behind these two variables. When a user switches from an advanced form to a simple form, the form used to interpret the query (the advanced form) is different from the form displayed to the user. In particular, Watson™ Explorer Engine will need to properly convert the query from one form to the other if possible.

Elements that you can add to an input form are the following:

  • input or select: Input elements can take any value, while select elements have a limited number of possible values.
  • type attribute: As a convention which is followed in the default display, this attribute specifies what type of form element will be used for the display.
    • default: Text input box for an input element, drop down menu for a select element.
    • hidden: Hidden input. Convenient to pass CGI parameters through. In other words, if you want a CGI parameter to be kept in the URL after the user submits a form, you need to explicitly specify it as a hidden input or select in the form definition.
    • textarea (input only): Textarea form element.
    • radio (select only): Radio buttons.
    • checkbox (select only): Check boxes.

    In Watson Explorer Engine, radio buttons and check boxes (represented in HTML as input tags) are considered to be select elements because they have the same functionality.

  • Select elements carry specific attributes:
    • check-value flag: If set, Watson Explorer Engine will check that the associated CGI parameter value belongs to the set of possible option values and return an error if it does not.
    • multiple flag: If set, the user can select multiple options simultaneously.
  • field attribute: The field associated with this form element.
    • Inputs not associated with any field (for example, the number of documents requested in the Query Conversion) are usually interpreted by the The 'Main' Variable and Associated Macro.
    • Inputs associated with a field will take part in the construction of the structured query, which will be forwarded to the different requested sources.
Note: Non-alphanumeric characters in query words are automatically quoted (addition of double quotation marks) by the query-meta script. This means that any of the quoted words will be handled with phrase logic. For example, the query tim's search would be translated to "tim's" search within the search engine. If this behavior is not wanted, the special characters should be added to the word-chars attribute of your form's query input. For example, to add an apostrophe as a word character to the simple form the query input would be modified as follows:
  <input name="query" word-chars="'" syntax="AND and () CONTAINING CONTENT %field%: + NEAR - NOT NOTCONTAINING NOTWITHIN OR0 quotes regex stem THRU BEFORE FOLLOWEDBY weight wildcard WITHIN WORDS site less-than less-than-or-equal greater-than greater-than-or-equal equal range" field="query" size="50" />

See the schema for a complete specification of forms. For information on fields, click Fields.