Hello all,<br><br>I need some help. I'm configuring "basic usage" of the search plugin and I encounter this message<br><br>CartoWeb version: 3.4.0 [$Revision: 1.7 $]<br>class: CartocommonException<br>message: Failed executing total SQL query Message: DB Error: unknown error Userinfo: SELECT COUNT(*) FROM () [nativecode=ERROR: subquery in FROM must have an alias<br>
HINT: For example, FROM (SELECT ...) [AS] foo.]<br>Backtrace:<br><br>file: 342 - C:\ms4w\apps\cartoweb3\plugins\search\common\Search.php<br>call: Utils::checkDbError(Object(DB_Error), "Failed executing total SQL query")<br>
<br>file: 269 - C:\ms4w\apps\cartoweb3\plugins\search\client\ClientSearch.php<br>call: DbResultProvider->getResult(Object(SearchRequest))<br><br>file: 265 - C:\ms4w\apps\cartoweb3\client\ClientPluginHelper.php<br>call: ClientSearch->initializeResult(Null)<br>
<br>file: UNKNOWN - UNKNOWN<br>call: ServerCallerHelper->initializeResultHelper(Object(ClientSearch), Object(MapResult))<br><br>....<br><br>This message seems to say for the count in Search.php I need to add an "as foo" at line 342 but I'm not supposed to touch this code : I suppose it works. (If I correct it, it doesn't work too: the GUI plugin search stop) <br>
<br>Someone got an idea about my problem. Does it come from from my configuration files or from a bug from the framework.<br>You'll find below my configuration files search.ini, search.tpl, Search.ajax.js, search_results.tpl and my *.map<br>
<br>I've activated search plugins on both side (server and client), I've inserted the code for the tpl and the ajax in cartoclient.tpl<br><br>############## search.ini #########################<br><br>;name search configuration<br>
dsn = pgsql://user_name:password@localhost:5432/database_name<br>encodingContext = search_parc<br>config.parc_2.provider.type = fulltextTable<br>config.parc_2.provider.table = parc_2<br>config.parc_2.provider.aliases = idnum,idnum,ident,ident,feuille,feuille,co_se_fe,co_se_fe,lieudit,lieudit,tex2,tex2,idu,idu,nature,nature,classe,classe,tex,tex,codm,codm,coar,coar,supf,supf,indp,indp,ncompte,ncompte,proprio,proprio,surf_gra,surf_gra,ctr_surf,ctr_surf,cad_dif,cad_dif,insee,insee,comparc,comparc,touche,touche,grpro,grpro,commune,commune,numprop,numprop,trouv,trouv,plu,plu<br>
<a href="http://config.parc_2.provider.id">config.parc_2.provider.id</a> = gid<br>config.parc_2.provider.columns = gid,ident,ncompte,proprio,<br>config.parc_2.provider.fulltextColumns = ident,ncompte,proprio<br>config.parc_2.provider.sortColumn = ident<br>
config.parc_2.provider.sortDirection = asc<br>config.parc_2.provider.sortPriorities = ident, ncompte, proprio<br>config.parc_2.provider.labels = ident, proprio<br>config.parc_2.formatter.type = smarty<br>config.parc_2.formatter.template = search_results<br>
<br>############## client.ini #########################<br><br>;!!!Do not edit this file, it is generated. Edit the .in instead!!! <br>cartoclientBaseUrl = "<a href="http://www.i-sig.biz:8080/cartoweb3/htdocs">http://www.i-sig.biz:8080/cartoweb3/htdocs</a>" <br>
profile = development<br><br><br>ajaxOn = true<br>mapId = chapareillan<br><br>;Set encoding for files<br><br>EncoderClass.search_parc = EncoderISO<br> <br>showProjectChooser = false<br><br>; ## Plugins ## <br><br>loadPlugins = layerReorder,edit,auth,locate,search<br>
<br>toolbarRendering = outline <br><br>langList = <br><br>toolPickerOn = true<br><br>viewOn = true<br>viewStorage = file<br>viewablePlugins = layers,query,edit,auth,search<br>viewMetas = author<br>viewAuth = all<br><br>
############## extract of myproject.map #########################<br>
<br>
LAYER<br>
STATUS ON<br>
NAME "parc_2"<br>
TYPE POLYGON<br>
CONNECTIONTYPE postgis<br>
CONNECTION "user=user_name password=password host=localhost dbname=database_name"<br>
DATA "the_geom from (select * from parc_2) as foo USING UNIQUE gid USING SRID=27572"<br>
TEMPLATE "ttt"<br>
METADATA<br>
"wms_title" "parc_2"<br>
"exported_values" "recenter_name_string,id_attribute_string"<br>
"recenter_name_string" "ident"<br>
"id_attribute_string" "gid|string" # query<br>
"query_returned_attributes" "gid idnum ident feuille co_se_fe
lieudit tex2 idu nature classe tex codm coar supf indp ncompte proprio
surf_gra ctr_surf cad_dif insee comparc touche grpro commune numprop
trouv"<br>
END<br>
STATUS DEFAULT<br>
TRANSPARENCY 100<br>
PROJECTION<br>
'init=epsg:27572'<br>
END<br>
CLASS<br>
NAME 'parc_2' <br>
STYLE<br>
SYMBOL 0 <br>
SIZE 10 <br>
OUTLINECOLOR 0 0 0<br>
COLOR 255 255 255<br>
END<br>
END<br>
END<br><br>############## search.tpl #########################<br><br><div id="search_div"><br> <fieldset><legend>{t}Recherche parcellaire{/t}</legend> <br/><br> <table width="100%"><br>
<tr><br> <td><br> {t}Parcelle: {/t}<br> </td><br> <td><br> <input type="text" id="search_ident" <br>
name="search_ident" size="13"/> <br> </td><br> </tr><br> <tr><br> <td><br> {t}Proprietaire par compte: {/t}<br>
</td><br> <td> <br> <input type="text" id="search_ncompte" <br> name="search_ncompte" size="13"/> <br>
</td><br> </tr><br> <br> <tr><br> <td><br> {t}Proprietaire par nom: {/t}<br> </td><br>
<td> <br> <input type="text" id="search_proprio" <br> name="search_proprio" size="13"/> <br> </td><br>
</tr><br><br><br><br> </table><br> <p><br> <br> <br> <input type="submit" value="{t}Search{/t}" class="form_button"<br>
onclick="javaScript: CartoWeb.trigger('Search.DoIt'); return false;"/><br> <br> <input type="hidden" id="search_config" name="search_config" value="parc_2" /><br>
<input type="hidden" id="search_sort_column" name="search_sort_column" value="ident"/><br> <input type="hidden" id="search_sort_direction" name="search_sort_direction" value="asc" /><br>
<input type="hidden" id="search_number" name="search_number" value="10"/><br><br><br> <div id="search_results_div"></div><br> </p><br>
</fieldset><br> </div><br><br>############## search_results.tpl #########################<br><br>{if $table->numRows > 0}<br> <table class="yourCssClass"><br> <tr><br>
<th>{t}Id{/t}</th><br> {foreach from=$table->columnIds item=column}<br> <th> <a href="JavaScript: order('{$column}');">{t}{$column}{/t}</a></th> <br>
{/foreach}<br> </tr><br> <br> {foreach from=$table->rows item=row}<br> <tr><br> <td>{$row->rowId}</td><br> {foreach from=$row->cells item=value}<br>
<td><a href="JavaScript: recenter('{$row->rowId}');">{$value}</a></td><br> {/foreach}<br> </tr><br> {/foreach}<br> <br> </table><br>
<br>{else}<br> {t}No results{/t}<br>{/if}<br><br>############## Search.ajax.js #########################<br><br>AjaxPlugins.Search = {<br> <br> handleResponse: function(pluginOutput) {<br> //should be the same value as the input search_config<br>
if (pluginOutput.htmlCode.parc_2)<br> $('search_results_div').innerHTML = pluginOutput.htmlCode.parc_2;<br><br> <br> } <br>};<br><br> /*<br> * Search plugin's Actions<br> */<br>
<br> AjaxPlugins.Search.Actions = {};<br><br> AjaxPlugins.Search.Actions.DoIt = {<br><br> buildPostRequest: function(argObject) {<br> return AjaxHandler.buildPostRequest();<br> }<br> };<br><br> function order(column) {<br>
<br> if (column != $('search_sort_column').value) {<br> $('search_sort_column').value = column;<br> $('search_sort_direction').value = 'asc';<br> } else {<br> if ($('search_sort_direction').value == 'asc') {<br>
$('search_sort_direction').value = 'desc';<br> } else {<br> $('search_sort_direction').value = 'asc';<br> }<br> }<br><br> CartoWeb.trigger('Search.DoIt')<br>
}<br><br> function recenter(id){<br> if ($('search_config').value == 'parc_2') {<br> //id to recenter, be sure there is a hidden input with that name and <br> //id in your template! if not, add it<br>
$('id_recenter_ids').value = id;<br><br> /* if the search database table name is the same as the related layer <br> to recenter on, you can set it as below<br> be sure there is a hidden input with that name and id in your template! <br>
if not, add it */<br> $('id_recenter_layer').value = $('search_config').value;<br><br> /* do not use the recenter_scale parameter if you recenter on ids, <br> only use it with recenter on x,y.<br>
you can set the recenter scale in location.ini on server side */<br><br> /* do not use the recenter_doit parameter if you recenter on ids,<br> only use it with recenter on x,y. */<br><br> CartoWeb.trigger('Location.Recenter');<br>
} <br> }<br> <br> function search(config) {<br> <br> $('search_config').value = config;<br> if (config == 'parc_2') {<br> $('search_number').value = 10;<br> }<br> <br>
CartoWeb.trigger('Search.DoIt');<br><br><br>Thanks for any help<br><br>Thomas G<br>