pg_search
https://github.com/casecommons/pg_search
Ruby
pg_search builds ActiveRecord named scopes that take advantage of PostgreSQL’s full text search
PgSearch::Features::TSearch#normalization
From http://www.postgresql.org/docs/8.3/static/textsearch-controls.html 0 (the default) ignores the document length 1 divides the rank by 1 + the logarithm of the document length 2 divides the rank by the document length 4 divides the rank by the mean harmonic distance between extents (this is implemented only by ts_rank_cd) 8 divides the rank by the number of unique words in document 16 divides the rank by 1 + the logarithm of the number of unique words in document 32 divides the rank by itself + 1 The integer option controls several behaviors, so it is a bit mask: you can specify one or more behaviors
Edit
git clone [email protected]:casecommons/pg_search.git
cd pg_search
open lib/pg_search/features/tsearch.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-PgSearch--Features--TSearch-normalization-for-pr
# Commit to gitgit add lib/pg_search/features/tsearch.rbgit commit -m "better docs for PgSearch::Features::TSearch#normalization"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-PgSearch--Features--TSearch-normalization-for-pr
hub pull-request
# Celebrate!