Views Fast Search

The views_fastsearch module provides a faster functionally equivalent alternative to the views "Search: Index" filter. This search is considerably faster (than the search in views_search.inc), supports OR terms, exception terms, and sorting by score.

  1. It is noticeably faster - 5-20x faster
  2. defaults to AND terms, but supports the OR keyword
  3. implements exception terms using the – prefix (i.e., “global warming –ocean” searches for nodes that include “global” and "warming" but do not include “ocean”)
  4. implements a sort by the search word score, when there are multiple terms, it sums them up – this presents results where the search words are in the title or header tags higher up in the list

This module is also a proof of concept of a solution using alternative search SQL that could be used as a basis for a patch to core.

The speed tests were done on a Drupal install with over 30,000 nodes. Additionally speed improvements can be found by:

  1. create an index on search_index(fromsid, word)
  2. enable the mysql query cache - causes the COUNT() query to be cached speeding up secondary page searches


    set global query_cache_size=50000000;

  3. InnoDB is much slower than MyISAM for selects, so it is highly recommended that the search_index table not be InnoDB. A check has been added to the admin/settings/search page to warn when InnoDB is used.

Views_fastsearch only filters based on the search results. When creating any view, you typically should also add a view filter for "Node: Published" to filter on only published nodes.

The module uses SQL subselects to implement exclusionary terms, and thus requires mysql 4.1 or higher.

This module is partially supported by CivicActions and The New York Observer.


The new improved views fastsearch development is mostly done. It’s time for testing and fixing!

  • significantly faster than the previous fastsearch
  • solves the multi-term join problem (5-6 term searches on large sites experienced slowness; plus mysql limits joins to 21 tables)
  • fixes for OR and EXCLUDE terms
  • added score field
  • better score sorting, not perfect yet
  • added search results view

To use the 5.x-dev branch, you must:

  1. ALTER TABLE search_index ENGINE=MyISAM; (you must do this yourself, but a warning is shown on admin/settings/search if this is not done)
  2. ALTER TABLE search_index ADD INDEX (fromsid, word); (now part of the update .install process).
  3. ALTER IGNORE TABLE search_index ADD UNIQUE INDEX (sid, word, type, fromsid); (see #143160, now part of the update .install process).
  4. admin/settings/search – select UNIQUE
  5. admin/settings/search – set the number of comments node rank to 0 (without which the performance results are not reproducable)

Thanks to Moshe for his ideas on the search HAVING clause (which is very similar to how core search does it) and for discovering ALTER IGNORE TABLE. And credit to Robert for pointing out that search_index had a dup problem in the first place.

9
Average: 9 (1 vote)

Thanks for giving out

Thanks for giving out information. It’s really nice and mean full. I want to write about it but this time I am busy in travel of different travel guide information that is the best helping source.I spend my extra time in surfing internet, listening music and playing games. After my flights I would like to join you group again.

Views Fast Search

Hi, Emmie here i am doing mcts training. This site is very informative and increases my knowledge a lot. I am happy to see this site that plays very important role in our new technology development. Articles are also very informative. nice work...keep it up

DXmVfqYyZyqvtLns

artie lange

FbabGAObzL

0401.txt;1;1

CVS Commits

  • cvsuid: 
    29191
    cvstag: 
    DRUPAL-5
    cvscomment: 
    <a href="http://drupal.org/node/286253">#286253</a> by scjv - add missing t()s
    cvscid: 
    135146

    commit #135146 by douggreen on DRUPAL-5 - #286253 by scjv - add missing t()s

  • cvsuid: 
    29191
    cvstag: 
    DRUPAL-6--1
    cvscomment: 
    clean up info file
    cvscid: 
    113214

    commit #113214 by douggreen on DRUPAL-6--1 - clean up info file

  • cvsuid: 
    29191
    cvstag: 
    DRUPAL-5
    cvscomment: 
    remove author attribution (see http://www.youtube.com/watch?v=ZSFDm3UYkeE)
    cvscid: 
    106172

    commit #106172 by douggreen on DRUPAL-5 - remove author attribution (see http://www.youtube.com/watch?v=ZSFDm3UYkeE)

  • cvsuid: 
    29191
    cvstag: 
    DRUPAL-5
    cvscomment: 
    code style - remove extra spaces
    cvscid: 
    104275

    commit #104275 by douggreen on DRUPAL-5 - code style - remove extra spaces

  • cvsuid: 
    29191
    cvstag: 
    DRUPAL-5
    cvscomment: 
    <a href="http://drupal.org/node/211952">#211952</a> by corsix - implement hook_uninstall
    cvscid: 
    96793

    commit #96793 by douggreen on DRUPAL-5 - #211952 by corsix - implement hook_uninstall