<commit_before>Surus
=====

# Description

Surus accelerates ActiveRecord with PostgreSQL specific types and
functionality. It enables indexed searching of serialized arrays and hashes.
It also can control PostgreSQL synchronous commit behavior. By relaxing
PostgreSQL's durability guarantee, transaction commit rate can be increased by
50% or more. It also directly generate JSON in PostgreSQL which can be
substantially faster than converting ActiveRecord objects to JSON.

# Installation

    gem install surus

Or add to your Gemfile.

    gem 'surus'

# Hstore

Hashes can be serialized to an hstore column. hstore is a PostgreSQL key/value
type that can be indexed for fast searching.

    class User < ActiveRecord::Base
      serialize :properties, Surus::Hstore::Serializer.new
    end

    User.create :properties => { :favorite_color => "green", :results_per_page => 20 }
    User.create :properties => { :favorite_colors => ["green", "blue", "red"] }

Even though the underlying hstore can only use strings for keys and values
(and NULL for values) Surus can successfully maintain type for integers,
floats, bigdecimals, dates, and any value that YAML can serialize. It does
this by storing an extra key value pair (or two) to maintain type information.

Because it falls back to YAML serialization for complex types, this means that
nested data structures can be serialized to an hstore. In other words, any
hash that can be serialized with the normal Rails YAML serialization can be
serialized with Surus. But you can get the benefits of PostgreSQL indexing
on the top level keys and values for free.

Hstores can be searched with helper scopes.

    User.hstore_has_pairs(:properties, "favorite_color" => "green")
    User.hstore_has_key(:properties, "favorite_color")
    User.hstore_has_all_keys(:properties, "favorite_color", "gender")
    User.hstore_has_any_keys(:properties, "favorite_color", "favorite_artist")

Hstore is a PostgreSQL extension. You can generate a migration to install it.

    rails g surus:hstore:install
    rake db:migrate


Read more in the [PostgreSQL hstore documentation](http://www.postgresql.org/docs/9.1/static/hstore.html).

# Array
<commit_msg>Add documentation to readme for hstore migrations<commit_after>Surus
=====

# Description

Surus accelerates ActiveRecord with PostgreSQL specific types and
functionality. It enables indexed searching of serialized arrays and hashes.
It also can control PostgreSQL synchronous commit behavior. By relaxing
PostgreSQL's durability guarantee, transaction commit rate can be increased by
50% or more. It also directly generate JSON in PostgreSQL which can be
substantially faster than converting ActiveRecord objects to JSON.

# Installation

    gem install surus

Or add to your Gemfile.

    gem 'surus'

# Hstore

Hashes can be serialized to an hstore column. hstore is a PostgreSQL key/value
type that can be indexed for fast searching.

    class User < ActiveRecord::Base
      serialize :properties, Surus::Hstore::Serializer.new
    end

    User.create :properties => { :favorite_color => "green", :results_per_page => 20 }
    User.create :properties => { :favorite_colors => ["green", "blue", "red"] }

Even though the underlying hstore can only use strings for keys and values
(and NULL for values) Surus can successfully maintain type for integers,
floats, bigdecimals, dates, and any value that YAML can serialize. It does
this by storing an extra key value pair (or two) to maintain type information.

Because it falls back to YAML serialization for complex types, this means that
nested data structures can be serialized to an hstore. In other words, any
hash that can be serialized with the normal Rails YAML serialization can be
serialized with Surus. But you can get the benefits of PostgreSQL indexing
on the top level keys and values for free.

Hstores can be searched with helper scopes.

    User.hstore_has_pairs(:properties, "favorite_color" => "green")
    User.hstore_has_key(:properties, "favorite_color")
    User.hstore_has_all_keys(:properties, "favorite_color", "gender")
    User.hstore_has_any_keys(:properties, "favorite_color", "favorite_artist")

Hstore is a PostgreSQL extension. You can generate a migration to install it.

    rails g surus:hstore:install
    rake db:migrate

You can then use the hstore type in migrations.

    class AddPropertiesToUsers < ActiveRecord::Migration
      def change
        add_column :users, :properties, :hstore
      end
    end

Read more in the [PostgreSQL hstore documentation](http://www.postgresql.org/docs/9.1/static/hstore.html).

# Array

{'fraction_non_alphanumeric': 0.06476066709984839, 'fraction_numerical': 0.002599090318388564, 'mean_word_length': 4.497619047619048, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4451847', 'n_tokens_mistral': 1296, 'n_tokens_neox': 1240, 'n_words': 560}