1779 Posts in 582 Topics by 556 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 792 Views |
-
2.4 Search form and empty searches

18 November 2010 at 10:38am
Hello I'm very new with SS but really enjoying the experience so far and would like to thank for this wonderful project.
But I'm stuck with the search function that exists starting with version 2.4
The one where You but FulltextSearchable::enable(); into _config and $SearchForm. to template.The problem is it works a little bit too well and I dont't know how to restrict it. If I do a empty search it finds all the error pages and Upload folder as well. search for "error" find the pages too even though I have tried changing the error pages search option.
Any ideas how to keep that from appearing in the search?
Any help appreciated!
-
Re: 2.4 Search form and empty searches

25 November 2010 at 4:27am
Nobody has any ideas how to restrict the built in search function?
-
Re: 2.4 Search form and empty searches

12 December 2010 at 7:09pm
I've noticed the same problem.
I went to the behaviour tab for 'Page not found' and checked that "Show in search?" was not ticked. However search is still listing the page.
Is there a fix? I'm using SS 2.4.1 at the moment.
-
Re: 2.4 Search form and empty searches

13 December 2010 at 3:08am Last edited: 13 December 2010 10:32pm
look for this in your Page.php
function results($data, $form){
$data = array(
'Results' => $form->getResults(),
'Query' => $form->getSearchQuery(),
'Title' => 'Search Results'
);return $this->customise($data)->renderWith(array('Page_results', 'Page'));
}replace with something like this...
function results($data, $form){
$dosResults = new DataObjectSet();
if (!empty($data['Search'])) {
$dosResults = $form->getResults();
}
$data = array(
'Results' => $dosResults,
'Query' => $form->getSearchQuery(),
'Title' => 'Search Results'
);return $this->customise($data)->renderWith(array('Page_results', 'Page'));
} -
Re: 2.4 Search form and empty searches

13 December 2010 at 2:09pm Last edited: 13 December 2010 2:12pm
Thanks for the reply. That code didn't work for me ... wouldn't parse the if statement (unexpected "}").
However in the meantime I upgraded the website to SS version 2.4.3 and commented out the line in my existing search function that appeared to be superfluous.
Not sure which action helped but 'page not found' is no longer being shown in my search results.
function results($data, $form){
$data = array(
'Results' => $form->getResults(),
'Query' => $form->getSearchQuery(),
'Title' => 'Search Results'
)
// $this->Query = $form->getSearchQuery();
return $this->customise($data)->renderWith(array('Page_results', 'Page'));
} -
Re: 2.4 Search form and empty searches

13 December 2010 at 10:32pm
Glad it worked out with you. that code was untested and I've just seen one typo that I've fixed for the record, it ain't cut&paste, but I've done something like it before
| 792 Views | ||
|
Page:
1
|
Go to Top |


