| Configuring the Search Engine
In addition to modifying the look and feel of the templates you can also modify the way the search engine works by modifying the Search Page Template. There are several different ways you can search a field.
RANGE SEARCHING
To search between a range of values create a pulldown for the minimum and maximum values. e.g.: bedrooms [min] [max]. The name of the pulldown should be set to the name of the field it is to be applied to with _min or _max applied to the end. ie: lfield3_min lfield3_max.
KEYWORD SEARCHING
To search for a keyword in a specific field number simply create a form field and add "_keyword" to the end. ie: to search for a keyword in lfield6 setup a text field named "lfield6_keyword".
EXACT MATCH SEARCHING
As keyword searching returns any records that contain that keyword, exact match only returns records that match the query exactly. This is best used to specify exact criteria to match. e.g.: bedrooms: 3, MLS# 1235453, etc. To search for exact matches create a form field and add _match, e.g.: lfield6_match
SEARCH FOR SPECIFIC USER
You can create a pulldown with all the user names by using the placeholder "userlist". You can search for a user or a user keyword with "user_keyword" and "user_match" to match the user name or "user_num" to match the user number.
SORT ORDER
You can specify a sort order for results to be returned in with the following fields:
<input type="hidden" name="sort_order" value="14,abc,forward">
<input type="hidden" name="sort_order" value="14,123,reverse">
The first part of the value ("14") is the field number to sort by, the second part is the type of sorting to do (abc for alphabetical, 123 for numerical) and the third part is the direction to sort in.
RESULTS PER PAGE
You can specify the results to be shown per page with the "perpage" field like so: <input type="hidden" name="perpage" value="10">
MARK NEW LISTINGS AS "NEW"
You can have new listings that have been created or updated in the last few days displayed in a "NEW" templatecell on the search results page by using "marknew" field:
<input type="hidden" name="marknew" value="2">
In this example, any listings created or updated in the last 2 days will be shown as new.
ONLY DISPLAY NEW LISTINGS
You can have the search engine only display recent listings with the "shownew" field allowing users to check what new listings have been added without going through the entire database:
<input type="hidden" name="shownew" value="7">
In the above example only listings created or updated in the last 7 days will be displayed.
NEWLY ADDED LISTINGS
This feature was added in version 2.28.
By default the marknew and shownew functions will find listings that are either created or updated in the last few days. To restrict the search to only newly created listings, add the "check_created" field:
<input type="hidden" name="shownew" value="7">
<input type="hidden" name="marknew" value="2">
<input type="hidden" name="check_created" value="1">
In the above example only listings added in the last 7 days will be displayed, and those added in the last 2 days will be displayed in a "NEW" templatecell. By adding the "check_created" field, only the original listing created date will be searched instead both the original created date and the last modified date.
EUROPEAN NUMBER SUPPORT
This feature was added in version 2.18.
You can force the search engine to treat numbers in European format by setting a field called "euro_numbers". This will cause the search engine to treat commas (,) as decimal identifiers, and periods (.) as unimportant number grouping characters.
<input type="hidden" name="euro_numbers" value="1">
DIFFERENT TEMPLATES
This feature was added in version 2.28.
You can use different templates in your search by setting the field "template". The value is the filename of a template found in your templates/ directory. The search query, search result and single-view templates are specified this way. Note that these different search functions require different types of templates.
<input type="hidden" name="template" value="_search_results_french.html">
Here are some URL-based examples of calling search with templates:
- Show search form (template based on _search_query.html)
- search.cgi?template=_query_new.html
- Search listings (template based on _search_results.html)
- search.cgi?search=1&template=_results_new.html
- View a specific listing (template based on _publish_listing.html)
- search.cgi?view=$listing_num$&template=_listing_new.html
VIEW A SINGLE RECORD
This feature was added in version 2.28.
You can also use search.cgi as a viewer to dynamically view a listing. You have to know the record number of the listing to do this. If you are doing this in a template, you can use the $listing_num$ placeholder. This method of viewing a listing is typically used with templates to present different views of a listing.
search.cgi?view=$listing_num$
The default template used is the _publish_listing.html template. Note that if you specify another template, it must define all the templatecells found in the _publish_listing.html template.
OTHER NOTES
Search form fields that have no value are ignored. So when you create new fields for your search page the default value should be blank.
e.g.: value="".
|