addedValues Plugin

...Powerful Free! Database Expansion for Manila
logoBottle:

(1 or more words)


Get tropes here!
Click to see internals
Report bug


Land-Rovers of Switzerland

sitepic_lrosscreenshot.gif:
Viewable with Any Browser

Members
Join Now
Login

Search Limiting Query

Introduction

The Search forms option Search limiting query imposes an additional fixed constraint upon a search.

The additional constraint is specified by choosing a query from a menu of queries with compatible Applies To and groupname attributes. The constraint can be applied Before the user specified values search, to reduce the range of potential hits search; or After, to filter the hitlist the user search generates. Which is appropriate is largely a matter of efficiency. If the search limit query does heavy text searching it might be best applied after, as a hitlist is smaller.

In some ways SLQs have the same effect as inserting a hidden field in a search form; but values of hidden fields are visible in the HTML text, while the logic of a Search limiting query remains opaque to the user.

How it works

Search results are always the product of running a query; submitting a search form generates an ephemeral custom query from the non blank form elements. A search limiting query contains text which is either pre-pended or appended to the custom query with an AND operator.

For example, a 2 element form which used variables A and B; which a user fills and submits with values "test" and numeric 2 might generate a query

A="test" and B=2

If you want the search to be done as if a another variable C always had the value "open" , you could use a hidden field in the form. But if you wanted C to be one of several values; or had more complex constraints in mind, you need to use a search Limiting query. For example, if the query were defined as

C = "Open" or C = "Rejected"

the actual custom query generated for the user input test and 2 would be

(C = "Open" or C = "Rejected") AND (A="test" and B=2)

or, for the After case

(A="test" and B=2) AND (C = "Open" or C = "Rejected")