The final release of
AjaxSearch 1.9.0 can be downloaded
from this page
I will update the repository with it as soon as
Evo 1.0.4 will be delivered.
This is a major release of AjaxSearch. You can found some demos on
the demo site.
As test, I have implemented this release for a site of an association, which collect comments about readings. With this test, a book could be searched among more than 250 commented books.
Hereafter are the new features. Read the ajaxSearch190_version txt for more informations.
A quick
cheasheets is provided in the documentation folder.
Thanks for your feedbacks.
====
Accented characters - search html entities too
The html entity version of the search terms are also searched.
e.g: "ph&eactute;nomène" and "phénomène" are searched when "phénomène" is searched.
====
advSearch - exactphrase
The search with the advSearch parameter set to "exactphrase" returns only results which exactly match to the searched terms.
e.g: search "and" doesn’t return "band" or "land" just "and" terms.
As this search option use REGEXP, the search could be longer than for the other options.
====
Use Google Analytics to track AjaxSearch
AjaxSearch forms could now use $_POST or $_GET
with $_GET, the query parameter in the URL after you search allow you to track the site search with Google Analytics.
To do this, simply replace method="post" by method="get" in the input template used by your ajaxSearch calls.
====
timeLimit - increase the allowed execution time of your script
&timeLimit = [ int | 60 ]
Max execution time in seconds for the AjaxSearch script
0 - If set to zero, no time limit is imposed
Default: 60 - 1 minute.
====
Define which TV you would like as search results
&withTvs [ [ + | - ] [ : tvlist] ] - by default ’’
The parameter withTvs define which Tv will be add as field result.
Only text type are enabled
e.g:
&withTvs=`tv1,tv2,tv3` - tv1, tv2, tv3 are added as result
&withTvs=`+:tv1,tv2,tv3` - tv1, tv2, tv3 are added as results
&withTvs=`+` - all tvs of the site are added as results
&withTvs=`-` - all tvs of the site are added as results
&withTvs=`-:tv1,tv2,tv3` - all tvs of the site except tv1, tv2, tv3 are added as results
&withTvs=`` - no tv defined as result. If &whereSearch contains ’tv’ then a tv_value field
which contain the concatened values of all tv of the document is set as result
So the tv value could be used for filtering and with the filter parameter (see &filter)
Like the default site content parameters (pagetitle, longtitle, ...) the Tvs enabled as results are available with the following placeholders:
[+as.tvname+], [+as.tvnameShow+], [+as.tvnameClass+]
Where tvname is the MODx name of a TV
[+as.tvname+] is the HTML output of your TV
[+as.tvnameShow+] = 1 if the TV is not NULL
[+as.tvnameClass+] :
- ajaxSearch_resultTvname for the non ajax results (&tplResult)
- AS_ajax_resultTvname for the ajax window (&tplAjaxResult)
====
Append the content of some Tvs to your search results with the "tvPhx" parameter
&tvPhx [ [ + | - ] [ : tvlist] ] - by default ’’
The parameter tvPhx define which additional tv will be added as placeholder.
e.g:
&tvPhx=`tv1,tv2,tv3` - tv1, tv2, tv3 are added as placeholders
&tvPhx=`+:tv1,tv2,tv3` - tv1, tv2, tv3 are added as placeholders
&tvPhx=`+` - all tvs of the site are added as placeholders
&tvPhx=`-` - all tvs of the site are added as placeholders
&tvPhx=`-:tv1,tv2,tv3` - all tvs of the site except tv1, tv2, tv3 are added as placeholders
&tvPhx=`` - no tv defined as placeholders.
The following placeholders are anabled with the tv:
[+as.tvname+], [+as.tvnameShow+], [+as.tvnameClass+]
Where tvname is the MODx name of a TV
[+as.tvname+] is the HTML output of your TV
[+as.tvnameShow+] = 1 if the TV is not NULL
[+as.tvnameClass+] :
- ajaxSearch_resultTvname for the non ajax results (&tplResult)
- AS_ajax_resultTvname for the ajax window (&tplAjaxResult)
The tv value could be used with the filter parameter (see &filter)
As withTvs includes the TV as a new field in the select clause of the mysql query, tvPhx append the content of the selected tv after the search and before filer.
====
filter - to exclude unwanted documents of the search
filtering by tv name is now possible
e.g: &filter=`articleTags,volcano,7` display only documents related to volcanoes.
Documents are filtered by the TV ’articleTags’.
IMPORTANT : here the tv should be allowed as result with the withTvs or tvPhx parameters
====
Show introduction message under the input form
&showIntro [ 0 | 1 ]
To show or hide the introduction message displayed with the input form
Default: 1 (show)
====
2 new paging type added
&pagingType [ 0 | 1 | 2 | 3 ] : type of pagination
Default: 1
0: Results Pages 1 | 2 | 3
1: Previous - X-Y /Z - Next
2: X-Y /Z - Show more 10 results
Type 0 for non-ajax mode only
Type 1 for non-ajax and ajax mode
Type 2 for ajax mode (Jquery only)
&tplPaging0 - Chunk to style the paging links - type 0
&tplPaging1 - Chunk to style the paging links - type 1
&tplPaging2 - Chunk to style the paging links - type 2
====
Custom output
&output [ 0 | 1 ]
0 - by default the results are listed below the input form
1 - custom layout:
To place the different AjaxSearch elements where you want, use the following placeholders
[+as.inputForm+] : the input form with the intro message
[+as.results+] : the search results
The parameter &tplLayout is now deprecated
The parameter &tplInput is now used to style the ajaxSearch input form
====
New modifiers for the ajaxSearch Phx parser
to include images in your templates, uses the possible following phx modifiers:
imgwidth : image width - e.g: <img src="[+as.imageArticle+]" width="[+as.imageArticle:imgwidth+]" />
provide the image width
imgheigth : image heigth - e.g: <img src="[+as.imageArticle+]" heigth="[+as.imageArticle:imgheigth+]" />
provide the image height
imgattr : image attributs - e.g: <img src="[+as.imageArticle+]" [+as.imageArticle:imgattr+] />
provide the image attributes as height="xxx" width="yyy"
imgmaxwidth=`length` : image max width - e.g: <img src="[+as.articleImage+]" width="[+as.articleImage:imgmaxwidth=`60`+]" />
limit the width of the image to a maximum. Under this limit, keep the true width
imgmaxheight=`length` : image max height - e.g: <img src="[+as.articleImage+]" height="[+as.articleImage:imgmaxheight=`100`+]" />
limit the height of the image to a maximum. Under this limit, keep the true height
These modifiers are particularly usefull with the ajax mode to help html to determine the height of the AjaxSearch pop-up window
====
Unique id for AjaxSearch instance
&asId [ string | ’’]
Any combination of characters a-z, underscores, and numbers 0-9
This is case sensitive. Default = empty string
This parameter allow distinguish several Ajaxsearch instances on the same page
The id is used to link the snippet calls between them
Choose a short name. eg: "as2"
====
Define categories
&category [ tv_name | ’’]
Any combination of characters a-z, underscores, and numbers 0-9
This is case sensitive. Default = empty string
Name of a TV. The category of a MODx document is provided by this TV content
e.g: &category=`category`
And the "category" tv value of a document could contain for instance Music, Arts, ...
Then the categConfig function should be defined like that:
/*
* categConfig : To define the display of categories (output)
* Add a category as a switch item. 'uncategorized' item describe the results outside of any category
* Add a switch for a new site. The default site is named 'defsite'.
* Allowed config parameters : grpLabel, tplResult, tplAjaxResult, display, extract, rank ...
*/
if(!function_exists('categConfig')) {
function categConfig($site='defsite',$category){
$config = array();
$site = strtolower($site);
$category = strtolower($category);
switch($site) {
case 'defsite':
switch($category){
case 'arts':
$config['grpLabel'] = 'Arts';
$config['tplAjaxResult'] = 'imgResult'; // allow the display of an image
break;
case 'music':
$config['grpLabel'] = 'Music';
$config['tplAjaxResult'] = 'imgAjaxResult'; // allow the display of an image
break;
case 'geography':
$config['grpLabel'] = 'Geography';
$config['tplAjaxResult'] = 'imgAjaxResult';
break;
case '':
$config['grpLabel'] = 'Site wide';
break;
}
}
return $config;
}
}
====
Display the results
&display [ ’mixed’ | ’unmixed’ ]
When results comes from differents subsites (categories), you could choose to display the results mixed or unmixed.
Default: unmixed
Unmixed mode display the results grouped by site or subsite. Each group of results could be paginated.
Mixed mode mixes all the results coming from the differents sites or subsites.
With unmixed mode, results are ordered by the field provided by the first field of the order parameter
e.g: if the subsite "products" has been defined with "product_name, supplier" as order parameter and
the site "employees" has been defined with "job" as order parameter, then the results will be ordered by
"using product_name" value for products and "job" value for "employees".
====
GrpResult & AjaxGrpResult templates
&tplGrpResult - Chunk to style the non-ajax output group result outer
&tplAjaxGrpResult - Chunk to style each output group result outer
====
Label for a group of results
in the configuration file a label could be defined to be be linked with the group of results.
This isn’t a snippet parameter. Only a variable of configuration file.
This variable shouldn’t contain a comma (",")
$config[’grpLabel’] = ’Arts (Painting)’;
====
parents ( in / not in)
&parents [ [ in | not in ] : comma separated list of Ids | ’’ ]
e.g:
&parents=`in:24,25` - do the search in the children documents of documents 24 and 25
&parents=`not in:24,10` - do the search in all documents except in the children documents of documents 24 and 10 documents
&parents=`24,25` means &parents=`in:24,25` (compatible with the 1.8.4 release)
&depth [ 0 < int ] Number of levels deep to retrieve documents
====
documents ( in / not in)
&documents [ [ in | not in ] : comma separated list of Ids | ’’ ]
e.g:
&documents=`in:28,29,30,31` - do the search in the documents 28,29,30,31
&documents=`not in:28,29,30,31` - do the search in all documents except in documents 28,29,30,31
&documents=`28,29,30,31` means &documents=`in:28,29,30,31` (compatible with the 1.8.4 release)
====
extracts
Optimization of the extract algorithm.
====
Introduction of the document
The first characters of the document are displayed when the search occurs with the "nowords" advSearch parameters
or when a filter is applied without any search term.
The length of the indroduction is provided by extractLength parameter (200 characters by default).
The text displayed is the text defined by the extract parameter (content,description,introtext,tv_value by default)
Obviously without any search term highligthed.
====
JQuery & mootools libraries updated with the last versions
Jquery 1.4.2 & mootools 1.2.4 released with ajaxSearch 1.9.0
====
pcre_backtrack limit
The backtrack_limit setting sets the maximum number of bytes preg is allowed to search over before it gives up. This limit is automatically set to 1600000 at the beginning of the script and then restored to the initial value at the end of the script.
====
AjaxSearch Logs manager - Follow up the searches of your users !
A simple module is provided to display in the manager the last searches run by your users. This requires to use the asLog parameter.
Use the file module.ajaxSearchLogManager.txt to set a new module.
====
Documentation folder
In the documentation folder, the cheatSheet ajaxSearch190.pdf gives a quick overview of AjaxSearch parameters. Thanks to Goldsky for this contribution.
The someCssExamples folder gives the search.css file used on the demo site to style ajaxSearch.
The someConfigsExamples folder provides the configs folder used on the demo site.
The someTemplatesExamples folder provides some templates used on the demo site.