Removed the `HRULE` constant from the import Rake task
[FIX] Fix `Item#to_hash` functionality to work with Arrays

I have extended the nested to_hash method by the functionality to cover
arrays containing to_hash'able elements as well. I could not find a way
to integrate it into the existing statement. Instead, I have added an
additional case specifically for arrays.

I have added a failing unit test case to reveal a problem with the
to_hash method. Previously, the method did not cover the case where
a Results::Item contains an array value with Results::Item objects.
In this case the Results::Item objects were not converted to a Hash.

Signed-off-by: Konrad Reiche <konrad.reiche@gmail.com>

Closes #722
Updated the Rails application template to use the new download location and version (0.20.6)
Updated the install instructions to use version 0.20.6
Make sure an Array is returned from `__get_results_with_load`

Fixes the `undefined method `detect'` error when single record is returned from `__get_results_with_load`

If you use load: true when the search would return a single object it raises an error:

    NoMethodError:
    undefined method `detect' for #<--elastic search persistance model-->

This has been fixed before but it must have been lost when the code was refactored.

See also: <http://stackoverflow.com/questions/10592005/tire-gem-undefined-method-detect>

Related: #353

Closes #725
[TEST] Use `dfs_query_then_fetch` to prevent sporadic failures in BoostingQueriesIntegrationTest and ConstantScoreQueriesIntegrationTest

Without this patch, the tests consistently fail couple of times per batch of 15 runs.

    rm -f results.txt
    time for i in {1..15}
      do
        echo "-------------------------------------------------------------------------------"
        echo "TEST $i"
        echo "-------------------------------------------------------------------------------"
        ruby -I lib:test test/integration/boosting_queries_test.rb
      if [ $? == 0 ]; then echo "$i: OK" >> results.txt; else echo "$i: FAIL">> results.txt; fi
    done

    echo; echo; echo "==============================================================================="
    cat results.txt

See <http://www.elasticsearch.org/guide/reference/api/search/search-type/>

Closes #721
[TEST] Delete registered queries to prevent <PercolatorIntegrationTest> failures

Potentially, prepare deleting the whole `_percolator` index on Travis-CI

Verified with:

Download or clone this [gist](https://gist.github.com/4239703):

    git clone git://gist.github.com/4239703.git elasticsearch_vagrant && cd elasticsearch_vagrant

Run bundle install, etc. Then, configure ES:

    echo '
    {
      "elasticsearch" : {
        "cluster_name" : "elasticsearch_test_in_vagrant",
        "index_shards" : 1,
        "index_replicas" : 0
      }
    }' > node.json

Install Ruby 1.9.3, _Tire_, etc:

    echo '
    # Install the Tire Rubygem
    apt-get install make git libcurl3 libcurl3-gnutls libcurl4-openssl-dev libsqlite3-dev -y
    apt-get install redis-server  -y
    apt-get install ruby1.9.3 -y
    update-alternatives --set ruby /usr/bin/ruby1.9.1
    gem install bundler --no-rdoc --no-ri
    test -d "tire" || git clone git://github.com/karmi/tire.git
    chown -R vagrant:staff tire
    cd tire
    bundle install
    ' > install.sh

Build and provision the machine:

    NODE_CONFIG=node.json INSTALL=install.sh time bundle exec vagrant up

Run the Tire tests:

    echo '
    cd tire

    echo "Running Tire tests in '`pwd`'"
    echo "Ruby: `ruby -v`"
    echo "Java: `java -version 2>&1 | head -1`"

    for i in {1..5}
      do
        echo "-------------------------------------------------------------------------------"
        echo "TEST $i"
        echo "-------------------------------------------------------------------------------"
        time bundle exec rake test
      if [ $? == 0 ]; then echo "$i: OK" >> results.txt; else echo "$i: FAIL">> results.txt; fi
    done

    echo; echo; echo "==============================================================================="
    cat results.txt
    ' > run_tire_tests.sh

    cat run_tire_tests.sh | xargs -0 bundle exec vagrant ssh -c

Related: #537

Closes #541
[SETUP] Update Travis-CI configuration (remove REE, restructure)
[SETUP] Use only "shoulda-context", not "shoulda"

The "shoulda" gem brings in the "shoulda-matchers" gem, which is not neccessary,
slows down the require time, and fails on 1.8.7:

    Gem::InstallError: shoulda-matchers requires Ruby version >= 1.9.2.

See <https://travis-ci.org/karmi/tire/jobs/7104954>
[TEST] Delete the whole percolator index on Travis

Still failing... <https://travis-ci.org/karmi/tire/builds/7104949>

Related: #541
[TEST] Clean up percolator for <ActiveRecordSearchableIntegrationTest> and <PersistentModelIntegrationTest>

* Delete the registered queries in setup
* Wipe the whole _percolator index on Travis in setup

Related: #537, #541
Few hacks for STI support.
Add a config option to disable callbacks. Useful for testing when tests
don't require them.
Stop the collection array craziness.
Hook touch.