You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs-dev@perl.apache.org by Bill Moseley <mo...@hank.org> on 2002/03/02 01:45:28 UTC

Site Search

Hi,

I *finally* found some time today to update the search.  I'm sending the
patch to Stas in separate email.

The main change is that searches can be limited to sections of the document
tree.  That means the various sections can have a a search field with a
checkbox to say "__ Search this section only".

Here's some notes:

- The search box currently uses absolute URL pointer to the search CGI
script.  It would be great if that could be a relative link, and adjusted
depending on the depth of the page the box is on.

- The search box doesn't need to be shown on the swsih.cgi page, of course.

- Why not make the "search" text a button?
Then the initial "Press enter" would not be required.  Or use (cough!)
javascript to erase the box on entry.  No, ignore that.

- You need to set an environment variable to tell the spider the URL.  On
my machine that's

    export MODPERL_SITE='http://localhost:4000/dst_html'

Then it will start spidering at:

    http://localhost:4000/dst_html/index.html

But that's also used to extract out the "section" with the expression

    $uri =~ m!$ENV{MODPERL_SITE}{/([^/]+)/.+$!

where $1 is used as the section name.  So it's just using the initial
directory name for the section.

On the swish.cgi page it now lists a collection of checkboxes so you can
limit searches to those sections.

What that means is the forms on the pages can have a checkbox to limit to
just the section that page is located on:

 Search only this section: <input type="checkbox" name="sbm" value="about" />

Where "about" is substituted when generating the site.  (Can you do that
Stas?)

That make sense?

Oh, the setup of the checkboxes on the swish.cgi page (where search results
are show) are defined in .swishcgi.conf.  The labels can be defined for
each of the checkbox options by:

        labels  => {
            about   => 'About mod_perl',
            doc     => 'Documentation',
            stories => 'Sucess Stories',
            support => 'Support',
        },

Can also change to select list in that file, if you like that better than
check boxes.

Also need to update the search.tt file to match up colors better and/or
make use of our style sheet.

Oh, BTW -- my mind isn't working, Stas.  In search.tt I do this:

        [% PROCESS search_form %]
        [% PROCESS nav_bar %]
        [% PROCESS results_list %]
        [% IF search.navigation('hits') > search.config('page_size'); 
               PROCESS nav_bar; END %]

Can I (should I) capture the output from PROCESS nav_bar so I'm not
PROCESSing two times?  Do I need to wrap the PROCESS in a BLOCK and capture
that?

Thanks,





-- 
Bill Moseley
mailto:moseley@hank.org

---------------------------------------------------------------------
To unsubscribe, e-mail: docs-dev-unsubscribe@perl.apache.org
For additional commands, e-mail: docs-dev-help@perl.apache.org


Re: Site Search

Posted by Stas Bekman <st...@stason.org>.
Bill Moseley wrote:
> At 01:02 AM 03/03/02 +0800, Stas Bekman wrote:
> 
>>>- Why not make the "search" text a button?
>>>
>>that's what we had in first place. But it looks ugly on most browsers 
>>and quite ruins the navbar's slickness.
>>
> 
> I didn't mean button, but a click-able image.  Is that what you had?

we had all three: text, button, image. So which one others prefer?

yes, we will remove the 'press enter' hint. since js won't work in 
non-js browsers.

>>not that my mind works now :) but sure you can [% foo = PROCESS bar %]
>>
> 
> Hum, have to try it again -- I thought I tried that.
> 
> I'm still thinking about how to search perl code....

cool!

_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:stas@stason.org  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: docs-dev-unsubscribe@perl.apache.org
For additional commands, e-mail: docs-dev-help@perl.apache.org


Re: Site Search

Posted by Bill Moseley <mo...@hank.org>.
At 01:02 AM 03/03/02 +0800, Stas Bekman wrote:
>> - Why not make the "search" text a button?
>
>that's what we had in first place. But it looks ugly on most browsers 
>and quite ruins the navbar's slickness.

