How do I.. Implement search?
I am developing a new site on my local vagrant box and when I simply append /search in the address box I would expect a search page to appear? But all I get is a white page.
fuel/modules/search/views/search.php - I have already located this file and now wish to start styling the results, but with a white page I cannot go any further.
Comments
I would also copy over the fuel/modules/search/config/search.php to fuel/application/config/search.php if you haven't already and you can manipulate the search configuration values outside of the fuel/modules/search folder.
When I try and run this from the command line I get an error....
Type: Error
Message: Call to undefined function mysqli_init()
Filename: /vagrant/html/local.fuel.co.uk/fuel/codeigniter/database/drivers/mysqli/mysqli_driver.php
Line Number: 135
So I tried changing to mysql inside fuel/config/database.php to see if that would make any difference which it didn't...
Type: Error
Message: Call to undefined function mysql_connect()
Filename: /vagrant/html/local.fuel.co.uk/fuel/codeigniter/database/drivers/mysql/mysql_driver.php
Line Number: 136
But to confirm, you have a in your home pages HTML code that has content to be indexed? And when you run this in the admin, is there anything that gets returned?
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.1.9-1+ubuntu14.04.1+deb.sury.org+1, Copyright (c) 1999-2017, by Zend Technologies
with Xdebug v2.5.5, Copyright (c) 2002-2017, by Derick Rethans
------
When run through the admin this is what happens, I've cut it short.
Index removed: 404_error
Index removed: additional-driver-bonus-builder
Index removed: awards
Index removed: bike/get-bike-insurance
Index removed: bike/motorbike-insurance
Index removed: bike/retrieve-bike-insurance
Index removed: bike/scooter-insurance
Index removed: blog/2017/09/29/this-is-my-first-post
Index removed: blog/authors/1
Index removed: blog/authors/2
Index removed: breakdown/membership
Index removed: business/business-insurance
Index removed: business/directors-insurance
Index removed: business/hotel-insurance
Index removed: business/landlord-insurance
Index removed: business/professional-insurance
Index removed: business/pub-insurance
Index removed: business/restaurant-insurance
Index removed: business/shop-insurance
Index removed: business/surgery-insurance
Index removed: business/takeaway-insurance
Index removed: business/tradesmen-insurance
Index removed: business/why-business-insurance
Index removed: car/car-insurance
Index removed: car/caravan-insurance
.....
.....
$config['search']['delimiters'] = array( '<div id="main">', '//meta[@name="keywords"]/@content', );
For the command line issue, see this thread for some possible help:
https://stackoverflow.com/questions/33612956/codeigniter-fatal-error-call-to-undefined-function-mysqli-init
$config['search']['delimiters'] = array(
'
$config['search']['delimiters'] = array( '<section id="main_inner">', '//meta[@name="keywords"]/@content', );
$config['search']['delimiters'] = array(
'
I can confirm I have section id="main_inner" as the first value of the $config array as per your code above.
<html> <title>This is the title</title> <body> <section id="main_inner"> THIS IS A TEST </section> </body> </html>
$config['nav']['tools']['tools/search'] = lang('module_search');
$config['tables']['search'] = 'fuel_search';
$config['search'] = array();
$config['search']['base_url'] = '';
$config['search']['indexing_enabled'] = TRUE;
$config['search']['user_agent'] = 'FUEL';
$config['search']['query_type'] = 'match boolean';
$config['search']['delimiters'] = array(
'<section id="main_inner">',
'//meta[@name="keywords"]/@content',
);
$config['search']['title_tag'] = array('title', 'h1');
$config['search']['preserve_title_html'] = FALSE; //set TRUE to keep HTML
$config['search']['ignore_robots'] = FALSE; // set TRUE to ignore
$config['search']['excerpt_tag'] = array('p', '//meta[@name="description"]/@content');
$config['search']['language_tag'] = array('html[@lang]/@lang');
$config['search']['exclude'] = array();
$config['search']['index_method'] = 'AUTO';
$config['search']['index_modules'] = TRUE;
$config['search']['view'] = 'search';
$config['search']['min_length_search'] = 3;
$config['search']['depth'] = 0;
$config['search']['use_tmp_table'] = FALSE;
$config['search']['cleaning_funcs'] = array('zap_gremlins');
$config['search']['pagination'] = array(
'per_page' => 1a0,
'num_links' => 2,
'prev_link' => lang('search_prev_page'),
'next_link' => lang('search_next_page'),
'first_link' => lang('search_first_link'),
'last_link' => lang('search_last_link'),
);
/* To allow users to modify under the settings section of the CMS, uncomment this area */
//$config['search']['settings'] = array();
/* $config['search']['settings']['user_agent'] = array(); */
//$config['search']['settings']['delimiters'] = array('default' => '"main_inner"');
//$config['search']['settings']['query_type'] = array('type' => 'select', 'options' => array('match' => 'match', 'match boolean' => 'match boolean', 'like' => 'like'));
/vagrant/html/local.fuel.co.uk/fuel/modules/search/libraries/Fuel_search.php:672:
array (size=8)
10002 => string 'http://local.fuel.co.uk/car/car-insurance' (length=41)
19913 => boolean true
13 => int 20
78 => int 10
19914 => boolean true
10018 => string 'FUEL' (length=4)
42 => boolean false
44 => boolean false
Curl.php add_session() $url = http://local.fuel.co.uk/car/car-insurance
Curl.php add_session() $opts ---> next line
/vagrant/html/local.fuel.co.uk/fuel/modules/fuel/libraries/Curl.php:127:
array (size=8)
10002 => string 'http://local.fuel.co.uk/car/car-insurance' (length=41)
19913 => boolean true
13 => int 20
78 => int 10
19914 => boolean true
10018 => string 'FUEL' (length=4)
42 => boolean false
44 => boolean false
Curl.php add_session() $opt_params ---> next line
/vagrant/html/local.fuel.co.uk/fuel/modules/fuel/libraries/Curl.php:129:
array (size=0)
empty
noramlize the url = http://local.fuel.co.uk/car/car-insurance
key = 0
set_options $o -----> next line
/vagrant/html/local.fuel.co.uk/fuel/modules/fuel/libraries/Curl.php:195:
array (size=8)
10002 => string 'http://local.fuel.co.uk/car/car-insurance' (length=41)
19913 => boolean true
13 => int 20
78 => int 10
19914 => boolean true
10018 => string 'FUEL' (length=4)
42 => boolean false
44 => boolean false
set_options $key ------> next line
0
Curl.php is_multi() = false - exec_single()
$this->_output -----> next line
/vagrant/html/local.fuel.co.uk/fuel/modules/fuel/libraries/Curl.php:274:boolean false
$output = $this->CI->curl->exec(); ----> on next line
/vagrant/html/local.fuel.co.uk/fuel/modules/search/libraries/Fuel_search.php:681:boolean false
$this->CI->curl->error() -----> on next line
/vagrant/html/local.fuel.co.uk/fuel/modules/search/libraries/Fuel_search.php:686:
array (size=1)
0 => string 'Could not resolve host: local.fuel.co.uk' (length=40)
http_code = 0 - needs to be 200 - so not good
html scrape:
Index removed: car/car-insurance
Looks like I am having a problem with Curl running through a vagrant box, attempting to resolve this one now - will try and report solution if its worthy of a mention.
After some extensive googling I found that if I added the below line to my vagrantfile (near line 60) and perform a reload the box could now resolve to any local hosts defined in conf/options.txt.
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]