Bugs Filed
Bug 312385: {search_total} can get out of sync
Search Tables
The search module stores its data in four tables:
search_datasetis a queue of items to be indexedsearch_indexis the main search index which gives a score to each distinct word in every node.search_totalis a materialized view on{search_index}- Equivalent to
SELECT word, LOG10(1 + 1/MAX(1,SUM(score))) AS count FROM {search_index} GROUP BY word - Written in
search_update_totals(), whose sole function is to maintain the view - Read in
do_search(), where it isINNER JOINed onto the overall search query
- Equivalent to
search_node_links: Tracks links to nodes contained in search items (like nodes), used to improve search scores for nodes that are frequently linked to.
Search Indexer Steps
Base case where node.module is the only module which implements update_indexnode_update_index()- The number of items (default 100) to index is fetched from a variable (
search_cron_limit) - The maximum number of comments per thread is fetched from the DB and stored in a variable
node_cron_comments_scale - The value of the variable
node_cron_views_scaleis recalculated - The 100 node IDs for the nodes to reindex are fetched
_node_index_node()is called for each of those node IDs- Loads the node from the database
- sets the variable
node_cron_last - The node is rendered into HTML
- nodeapi
'update index'is called to get any extra invisible keywordscomment.moduleadds all commentssearch.moduleadds any anchor text for incoming links using thesearch_node_linkstabletaxonomy.moduleadds any tags for the node
search_index()is called- ... stuff happens
search_wipe($sid, $type, TRUE)is calledDELETEs corresponding row(s) from{search_dataset},{search_index}, and{search_node_links}
- Row is inserted into
{search_dataset}with newdatacolumn andreindexset to0 - Every word in
$results[0]gets its{search_index}entry updated is added intosearch_dirty() - ... stuff happens
- The number of items (default 100) to index is fetched from a variable (
search_update_totals()is called, which keeps the materialized view{search_total}up to date- Processes adds and updates. For each word that's been added into
search_dirty()- Get the sum of scores from
{search_index}for that word, normalize it, and store it in{search_total}
- Get the sum of scores from
- Delete rows in
{search_total}which do not correspond to a row in{search_index}
- Processes adds and updates. For each word that's been added into

Can you help me fix my
Can you help me fix my drupal search indexer. My links are not being indexed.
drupal.org
Hi John, you probably want to be asking on the drupal.org forums, since there are a lot of people there, and many of them know much more than I do.
how do drupal know which node it is from the database tables?
hello, thanks for your clear explanation.
i have been learning about search, but i dont find how drupal knows from the sid which nid has to present.
thanks :)
ups! i am toooo tired... it
ups! i am toooo tired... it is not tid, it is sid. and it is the same as nid.
but why they change the name? why didn't call it the same?
i am sure there is a reason, but now i am toooo tired to find it :))
thanks for your clear explanation.