Fuel Search Class
This class extends the Fuel_advanced_module class.
Properties Reference
Property | Default Value | Description |
---|---|---|
public | ||
timeout | 20 | CURL timeout |
connect_timeout | 10 | CURL connection timeout |
title_limit | 100 | Max character limit of the title of content |
q | none | Search term |
auto_ignore |
array('sitemap.xml', 'robots.txt', 'search') |
Pages to ignore when determining if indexable |
depth | none | The depth in which to crawl |
base_url | none | The base URL value of where to pull page information from |
user_tmp_table | 1 | Use a temp table while indexing results |
crawled |
array() |
Used to capture crawled urls |
protected | ||
_logs | N/A | Log of items indexed |
Function Reference [+]
$this->fuel->search->query(['$q'=''], ['$limit'=100], ['$offset'=0], ['$excerpt_limit'=200])
Query the database.
Returns
array
Parameters
(string) $q (int) $limit (int) $offset (int) $excerpt_limit
$this->fuel->search->count(['$q'=''])
Get the count of the returned rows. If no parameter is passed then it will assume the last query.
Returns
array
Parameters
(string) $q
$this->fuel->search->after_save_hook('$posted')
Hook for updating an index item after a module save. Used when something is saved in admin to automatically update the index.
Returns
boolean
Parameters
(object) $posted search record
$this->fuel->search->before_delete_hook('$posted')
Hook for removing an index item after a module save. Used when something is deleted in admin to automatically remove from the index.
Returns
boolean
Parameters
(object) $posted search record
$this->fuel->search->index([$pages=array()], ['$scope'='pages'], ['$clear_all'=FALSE])
Indexes the data for the search.
Returns
mixed
$this->fuel->search->is_indexable('$location')
Checks to see if the page is indexable.
Returns
boolean
Parameters
(string) $location
$this->fuel->search->crawl_pages(['$location'='home'], ['$index_content'=TRUE], ['$depth'=0], ['$parent'=NULL])
Crawls the site for locations to be indexed.
Returns
array
Parameters
(string) $location (boolean) $index_content (boolean) $depth
$this->fuel->search->index_page('$location', ['$html'=NULL], ['$parent'=NULL])
Indexes a single page.
Returns
array
Parameters
(string) $location (string) $html
$this->fuel->search->sitemap_pages()
Parses the sitemap.xml file of the site and returns an array of pages to index.
Returns
array
$this->fuel->search->check_robots_txt('$location')
Parses the sitemap.xml file of the site and returns an array of pages to index.
Returns
boolean
Parameters
(string) $location
$this->fuel->search->scrape_page('$url', ['$just_header'=FALSE], ['$parent'=NULL])
CURLs the page and gets the content.
Returns
string
Parameters
(string) $url (boolean) $just_header
$this->fuel->search->page_xpath('$content', ['$type'='html'])
Returns the DomXpath.
Returns
array
Parameters
(string) $content page content to search (string) $type
$this->fuel->search->find_indexable_content('$xpath')
Searches for index related content within html content.
Returns
array
Parameters
(object) $xpath DOMXpath
$this->fuel->search->find_page_title('$xpath')
Searches for title.
Returns
array
Parameters
(object) $xpath DOMXpath
$this->fuel->search->find_excerpt('$xpath')
Searches for excerpt.
Returns
array
Parameters
(object) $xpath DOMXpath
$this->fuel->search->find_language('$xpath')
Searches for language value.
Returns
array
Parameters
(object) $xpath DOMXpath
$this->fuel->search->_find_tag('$xpath', '$tags')
Searches for title.
Returns
array
Parameters
(object) $xpath DOMXpath
$this->fuel->search->get_xpath_from_node('$node')
Returns the xpath syntax based on the node string (e.g.
Returns
string
Parameters
(string) $node node string
$this->fuel->search->get_location_scope('$location')
Returns scope based on the url by looking at the preview paths.
Returns
string
Parameters
(string) $location url
$this->fuel->search->create('$location', ['$content'=NULL], ['$title'=NULL], ['$excerpt'=NULL], ['$scope'='page'])
Creates a record in the search table. Will overwrite if the same location/model exist.
Returns
boolean
Parameters
(mixed) $location can be a string or an array. If an array, it must contain the other values (string) $content (string) $title
$this->fuel->search->remove('$location', ['$scope'=NULL])
Removes a record in the search table.
Returns
boolean
Parameters
(string) $location location (string) $scope scope
$this->fuel->search->clear_all()
Clears the entire search index.
Returns
void
$this->fuel->search->clean('$content')
Cleans content to make it more searchable. The find_indexable_content already cleans up content in most cases.
Returns
boolean
Parameters
(string) $content HTML content to clean for search index
$this->fuel->search->format_title('$title')
Cleans and truncates the title if it's too long.
Returns
boolean
Parameters
(string) $title title
$this->fuel->search->is_local_url('$url')
Determines whether the url is local to the site or not.
Returns
boolean
Parameters
(string) $url url
$this->fuel->search->is_normal_url('$url')
Determines whether the url contains a normal link.
Returns
boolean
Parameters
(string) $url url
$this->fuel->search->get_location('$url', ['$relative'=NULL])
Return the URI part of a URL.
Returns
string
Parameters
(string) $url url (string) $relative relative to the page (optional)
$this->fuel->search->log_message('$msg', ['$type'='error'])
Adds an item to the index log. Used when printing out the index log informaiton.
Returns
void
Parameters
(string) $msg Log message (string) $type Type of log message
$this->fuel->search->logs()
Returns an array of log messages. Used when printing out the index log informaiton.
Returns
array
$this->fuel->search->display_log(['$type'='all'], ['$tag'='span'], ['$return'=FALSE])
Adds an item to the index log. Used when printing out the index log informaiton.
Returns
string
Parameters
(string) $type (string) $tag (boolean) $return
$this->fuel->search->site_url(['$url'=''])
Generates the proper URL taking into account in base_url value specified.
Returns
string
Parameters
(string) $url
$this->fuel->search->create_temp_table()
Creates a temp table to store results.
Returns
void
$this->fuel->search->temp_table_name()
Returns temp table name.
Returns
string
$this->fuel->search->switch_from_temp_table()
Drops the temp table.
Returns
void
$this->fuel->search->is_cli()
Convenience static method for determining whether the script is being run via CLI.
Returns
boolean