Re: [fw-general] search friendly

2007-04-04 Thread José de Menezes Soares Neto
Hi Matthew,

I could not resolve this problem alone... I used the code for /search/test/ and 
the error:

Fatal error: Uncaught exception 'Zend_Controller_Exception' with message 
'SearchController::okAction() does not exist and was not trapped in __call()' 
in D:\www\projeto\lib\Zend\Controller\Action.php:474 Stack trace: #0 [internal 
function]: Zend_Controller_Action-__call('okAction', Array) #1 
D:\www\projeto\lib\Zend\Controller\Action.php(488): 
SearchController-okAction() #2 
D:\www\projeto\lib\Zend\Controller\Dispatcher\Standard.php(214): 
Zend_Controller_Action-dispatch('okAction') #3 
D:\www\projeto\lib\Zend\Controller\Front.php(753): 
Zend_Controller_Dispatcher_Standard-dispatch(Object(Zend_Controller_Request_Http),
 Object(Zend_Controller_Response_Http)) #4 D:\www\projeto\index.php(61): 
Zend_Controller_Front-dispatch() #5 {main} thrown in 
D:\www\projeto\lib\Zend\Controller\Action.php on line 474

The code is:

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


Could you help me saying what is wrong?? I sent you my index.php in the other 
email...

  - Original Message - 
  From: Matthew Weier O'Phinney 
  To: fw-general@lists.zend.com 
  Sent: Tuesday, April 03, 2007 11:55 AM
  Subject: Re: [fw-general] search friendly


  -- 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: fw-general@lists.zend.com
   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: fw-general@lists.zend.com
   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

Re: [fw-general] search friendly

2007-04-04 Thread Maurice Fonk

Hi,

Sorry about replying to this again, hit the wrong button and replied to 
José only at first.  The problem was that José used a static route, 
instead of a dynamic one. So the :query bit didn't get parsed.


Maurice Fonk

Alan Wagstaff wrote:

Hi,

On 04/04/07, *José de Menezes Soares Neto* [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] wrote:


Hi Matthew,
 
I could not resolve this problem alone... I used the code for

/search/test/ and the error:
 
*Fatal error*: Uncaught exception 'Zend_Controller_Exception' with

message 'SearchController::okAction() does not exist and was not
trapped in __call()' in
D:\www\projeto\lib\Zend\Controller\Action.php:474 Stack trace: #0
[internal

 
It seems to be that your script is looking for an ok action in your 
staff controller.  Are you able to post the HTML code for your form?  
I suspect it might be the form that has the problem.
 
Thanks,

Alan.
 

 




Re: [fw-general] search friendly

2007-04-03 Thread Gavin Vess

Matthew Weier O'Phinney wrote:

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

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. :-)
  

The Google search page does something similar.
View source and then change the way the pieces are replaced.

Cheers,
Gavin


Re: [fw-general] search friendly

2007-04-03 Thread José de Menezes Soares Neto
Very nice answers, but I am getting a little problem cause I am newbie in ZF.

I will try your suggestion for urls like

http://localhost/project/search/test

But I dont know where in the project I have to put the code above (index.php? 
SearchController.php?):

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

So, I tried to put at index.php and I got this error:

Fatal error: Uncaught exception 'Zend_Controller_Exception' with message 
'SearchController::okAction() does not exist and was not trapped in __call()' 
in D:\www\projeto\lib\Zend\Controller\Action.php:474 Stack trace: #0 [internal 
function]: Zend_Controller_Action-__call('okAction', Array) #1 
D:\www\projeto\lib\Zend\Controller\Action.php(488): 
SearchController-okAction() #2 
D:\www\projeto\lib\Zend\Controller\Dispatcher\Standard.php(214): 
Zend_Controller_Action-dispatch('okAction') #3 
D:\www\projeto\lib\Zend\Controller\Front.php(753): 
Zend_Controller_Dispatcher_Standard-dispatch(Object(Zend_Controller_Request_Http),
 Object(Zend_Controller_Response_Http)) #4 D:\www\projeto\index.php(61): 
Zend_Controller_Front-dispatch() #5 {main} thrown in 
D:\www\projeto\lib\Zend\Controller\Action.php on line 474

I don´t know what to do exactly... My index.php is attached...

Thanks very much again



  - Original Message - 
  From: Matthew Weier O'Phinney 
  To: fw-general@lists.zend.com 
  Sent: Tuesday, April 03, 2007 11:55 AM
  Subject: Re: [fw-general] search friendly


  -- 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: fw-general@lists.zend.com
   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: fw-general@lists.zend.com
   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