-- José de Menezes Soares Neto <[EMAIL PROTECTED]> wrote
(on Tuesday, 03 April 2007, 10:33 AM -0300):
> I've made a searchAction in IndexController. But, when I do a search, the url
> shown is:
>  
> http://localhost/project/index/search?query=test
>  
> And I was wondering if it could be:
>  
> http://localhost/project/search?query=test
>  
> Cause it is more beautiful. 

So either create a new route for this:

    $router = $front->getRouter();
    $searchRoute = new Zend_Controller_Router_Route_Static(
        'search',
        array('controller' => 'index', 'action' => 'search')
    );
    $router->addRoute('search', $searchRoute);

OR create a new controller, SearchController, with indexAction() that
performs the search.

> In other way, the best way I think, the url could be:
>  
> http://localhost/project/search/test
>  
> And it calls the search engine and lists all the results for the word "test"

Easy: create a custom route:

    $router = $front->getRouter();
    $searchRoute = new Zend_Controller_Router_Route_Static(
        'search/:query',
        array('controller' => 'search', 'action' => 'index')
    );
    $router->addRoute('search', $searchRoute);

> The problem for this last url is the form submission, cause it constructs
> search?test and not search/test

You're not going to be able to get a form submission to append to the
url path unless you use javascript; forms either populate the query
string ($_GET in PHP) or POST content ($_POST in PHP). I'd suggest *not*
using javascript, and instead doing something like:

    <form action="/search" method="get">
        <input type="text" name="query" value="" size="15" maxlength="256" />
        <input type="submit" name="search" value="Search" />
    </form>

This will work with either of the routes listed above, and will work
with javascript as well.

> Maybe using a javascript... does anybody knows where I can found about it?

There are plenty of tutorials on javascript out there -- google is your
friend. :-)


>     ----- Original Message -----
>     From: José de Menezes Soares Neto
>     To: Alexander Veremyev
>     Cc: [email protected]
>     Sent: Tuesday, April 03, 2007 9:50 AM
>     Subject: Re: [fw-general] search engine
> 
>     Nice! And it increases the performance??
>      
>      
> 
>         ----- Original Message -----
>         From: Alexander Veremyev
>         To: José de Menezes Soares Neto
>         Cc: [email protected]
>         Sent: Tuesday, April 03, 2007 9:47 AM
>         Subject: Re: [fw-general] search engine
> 
>         Hi José,
> 
>         There are two possibilities:
>         1) As it already was mentioned by Joshua, it's possible to use your
>         database capabilities for full-text searching or use any other tool.
> 
>         2) Use Zend_Search_Lucene as full-text index in addition to you
>         relational database.
>         It's not data duplication. You can store only index information 
> without
>         storing field values.
>         Data from your relational database can be indexed absolutely the same
>         way you can index filesystem data.
> 
>         Just use 'SELECT * ...' instead of fread() :)
> 
> 
>         With best regards,
>             Alexander Veremyev.
> 
> 
>         José de Menezes Soares Neto wrote:
>         > I am trying to explain what I want in a simple way...
>         > 
>         > I want to create a search engine not for files, but for a database
>         with
>         > products. They produtcs will be sorted by date or price.
>         > 
>         > I want to create a form input for it, but with Zend_Search its
>         possible?
>         > Cause I only found Zend_Search examples for files, not for
>         databases...
>         > 
>         > Other question:
>         > 
>         > What is the best way to build an search engine service (like google
>         or
>         > open directory project) using Zend Framework? I would like to 
> storage
>         > 100.000.000 records in the database...
>         > 
>         > Thanks!
>         > 
>         > 
>         >
>         >     ----- Original Message -----
>         >     *From:* José de Menezes Soares Neto <mailto:[EMAIL PROTECTED]>
>         >     *To:* Alexander Veremyev <mailto:[EMAIL PROTECTED]>
>         >     *Cc:* [email protected] 
> <mailto:[email protected]
>         >
>         >     *Sent:* Monday, April 02, 2007 3:10 PM
>         >     *Subject:* Re: [fw-general] search engine
>         >
>         >     Hi,
>         >     
>         >     But I already have a database, and this article shows how to
>         search
>         >     an index created by zend_search_lucene
>         >     
>         >     So, I need to create a index from my database, and this is not
>         what
>         >     they explain...
>         >     
>         >     Thanks!
>         >     
>         >
>         >         ----- Original Message -----
>         >         *From:* Alexander Veremyev <mailto:[EMAIL PROTECTED]>
>         >         *To:* José de Menezes Soares Neto <mailto:[EMAIL PROTECTED]>
>         >         *Cc:* [email protected] <
>         mailto:[email protected]>
>         >         *Sent:* Monday, April 02, 2007 1:33 PM
>         >         *Subject:* Re: [fw-general] search engine
>         >
>         >         Hi,
>         >
>         >         It looks like you need Zend_Search_Lucene component to be
>         used
>         >         (http://framework.zend.com/manual/en/zend.search.html).
>         >
>         >         Some number of Zend Search Lucene tutorials can be found 
> here
>         -
>         >         http://www.zftutorials.com/zend-search/
>         >
>         >
>         >         With best regards,
>         >             Alexander Veremyev.
>         >
>         >
>         >         José de Menezes Soares Neto wrote:
>         >          > hi friends,
>         >          > how to create a search engine using zend framework??
>         >          >
>         >          > i have a database with a lot of products, and when 
> someone
>         type
>         >          > "notebook" for example, it searchs title and description
>         fields.
>         >          >
>         >          > best regards,
>         >          >
>         >          > José de Menezes
> 

-- 
Matthew Weier O'Phinney
PHP Developer            | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/

Reply via email to