Hi everybody
Find below some thoughts regarding the possible improvements of AjaxSearch. Thanks for your comments and for voting (look at pools in the same sub-forum).
1/
AjaxSearch templating :
Use the chunkie class and allows the use of PHx to extend how is displayed AS output (input form and ouput results).
For the moment the current specification for the 1.8 are the followings:
&tplLayout // chunck to style the ajaxSearch input form and layout. By default a file : ’templates/layout.tpl.html’;
&tplResults // chunck to style the non-ajax output results (outer). By default ’templates/results.tpl.html’;
&tplResult // chunck to style the non-ajax output results. By default : ’templates/result.tpl.html’;
&tplAjaxResults // chunck to style the ajax mode output results (outer). By default : ’templates/results.tpl.html’;
&tplAjaxResult // chunck to style the ajax mode output results. By default : ’templates/result.tpl.html’;
2/
Improve the extract mechanism
For the moment if you search for instance : china wall you get one extract for china and one other extract for wall, which could be the same !
In any case the extract outputs are merged to facilitate the reading. And the split of the sentence could occur anywhere in the sentence.
Even between two bytes of a multi-byte UTF-8 character.
3/
Improve the config file parameter intialisation
The config file is included after the parameter initialisation, which cause an overwrite of values passed in the snippet call. It will be better to keep the values passed thru the snippet call and overwrite with the config file values only the non-initialised parameters.
4/
Restrict the &parents and &documents parameter with a filter
For instance like Ditto filter parameter or more simply by adding the list of filtered document id.
5/
user functions to strip input search terms and output search results
Provide some mechanisms to call user functions to strip input search terms and/or to strip output search results
6/
Open the search to other tables
I plan to provide a sort of precompiler which takes in input a description of tables (json format) where to search and output a set of search variables, which will used in the configuration file. Search variables are the following:
- $select
- $from
- $orlike
- $andnotlike
- $ifid
by default these variables will be defined (only) for site_content as follow:
// SELECT:
$select = "sc.id, sc.pagetitle, sc.description "
// FROM:
$from = "site_content sc, documents_group dg LEFT JOIN documents_group dg ON sc.id = dg.document";"
// WHERE:
$orlike = " (sc.pagetitle LIKE '%word%' OR sc.description LIKE '%word%') ";
$andnotlike = " (sc.pagetitle NOT LIKE '%word%' AND sc.description NOT LIKE '%word%') ";
$ifid = "sc.id IN ({$listIDs}) AND (ISNULL(dg.document_group) OR dg.document_group IN ({$docgrp})) "
AND sc.published=1 AND sc.searchable=1 AND sc.deleted=0 AND sc.hidemenu=$hm" ;In a first step, so long that the precompiler isn’t ready, skilled contributors could provide, in a library, the relevant set of variables to cover the main cases. For instance :
search in Jot content tables, search in Maxigallery tables, ...
And a tool to check on a demo site that the set of variables is correct and give the awaited results, could be also provided.
For the output, names of output informations like [+as.pagetitle+], [+as.longtitle+] ... could be defined by a parsing of the $select variable