I didn't mean button, but a click-able image.  Is that what you had?


>not that my mind works now :) but sure you can [% foo = PROCESS bar %]

Hum, have to try it again -- I thought I tried that.

I'm still thinking about how to search perl code....




-- 
Bill Moseley
mailto:moseley@hank.org

---------------------------------------------------------------------
To unsubscribe, e-mail: docs-dev-unsubscribe@perl.apache.org
For additional commands, e-mail: docs-dev-help@perl.apache.org


Re: Site Search

Posted by Stas Bekman <st...@stason.org>.
Hey Bill,

> I *finally* found some time today to update the search.  I'm sending the
> patch to Stas in separate email.

Fantastic, Bill!

> The main change is that searches can be limited to sections of the document
> tree.  That means the various sections can have a a search field with a
> checkbox to say "__ Search this section only".
> 
> Here's some notes:
> 
> - The search box currently uses absolute URL pointer to the search CGI
> script.  It would be great if that could be a relative link, and adjusted
> depending on the depth of the page the box is on.

yup, I need to work on these.

I like the idea of using env var for this. so I can set the search URL 
in the config file (which is a perl code, which can dynamically read env 
vars ;)

> - The search box doesn't need to be shown on the swsih.cgi page, of course.

yes, yes, didn't have time to work on this one yet.

> - Why not make the "search" text a button?
> Then the initial "Press enter" would not be required.  Or use (cough!)
> javascript to erase the box on entry.  No, ignore that.

that's what we had in first place. But it looks ugly on most browsers 
and quite ruins the navbar's slickness.

> - You need to set an environment variable to tell the spider the URL.  On
> my machine that's
> 
>     export MODPERL_SITE='http://localhost:4000/dst_html'
> 
> Then it will start spidering at:
> 
>     http://localhost:4000/dst_html/index.html
> 
> But that's also used to extract out the "section" with the expression
> 
>     $uri =~ m!$ENV{MODPERL_SITE}{/([^/]+)/.+$!
> 
> where $1 is used as the section name.  So it's just using the initial
> directory name for the section.
> 
> On the swish.cgi page it now lists a collection of checkboxes so you can
> limit searches to those sections.
> 
> What that means is the forms on the pages can have a checkbox to limit to
> just the section that page is located on:
> 
>  Search only this section: <input type="checkbox" name="sbm" value="about" />
> 
> Where "about" is substituted when generating the site.  (Can you do that
> Stas?)
> 
> That make sense?
> 
> Oh, the setup of the checkboxes on the swish.cgi page (where search results
> are show) are defined in .swishcgi.conf.  The labels can be defined for
> each of the checkbox options by:
> 
>         labels  => {
>             about   => 'About mod_perl',
>             doc     => 'Documentation',
>             stories => 'Sucess Stories',
>             support => 'Support',
>         },
> 
> Can also change to select list in that file, if you like that better than
> check boxes.

I'll play with these when I merge your patches Bill.

> Also need to update the search.tt file to match up colors better and/or
> make use of our style sheet.

I've got the issue regarding css. what do you mean by colors?

> Oh, BTW -- my mind isn't working, Stas.  In search.tt I do this:
> 
>         [% PROCESS search_form %]
>         [% PROCESS nav_bar %]
>         [% PROCESS results_list %]
>         [% IF search.navigation('hits') > search.config('page_size'); 
>                PROCESS nav_bar; END %]
> 
> Can I (should I) capture the output from PROCESS nav_bar so I'm not
> PROCESSing two times?  Do I need to wrap the PROCESS in a BLOCK and capture
> that?


not that my mind works now :) but sure you can [% foo = PROCESS bar %]


_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:stas@stason.org  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: docs-dev-unsubscribe@perl.apache.org
For additional commands, e-mail: docs-dev-help@perl.apache.org


Re: Site Search

Posted by Bill Moseley <mo...@hank.org>.
On Thu, 21 Mar 2002 22:22:36 +0800
Stas Bekman <st...@stason.org> wrote:

