Query operator

Introduction

Funnelback's query language supports a number of query operators that can be used to enhance a query. The operators modify the name of the CGI query parameters. For example,

query_prox=romeo+juliet

is a proximity query: `romeo juliet` .

The full list of modifiers is:

Modifier Description Query expression
_and And's the terms +term1 +term2
_not Negates the terms -term1 -term2
_or Or [ term1 term2 ]
_orsand Or with scoped And |[ term1 term2 ]
_phrase Phrase "term1 term2"
_prox Proximity `term1 term2`
_sand Scoped And |term1 |term2
_trunc Word truncation *term1* *term2*

Please note - Word truncation is supported only when the -service_volume=low query processor option is set

Example 1: Simple phrase search

This Funnelback template snippet will display a HTML input box that allows the user to search for a particular phrase (via the _phrase modifier).

...
<label for="query_phrase">Search:</label>
<input id="query_phrase"
       type="text" name="query_phrase"
       value="${question.inputParameterMap["query_phrase"]!?html}"
       placeholder="e.g. to be or not to be">
...

Example 2: Funnelback "advanced" search form

The following template snippet is from a sample Funnelback advanced search form. It provides HTML for four text boxes for the user to enter terms to find:

  ...
    <dl>
      <!-- all the words -->
      <dt>
          <label for="query_and">All the words:</label>
      </dt>
      <dd>
          <input type="text"
                 id="query_and"
                 name="query_and"
                 value="${question.inputParameterMap["query_and"]!?html}">
      </dd>

      <!-- the phrase -->
      <dt>
          <label for="query_phrase">The phrase:</label>
      </dt>
      <dd>
          <input type="text"
                 id="query_phrase"
                 name="query_phrase"
                 value="${question.inputParameterMap["query_phrase"]!?html}">
      </dd>

      <!-- any of the words -->
      <dt>
          <label for="query_or">Any of the words:</label>
      </dt>
      <dd>
          <input type="text"
                 id="query_or"                        
                 name="query_or"
                 value="${question.inputParameterMap["query_or"]!?html}">
      </dd>

      <!-- none of the words -->
      <dt>
          <label for="query_not">None of the words:</label>
      </dt>
      <dd>
      <input type="text"
             id="query_not"
             name="query_not"
             value="${question.inputParameterMap["query_not"]!?html}">
      </dd>
    </dl>
   ...

See also