Query operators

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 the terms

+term1 +term2

_not

negate the terms

-term1 -term2

_or

or the terms

[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

Note:

  • Word truncation is supported only when the -service_volume=low query processor option is set, or term at a time mode is used (-daat=0).

  • Scoped and/or (sand and orsand) terms pre-scope the query and do not count towards partial matches. This means that all the results will include the pre-scoped values, then the other terms will be used for partial matches.

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.inputParameters["query_phrase"]?first!?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:

  • all the words ( _and );

  • a phrase ( _phrase );

  • any of the words ( _or );

  • none of the words ( _not ).

 ...
<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.inputParameters["query_and"]?first!?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.inputParameters["query_phrase"]?first!?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.inputParameters["query_or"]?first!?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.inputParameters["query_not"]?first!?html}">
  </dd>
</dl>
...

© 2015- Squiz Pty Ltd