> ok, it's just that's much slower to index via web.

How long is it taking?  I think it was only about a minute on my machine.  Ok, a minute and a half:

1281 files indexed.  3867312 total bytes.  321057 total words.
Elapsed time: 00:01:34 CPU time: 00:00:08


---------------------------------------------------------------------
To unsubscribe, e-mail: docs-dev-unsubscribe@perl.apache.org
For additional commands, e-mail: docs-dev-help@perl.apache.org


Re: Site Search

Posted by Stas Bekman <st...@stason.org>.
Bill Moseley wrote:
> On Thu, 21 Mar 2002 20:03:06 +0800
> Stas Bekman <st...@stason.org> wrote:
> 
> 
>>I'm back to work on the search, Bill.
>>
>>A question here: is it possible to index from filesystem and not via the 
>>webserver? I think you can.
> 
> 
> It's possible to index the file system, sure.  I think it's best to spider since it's indexing really what can be reached via links.

ok, it's just that's much slower to index via web.

>>If so can we replace MODPERL_SITE with:
>>
>>MODPERL_BASE_URL = ...
>>
>>which is always a URL
>>
>>optionally we want to have MODPERL_BASE_DIR, which is then used for 
>>indexing and MODPERL_BASE_URL is for proper linking.
>>
>>In fact I think we could have only one variable which doesn't include 
>>the hardcoded URL, and can be a URL or file PATH, so we can move the 
>>site around the index will still work, if the URLs are relative. Is it 
>>possible? Is it a good idea?
> 
> 
> Maybe it's too early as I'm not seeing the reason for this.  The index is portable.  And the pathname can be made relative during indexing, and then "fixed-up" when searching, so that it will work anywhere.

ok, thanks :)

-- 


_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:stas@stason.org  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: docs-dev-unsubscribe@perl.apache.org
For additional commands, e-mail: docs-dev-help@perl.apache.org


Re: Site Search

Posted by Bill Moseley <mo...@hank.org>.
On Thu, 21 Mar 2002 20:03:06 +0800
Stas Bekman <st...@stason.org> wrote:

> I'm back to work on the search, Bill.
> 
> A question here: is it possible to index from filesystem and not via the 
> webserver? I think you can.

It's possible to index the file system, sure.  I think it's best to spider since it's indexing really what can be reached via links.

> If so can we replace MODPERL_SITE with:
> 
> MODPERL_BASE_URL = ...
> 
> which is always a URL
> 
> optionally we want to have MODPERL_BASE_DIR, which is then used for 
> indexing and MODPERL_BASE_URL is for proper linking.
> 
> In fact I think we could have only one variable which doesn't include 
> the hardcoded URL, and can be a URL or file PATH, so we can move the 
> site around the index will still work, if the URLs are relative. Is it 
> possible? Is it a good idea?

Maybe it's too early as I'm not seeing the reason for this.  The index is portable.  And the pathname can be made relative during indexing, and then "fixed-up" when searching, so that it will work anywhere.

---------------------------------------------------------------------
To unsubscribe, e-mail: docs-dev-unsubscribe@perl.apache.org
For additional commands, e-mail: docs-dev-help@perl.apache.org


Re: Site Search

Posted by Stas Bekman <st...@stason.org>.
I'm back to work on the search, Bill.

A question here: is it possible to index from filesystem and not via the 
webserver? I think you can.

If so can we replace MODPERL_SITE with:

MODPERL_BASE_URL = ...

which is always a URL

optionally we want to have MODPERL_BASE_DIR, which is then used for 
indexing and MODPERL_BASE_URL is for proper linking.

In fact I think we could have only one variable which doesn't include 
the hardcoded URL, and can be a URL or file PATH, so we can move the 
site around the index will still work, if the URLs are relative. Is it 
possible? Is it a good idea?

_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:stas@stason.org  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: docs-dev-unsubscribe@perl.apache.org
For additional commands, e-mail: docs-dev-help@perl.apache.org