php-frontend Digest 13 May 2006 19:39:36 -0000 Issue 122
Topics (messages 962 through 968):
XML template
962 by: Yannick Warnier
Re: Webboard: Using suggest=yes with php front-end
963 by: mjoh090.actrix.co.nz
Webboard: Thanks to Yannick Warnier for the solution
enabling 'Suggest' feature using PHP frontend
964 by: nobody.mnogosearch.org
Webboard: Ispell fuzzy-search not working
965 by: nobody.mnogosearch.org
Webboard: Section headings in search.htm customizable?
966 by: nobody.mnogosearch.org
967 by: Yannick Warnier
968 by: mjoh090.actrix.co.nz
Administrivia:
To subscribe to the digest, e-mail:
<php-frontend-digest-subscribe mnogosearch.org>
To unsubscribe from the digest, e-mail:
<php-frontend-digest-unsubscribe mnogosearch.org>
To post to the list, e-mail:
<php-frontend mnogosearch.org>
------------------------------------------------------------
----------
Hi there,
I have rewritten the search.htm file to generate a very
basic XML
structure which can then be passed over to some other server
to display
the results in a kind of RPC architecture.
The idea is to be able, on the client side of this RPC
exchange, to
filter the results by user.
I'm still cleaning up the code at the moment but if anybody
wants it,
feel free to ask (I will send you a zip once it's been
cleaned).
This still uses the PHP extension (1.96) and might benefit
from some
improvements in the long term, but it serves my needs right
now as I had
to find a way to a very specific problem which I have
mentioned here
before: on RedHat Fedora Core, I cannot manage to have the
PHP extension
to work, so I am forced to use it on a different server
(Debian in this
case, which works perfectly) and send the results over to my
website
server.
Yannick
Fantastic!
Thanks very much Yannick. Your fix worked like a dream.
Mark
> Le lundi 08 mai 2006 à 15:03 +0000, nobody mnogosearch.org a écrit :
>> Author: Mark
>> Email: mjoh090 actrix.co.nz
>> Message:
>> The $WS variable is being recognised as simply $W
which is the variable
>> for displaying Search results. This explains the
extra 'S' at the end of
>> the suggestion. I am using php-frontend-1.96 and
mnogosearch 3.2.38.
>>
>> changing the variable allocation for Suggestion in
the search.php file -
>> (if (!$found) {
>> $ws='';
>> if ((Udm_Api_Version() >= 30233) &&
($suggest=='yes')) {
>>
$ws=Udm_Get_Agent_Param_Ex($udm_agent,'WS');
>> })
>>
>> does not help.
>>
>
> Hello Mark,
>
> The PHP frontend has not been updated much recently. A
long time ago, I
> have submitted a patch for the word suggestion.
>
> Here is a copy of the e-mail I sent about that. I think
it should solve
> your problem.
>
>
> Le lundi 24 octobre 2005 à 21:14 +0300, Sergey
Kartashoff a écrit :
>> Hello.
>>
>> Monday, October 24, 2005, 9:00:03 PM, you wrote:
>>
>> YW> I also have some updates to suggest
considering the Word
> Suggestion
>> YW> feature (using $ws if I remember well).
I'll send that here as
> soon as I
>> YW> get a chance.
>>
>> ok, i will wait till your update.
>
> OK, so to use the "Word suggestion" feature
(this is mentionned in the
> mnogosearch search.htm file), you have to specify
>
> Suggest yes
>
> in search.htm, but you also have to launch the indexer
with the option
> -Ewordstat in order to make it work.
>
> But the php frontend doesn't handle that, so to make
it work, you need
> to add the $ws parameter inside the print_template()
function in
> template.inc.
>
> To do this, I added the $ws parameter on line 352
(approximately) like
> this:
>
> global $nav, $wordinfo, $ws, $doclang, $doccharset,
$storedocurl;
>
> and on line 376
>
> $str=ereg_replace('\$\(WS\)', $ws, $str);
>
> Then the suggestion actually appears when you search
for a word that
> doesn't give any result but that has a close match in
the database.
>
> It also looks like, inside search.htm, you should
change this line:
>
> Did you mean <b><a
href="?q=$%(WS)">$(WS)</a></b> ?
>
> By removing the '%' character:
>
> Did you mean <b><a
href="?q=$(WS)">$(WS)</a></b> ?
>
> That works for me, and it is a very nice feature to
have in the search
> interface.
>
> Yannick
>
>
>
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: php-frontend-unsubscribe mnogosearch.org
> For additional commands, e-mail: php-frontend-help mnogosearch.org
>
>
Author: Mark
Email: mjoh090 actrix.co.nz
Message:
Hello Mark,
>
> The PHP frontend has not been updated much recently. A
long time ago, I
> have submitted a patch for the word suggestion.
>
> Here is a copy of the e-mail I sent about that. I think
it should solve
> your problem.
>
>
> Le lundi 24 octobre 2005 à 21:14 +0300, Sergey
Kartashoff a écrit :
>> Hello.
>>
>> Monday, October 24, 2005, 9:00:03 PM, you wrote:
>>
>> YW> I also have some updates to suggest
considering the Word
> Suggestion
>> YW> feature (using $ws if I remember well).
I'll send that here as
> soon as I
>> YW> get a chance.
>>
>> ok, i will wait till your update.
>
> OK, so to use the "Word suggestion" feature
(this is mentionned in the
> mnogosearch search.htm file), you have to specify
>
> Suggest yes
>
> in search.htm, but you also have to launch the indexer
with the option
> -Ewordstat in order to make it work.
>
> But the php frontend doesn't handle that, so to make
it work, you need
> to add the $ws parameter inside the print_template()
function in
> template.inc.
>
> To do this, I added the $ws parameter on line 352
(approximately) like
> this:
>
> global $nav, $wordinfo, $ws, $doclang, $doccharset,
$storedocurl;
>
> and on line 376
>
> $str=ereg_replace('\$\(WS\)', $ws, $str);
>
> Then the suggestion actually appears when you search
for a word that
> doesn't give any result but that has a close match in
the database.
>
> It also looks like, inside search.htm, you should
change this line:
>
> Did you mean <b><a
href="?q=$%(WS)">$(WS)</a></b> ?
>
> By removing the '%' character:
>
> Did you mean <b><a
href="?q=$(WS)">$(WS)</a></b> ?
>
> That works for me, and it is a very nice feature to
have in the search
> interface.
>
> Yannick
>
>
>
Reply: <http://www.mnogosearch.org/board/message.php?id=18014&g
t;
Author: Mark
Email: mjoh090 actrix.co.nz
Message:
you say upload your search.htm, so do you have administrator
access to the server? If you do then the following
suggestion applies.
Your problem sounds like a php error as you suggest. This
probably has already occured to you, so appologies if it
has, but I think it might be usefull to make php error
logging visible to see if there isnt any new error apart
from the usual undefined udm variables that, unlike this new
Ispell-induced error, is not fatal. If you have not yet done
so, it might be usefull to compare the set of errors you get
pre and post Ispell activation.
I can't remember if php compiles with display_errors = off
by default, but if it does, then there may be someone
reading this that is new to php that may not know how to
make errors visible on the webpage which is more convenient
than checking a log file. So to whom it may concern - in the
php.ini file change display_errors = off to display_errors =
on and restart your webserver.
I recently implemented Ispell fuzzy-search and it works
fine. If you have not yet fixed the problem Sam, and if you
are able to access the php.ini file, then it may be useful
to post here the php errors that you get.
Reply: <http://www.mnogosearch.org/board/message.php?id=18015&g
t;
Author: Mark
Email: mjoh090 actrix.co.nz
Message:
Is it possible to define template sections like
<!--notFound--> <!--/notFound--> etc, that can
then targeted with the print_template() function in
search.php.
print_template('notfound') prints out the code between
<!--notFound--> <!--/notFound-->. The not found
action as I understand it is defined in search.php file.
when the search meets a criterior the appropriate templates
(print_template('X')) are printed.
Currently I have the suggest feature in the
<!--noquery--> section of the search.htm template.
When the suggestion returns empty, the string "Did you
mean ?" is still printed. I would like to isolated
the expression of suggest to when $WS is not empty. I would
define this in search.php, but need to either use a
pre-existing section that may not be needed (eg
<!--error-->...) or create a custom section that can
be targeted with print_template (eg
print_template('suggest') that targets code between
<!--suggest--> <--/suggest-->).
Is it possible to create custom sections in search.htm that
can be targetted in this way?
Mark
Reply: <http://www.mnogosearch.org/board/message.php?id=18016&g
t;
Le vendredi 12 mai 2006 à 17:17 +0000, nobody mnogosearch.org a écrit :
> Author: Mark
> Email: mjoh090 actrix.co.nz
> Message:
> Is it possible to define template sections like
<!--notFound--> <!--/notFound--> etc, that can
then targeted with the print_template() function in
search.php.
>
> print_template('notfound') prints out the code
between <!--notFound--> <!--/notFound-->. The
not found action as I understand it is defined in
search.php file. when the search meets a criterior the
appropriate templates (print_template('X')) are printed.
>
> Currently I have the suggest feature in the
<!--noquery--> section of the search.htm template.
When the suggestion returns empty, the string "Did you
mean ?" is still printed. I would like to isolated
the expression of suggest to when $WS is not empty. I would
define this in search.php, but need to either use a
pre-existing section that may not be needed (eg
<!--error-->...) or create a custom section that can
be targeted with print_template (eg
print_template('suggest') that targets code between
<!--suggest--> <--/suggest-->).
>
> Is it possible to create custom sections in search.htm
that can be targetted in this way?
Yes Mark, it is possible.
If you have a look at template.inc, which contains the
read_template()
and the print_template() code, I am pretty sure you'll
understand how it
works.
Basically read_template() reads the whole template and
prepares the
different sections by putting them into an array. Then when
print_template is called with a section, that specific
section of the
array is printed after the corresponding elements have been
replaces (\
$Q replaced by $query for example).
If you add a <!--suggest--> section, there should be
no problem in
adding the corresponding sections in read_template() and
print_template() to give you the expected results.
The php-frontend is, to me, awfully coded (with loads of
global
variables instead of nice, explicit, parametered call, no
documentation
at all and too much switches to check for different versions
of the
mnogosearch binaries) but I don't really have time to
improve it and it
looks like apart from 3-4 people here, not much people are
interested
into maintaining this frontend (hence the patch I sent so
long ago for
the suggest feature and that never made it on the website).
Yannick
Hi Yannick,
I agree that the code for the php frontend could be
streamlined. I am
surprised that with the emphasis on backward compatibility
that they did
not make sure that the code was compatible with php 5 when
set to use
super globals only (As of PHP 5.0.0, the long PHP predefined
variable
arrays can be disabled with the register_long_arrays
directive). I had an
absolute devil of a time trying to get the php backend to
work, and
eventually was driven by frustration to checking the code
that I
discovered used predefined php arrays (eg HTTP_SERVER_VARS
and other
HTTP_*_VARS) and had no redundancy built in to accommodate
the exclusive
use of php superglobals (eg $_SERVER).
I am frankly a little surprised that this search engine is
not more
popular. The ability to index pages dynamically built from a
database is a
feature not very many other free search engines provide - if
any. It is a
pity that the documentation is not more comprehensive and I
think that
possibly many initially interested users become frustrated
and abandon
trying to get mnogosearch to work simply because the
documentation is
virtually useless.
Thanks very much for the info Yannick. I'll try it out and
let you know
how it goes.
Mark
> Le vendredi 12 mai 2006 à 17:17 +0000, nobody mnogosearch.org a écrit :
>> Author: Mark
>> Email: mjoh090 actrix.co.nz
>> Message:
>> Is it possible to define template sections like
<!--notFound-->
>> <!--/notFound--> etc, that can then targeted
with the print_template()
>> function in search.php.
>>
>> print_template('notfound') prints out the code
between <!--notFound-->
>> <!--/notFound-->. The not found action as I
understand it is defined in
>> search.php file. when the search meets a criterior
the appropriate
>> templates (print_template('X')) are printed.
>>
>> Currently I have the suggest feature in the
<!--noquery--> section of
>> the search.htm template. When the suggestion
returns empty, the string
>> "Did you mean ?" is still printed. I
would like to isolated the
>> expression of suggest to when $WS is not empty. I
would define this in
>> search.php, but need to either use a pre-existing
section that may not
>> be needed (eg <!--error-->...) or create a
custom section that can be
>> targeted with print_template (eg
print_template('suggest') that targets
>> code between <!--suggest-->
<--/suggest-->).
>>
>> Is it possible to create custom sections in
search.htm that can be
>> targetted in this way?
>
> Yes Mark, it is possible.
> If you have a look at template.inc, which contains the
read_template()
> and the print_template() code, I am pretty sure you'll
understand how it
> works.
> Basically read_template() reads the whole template and
prepares the
> different sections by putting them into an array. Then
when
> print_template is called with a section, that specific
section of the
> array is printed after the corresponding elements have
been replaces (\
> $Q replaced by $query for example).
>
> If you add a <!--suggest--> section, there should
be no problem in
> adding the corresponding sections in read_template()
and
> print_template() to give you the expected results.
>
> The php-frontend is, to me, awfully coded (with loads
of global
> variables instead of nice, explicit, parametered call,
no documentation
> at all and too much switches to check for different
versions of the
> mnogosearch binaries) but I don't really have time to
improve it and it
> looks like apart from 3-4 people here, not much people
are interested
> into maintaining this frontend (hence the patch I sent
so long ago for
> the suggest feature and that never made it on the
website).
>
> Yannick
>
>
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: php-frontend-unsubscribe mnogosearch.org
> For additional commands, e-mail: php-frontend-help mnogosearch.org
>
>
|