-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathajaxSearch_version_192b.txt
510 lines (306 loc) · 17.4 KB
/
ajaxSearch_version_192b.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
AjaxSearch - version 1.9.2b
Coroico - http://www.modx.wangba.fr
22th of January 2011
1.9.2b and 1.9.2 differences:
AjaxSearch1.9.2 provided with Evo1.0.5 doesn't correct the AJAXSEARCH-82 issue.
and needs to add manually a debug directory if the debug mode is used.
These issues are corrected with AjaxSearch1.9.2b
The release 1.9.2b provide the correction of the following issues:
==== AJAXSEARCH-75 : exactphrase doesn't work when the value is passed thru snippet call
See http://modxcms.com/forums/index.php/topic,55236.0.html
==== AJAXSEARCH-76 : TV names not protected in sql request
See http://modxcms.com/forums/index.php/topic,56696.msg330844.html#msg330844l
==== AJAXSEARCH-77 : where clause for search terms restriction when the searchstring is empty
==== AJAXSEARCH-78 : failed searched never logged
See http://modxcms.com/forums/index.php/topic,53897.msg331714.html#msg331714
==== AJAXSEARCH-79 : tag list now interpreted as tv input list
==== AJAXSEARCH-80 : Incorrect strip function for MODx tags
See http://modxcms.com/forums/index.php/topic,57332.msg331855.html#msg331855
==== AJAXSEARCH-81 : orderBy issue when orderBy field not in sc.content table
==== AJAXSEARCH-82 : can't define configuration file name with "@FILE:" prefix
See http://bugs.modx.com/issues/3533
==== AJAXSEARCH-83 : Searchstring not escaped when logging search request and results
See http://modxcms.com/forums/index.php/topic,57916.0.html
No new features are provided with this release.
=====================================================================================
Previous versions :
- 1.9.1 delivered the 30th of August 2010
- 1.9.0 delivered the 18th of May 2010 (provided with MODx 1.0.4)
- 1.8.5 delivered the 20th of March 2010 (provided with MODx 1.0.3)
- 1.8.4 delivered the 20th of October 2009 (provided with MODx1.0.1)
- 1.8.3a delivered the 12th of July 2009 (provided with MODx1.0.0)
- 1.8.3 delivered the 08th June 2009
- 1.8.2 delivered the 21th April 2009
- 1.8.1 delivered the 13th October 2008 (provided with MODx0.9.6.3)
======================= CHANGES (since 1.8.5) ==================================
==== Renaming of some parameters
For a better and a simpler undertstanding some parameters have been renamed
AS_showForm => showInputForm
AS_landing => landingPage
AS_showResults => showResults
==== Renaming of some $_POST and $_GET variables
AS_search => search
==== Some $_GET variables are now deprecated
FSF_search is now non interpreted
==== &searchWordList deprecated
The option is now set un the input template
==== &resultsPage deprecated
use landingPage rather this deprecated parameter
==== &showMoreResults deprecated
use moreResultsPage rather this deprecated parameter
==== Firebug mode for the debug is deprecated
Usage of the firebug mode for the debug is deprecated
Negatives values : -1, -2, -3 are now unterstood as 1, 2, 3
====================== NEW FEATURES (since 1.8.5) ==============================
==== 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.
==== withTvs Define which Template Variables will be used for the search and display of results.
&withTvs [ [ + | - ] [ : tvlist] ] - by default ''
The parameter withTvs define which Tv will be added as field result for displaying
and in which tv the search will occur. Only text type TV are enabled
e.g:
&withTvs=`tv1,tv2,tv3` - tv1, tv2, Tv3 are added
&withTvs=`+:tv1,tv2,tv3` - tv1, tv2, Tv3 are added
&withTvs=`+` - all tvs of the site are added
&withTvs=`-` - all tvs of the site are added
&withTvs=`-:tv1,tv2,tv3` - all tvs of the site except tv1, tv2, Tv3 are added
&withTvs=`` - no tv added
If &whereSearch contains 'tv' then a tv_value field which contain the concatened
values of all tv of the document is added
So the tv added could be used for filtering with the filter parameter (see &filter)
Like the default site content parameters (pagetitle, longtitle, ...) the
Tvs added 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
IMPORTANT:
arrow button images are provided with the images folder.
use asprev.png, asnext.png or your own images to define your previous and next buttons.
e.g:
.paging1Prev{ width:16px; margin:0 3px 0 0;display:block; float:left; text-indent:-3000px; background:url(images/asprev.png) 0 center no-repeat; }
.paging1Next{ width:16px;display:inline-block;text-indent:-3000px; background:url(images/asnext.png) 0 center no-repeat; }
.paging2More{ margin:10px 10px; padding:8px;background:url(images/asnext.png) 0 center no-repeat;}
==== 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
==== Javscript disabled
define the css class "init" to mask the ajaxSearch_output div when javascript is disabled
e.g:
#ajaxSearch_output.init {
border: none;
background-color: #FFF;
}
#ajaxSearch_output {
font-size:90%;
background-color:#EFEFEF;
border:1px solid #6F9303;
color:black;
width:550px;
z-index:1;
padding:5px;
margin:10px 0 15px 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.
==== Language files updated
Six labels have been added for english & french language files.
Thanks to post the missing labels on the ajaxSearch forum board
Used to display the number of results found:
$_lang['as_resultsTextSingle'] = '%d result found.';
$_lang['as_resultsTextMultiple'] = '%d results found.';
Used to display the total number of results displayed:
$_lang['as_resultsDisplayed'] = 'Displayed: %d';
Used to display the number of results displayed by group:
$_lang['as_grpResultsDisplayedText'] = '(Displaying %d - %d of %d)';
Used by pagingType 1:
$_lang['as_paging1Text'] = '%d - %d / %d';
Used by pagingType 2:
$_lang['as_paging2Text'] = 'Show more %d results';
==== 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 ajaxSearch192.pdf give a quick
overview of AjaxSearch parameters. Thanks to Goldsky for this contribution.
The someCssExamples folder give the search.css file used on the demo site to
style ajaxSearch.
The someConfigsExamples folder provide the configs folder used on the demo
site.
The someTemplatesExamples folder provide some templates used on the demo site.