search function disappeared

I changed from 1.9.2c [unknown] to 1.9.3 dev [10768] and the search function is not available anymore.

I have to admit that I turned the search function off before the upgrade to see the impact on the site speed and forgot to turn it on again before the upgrade. In the newly installed spip I even don't see the option to turn it on again. Wasn't it somewhere under configuration?

May be this had been observed before or someone can show me a way to re-activate this feature. Database manipulation?

Thanks.

On 11/20/07, Barnie <spip@ingberlin.com> wrote:

I changed from 1.9.2c [unknown] to 1.9.3 dev [10768] and the search
function is not available anymore.

Hi I haven't found where to activate the indexation. A new plugin
enables that, but there should be something in the core. You should
post a ticket on http://trac.rezo.net/trac/spip/ (free registration
required : link "connexion" on the top, and "s'inscrire or register"
below the login form)

.Gilles
--

I have to admit that I turned the search function off before the
upgrade to see the impact on the site speed and forgot to turn it on
again before the upgrade. In the newly installed spip I even don't
see the option to turn it on again. Wasn't it somewhere under
configuration?

May be this had been observed before or someone can show me a way to
re-activate this feature. Database manipulation?

Thanks.
_______________________________________________
spip-en@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-en

Hi,

from SPIP 1.9.3, the indexation doesn't exist anymore but the search function is still there. It is based on SQL like, it's therefore more effective and doesn't require to fill another table. Thus it's not an option anymore, it's always there as it doesn't impair SPIP or the database in any way.

Your {recherche} loops should still work :wink:

Pierre

Barnie wrote:

I changed from 1.9.2c [unknown] to 1.9.3 dev [10768] and the search function is not available anymore.

I have to admit that I turned the search function off before the upgrade to see the impact on the site speed and forgot to turn it on again before the upgrade. In the newly installed spip I even don't see the option to turn it on again. Wasn't it somewhere under configuration?

May be this had been observed before or someone can show me a way to re-activate this feature. Database manipulation?

Thanks.

2007/11/20, Pierre Andrews <mortimer.pa@free.fr>:

Hi,

from SPIP 1.9.3, the indexation doesn't exist anymore but the search
function is still there. It is based on SQL like, it's therefore more
effective and doesn't require to fill another table. Thus it's not an
option anymore, it's always there as it doesn't impair SPIP or the
database in any way.

Your {recherche} loops should still work :wink:

Pierre

Hi Pierre:

is this method efficient for big sites, with more than 10.000
articles? Should be interesting make some benchmarks. Do you use like
or match at sql level?

thanks.
martin.

Thank you. I should have found out myself. Sorry for the bother.

Next question: some days ago I read on some spip site about search restricted to the current root sector. Due to the structure of the various spip sites I don't find that article now. Any clue?

On 2007 Nov 20, at 15:22, Pierre Andrews wrote:

Hi,

from SPIP 1.9.3, the indexation doesn't exist anymore but the search
function is still there. It is based on SQL like, it's therefore more
effective and doesn't require to fill another table. Thus it's not an
option anymore, it's always there as it doesn't impair SPIP or the
database in any way.

Your {recherche} loops should still work :wink:

Pierre

Barnie wrote:

I changed from 1.9.2c [unknown] to 1.9.3 dev [10768] and the search
function is not available anymore.

I have to admit that I turned the search function off before the
upgrade to see the impact on the site speed and forgot to turn it on
again before the upgrade. In the newly installed spip I even don't
see the option to turn it on again. Wasn't it somewhere under
configuration?

May be this had been observed before or someone can show me a way to
re-activate this feature. Database manipulation?

Thanks.

_______________________________________________
spip-en@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-en

Martín Gaitán wrote:

Hi Pierre:

is this method efficient for big sites, with more than 10.000
articles? Should be interesting make some benchmarks. Do you use like
or match at sql level?

Hi Martìn,

to be fair, I don't really know the details as I am not using the 1.9.3 myself and am not directly involved in developing the core. I was just reporting what had been said on spip-dev list.

I think the devs did that choice because it would be more efficient than constructing the index table and working out huge joints between this and the article table... but then, I have no proof, you should check on spip-dev@rezo.net archives to find our more.

Pierre

Barnie wrote:

Next question: some days ago I read on some spip site about search restricted to the current root sector. Due to the structure of the various spip sites I don't find that article now. Any clue?

Ok, you want to limit the search to the sector that the user was visiting, so:
1- you need to have a limit on your search look, something like (in recherche.html):
<BOUCLE_articles(ARTICLES) {recherche} {par points} {inverse} {pagination} {branche?}>

{branche?} will tell the loop to limit the returned articles to the one in the specified branch, if an id_rubrique is specified (the ? is there for that)

2- you need the #RECHERCHE form to put the id_rubrique of the root sector in the url parameters when calling the search. To do that, personalize the formulaire/recherche.html template:

<div class="formulaire_spip formulaire_recherche">
<a name="formulaire_recherche" id="formulaire_recherche"></a>
<form action="[(#ENV{lien})]" method="get"><div>
  [(#ENV{lien}|form_hidden)]
  [<input type="hidden" name="lang" value="(#ENV{lang})" />]
  <label for="recherche"><:info_rechercher:></label>
  <input type="text" class="forml" name="recherche" id="recherche" value="[(#ENV{recherche}|sinon{<:info_rechercher:>" onfocus="this.value='';})]" />
[<input type="hidden" name="id_rubrique" value="(#ENV{id_secteur})"/>]
</div>
</form>
</div>

You also have to personalize the php file for the form to get the id_secteur from the context, this is quite easy:

<?php

/***************************************************************************\
  * SPIP, Systeme de publication pour l'internet *
  * *
  * Copyright (c) 2001-2007 *
  * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
  * *
  * Ce programme est un logiciel libre distribue sous licence GNU/GPL. *
  * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. *
\***************************************************************************/

if (!defined("_ECRIRE_INC_VERSION")) return; #securite

// Pas besoin de contexte de compilation

// http://doc.spip.org/@balise_FORMULAIRE_RECHERCHE
function balise_FORMULAIRE_RECHERCHE ($p)
{
  return calculer_balise_dynamique($p, 'FORMULAIRE_RECHERCHE', array('id_secteur'));
}

// http://doc.spip.org/@balise_FORMULAIRE_RECHERCHE_stat
function balise_FORMULAIRE_RECHERCHE_stat($args, $filtres) {
  // Si le moteur n'est pas active, pas de balise
  if ($GLOBALS['meta']["activer_moteur"] != "oui")
    return '';

  // filtres[0] doit etre un script (a revoir)
  else {
    list($id_secteur,$rech) = $args;
    $id_secteur = intval($id_secteur);
    return array($filtres[0], $rech, $id_secteur);
  }
}

// http://doc.spip.org/@balise_FORMULAIRE_RECHERCHE_dyn
function balise_FORMULAIRE_RECHERCHE_dyn($lien, $rech, $id_secteur) {

  if ($GLOBALS['spip_lang'] != $GLOBALS['meta']['langue_site'])
    $lang = $GLOBALS['spip_lang'];
  else
    $lang='';

  return array('formulaires/recherche', 3600,
    array(
      'lien' => ($lien ? $lien : generer_url_public('recherche')),
      'recherche' => _request('recherche'),
      'lang' => $lang,
      'id_secteur' => $id_secteur
    ));
}

?>

Easy hey! :wink:

Pierre