Permalink
Commits on Oct 13, 2012
Commits on Oct 12, 2012
  1. [FIX] Fixed incorrect Rake import task

    Closes #479.
    karmi committed Oct 12, 2012
Commits on Sep 23, 2012
  1. [#334] Moved the test for `sort` option not bubbling into URL params …

    …to proper place
    
    
    Closes #334.
    karmi committed Sep 23, 2012
  2. [#334] Use `options.delete(:sort)` in model search to halt bubbling o…

    …f `sort` into URL parameters
    
    When the query is provided as hash, the params get concatenated, producing a query like this:
    
        curl -X GET "http://localhost:9200/graylog2/message/_search?from=0&page=1&per_page=100&size=100&sort=created_at+desc&pretty=true" -d '{"query":{"query_string":{"query":"*"}},"sort":[{"created_at":"desc"}],"size":100,"from":0}'
    
    It produces an error:
    
        Parse Failure [No mapping found for [created_at desc] in order to sort on]
    
    I don't know whether the other parameters should be there, as they're duplicated in the query, but at least they don't make the request invalid.
    romanbsd committed with karmi May 7, 2012
Commits on Sep 22, 2012
  1. Added prettified JSON output for logging requests and responses at th…

    …e `debug` level
    
    Instead of displaying the request payloads and elasticsearch response as one lump,
    use the `pretty` option in the JSON decoder/encoder by default:
    
        # 2012-09-21 17:29:47:506 [DELETE] ("articles")
        #
        curl -X DELETE http://localhost:9200/articles
    
        # 2012-09-21 17:29:47:508 [200]
        #
        # {
        #   "ok": true,
        #   "acknowledged": true
        # }
    
        # 2012-09-21 17:29:47:555 [CREATE] ("articles")
        #
        curl -X POST http://localhost:9200/articles -d '{
          "mapping": {
            "title": {
              "type": "string",
              "analyzer": "snowball"
            }
          }
        }'
    
        # 2012-09-22 10:43:58:851 [_search] (["logger-articles"])
        #
        curl -X GET "http://localhost:9200/logger-articles/_search?pretty=true" -d '{
          "query": {
            "query_string": {
              "query": "One"
            }
          }
        }'
    
    To disable the default, set `Tire::Configure.pretty(false)`.
    karmi committed Aug 8, 2012
  2. Added the `Tire::Configuration.pretty` option for JSON output

    * The option is set to `true` by default
    * Pass a truthy value to set the option to "true" or false/nil or false/nil to set the option to "false"
    karmi committed Sep 22, 2012
Commits on Sep 21, 2012
  1. Release 0.4.3

    karmi committed Sep 21, 2012
Commits on Sep 4, 2012
Commits on Aug 21, 2012
Commits on Jul 25, 2012
  1. [FIX] Fixed errors in the "terms" facet on Ruby 1.8

    In Ruby 1.8.x:
    
        "hello".is_a?(Enumerable)
        # => true
    
        "hello".respond_to?(:each)
        # => true
    
    Can be confusing, yeah. You should upgrade to 1.9 :)
    karmi committed Jul 25, 2012
  2. [#300] Added DisMaxQuery#to_json

    Closes #415.
    nbudin committed with karmi Jul 25, 2012
  3. [#300] Added an example for "Dis Max Query" based on elasticsearch do…

    …cumentation
    
    NOTE: The dis_max query gives exactly the same result as a boolean query:
    
        boolean = Tire.search 'dis_max_test' do
          query do
            boolean do
              should { string "albino",   fields: ['title', 'text'] }
              should { string "elephant", fields: ['title', 'text'] }
            end
          end
        end
    
    This seems to contradict <http://www.elasticsearch.org/guide/reference/query-dsl/dis-max-query.html>?
    
    > We want the primary score to be the one associated with the highest boost,
    > not the sum of the field scores (as Boolean Query would give).
    > If the query is “albino elephant” this ensures that “albino” matching one field
    > and “elephant” matching another gets a higher score than “albino” matching both fields.
    karmi committed Jul 25, 2012
  4. [#300] Added the "Dis Max Query"

    Usage:
    
    Tire.search 'index' do
      query do
        dis_max do
          query { string 'foo' }
          query { terms :tags, ['baz'] }
        end
      end
    end
    
    See http://www.elasticsearch.org/guide/reference/query-dsl/dis-max-query.html
    
    Closes #300.
    hajder committed with karmi Apr 3, 2012
Commits on Jul 23, 2012
  1. Fix typo (s/operation/operating/) system

    Closes #412
    Rich Healey committed with karmi Jul 22, 2012
Commits on Jul 13, 2012
  1. [CI] Added running functional tests against live elasticsearch at Tra…

    …vis CI [http://travis-ci.org/#!/karmi/tire]
    
    Squashed from the `karmi/tire@travis` branch:
    
    c2d7f0d ‣ Restructuring the Travis configuration
    79f454d ‣ Added running integration tests against live elasticsearch on Travis
    d1c4374 ‣ Allow build failures on 1.8.7 and REE
    b4fa8a0 ‣ Changed, that integration tests are run only on Ruby 1.9, unit tests on all Rubies
    karmi committed Jun 25, 2012
  2. [FIX] Fixes Ruby 1.8.7 incompatibility

    * Fixes karmi/retire@6c3b852 by @karmi (incorrect trailing dot)
    * Fixes karmi/retire@ce47d00 by @karmi (Hash order)
    karmi committed Jul 13, 2012
  3. [ACTIVEMODEL] Allow to pass :version option in Tire::Model::Search::C…

    …lassMethods#search
    karmi committed Jul 13, 2012
Commits on Jul 12, 2012
Commits on Jul 11, 2012
  1. [FIX] Fixed incorrect `Results::Item#to_hash` serialization

    Without this fix, `Item#to_hash` returned `Item` instances for nested Hashes.
    
    This commit calls `to_hash` recursively in `Item#to_hash`
    karmi committed Jul 11, 2012
Commits on Jun 25, 2012
  1. [TESTS] Fixed errors on Ruby 1.8

    * Changed Ruby 1.9 hashes to hashrocket syntax
    * Changed regex to allow different URL parts order
    karmi committed Jun 25, 2012
  2. Patch Test::Unit::Assertion#assert on Ruby 1.8 to return true on success

    Our Mocha `with do ... end` blocks fail otherwise.
    karmi committed Jun 25, 2012
Commits on Jun 24, 2012
  1. [#366] Cleaned up the Update API support and added an integration tes…

    …t suite
    
    This patch expands karmi/retire@f620b36.
    
    * Polished the `curl` output from the API call
    * Added the ability to pass URL parameters (timeout, refresh, etc)
    * Cleaned up the unit tests
    * Added a separate integration test for resilience and documentation
    
    Example usage
    -------------
    
    Update a counter:
    
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ruby
      Tire.index('articles-with-tags') { update( 'article', '1', :script => "ctx._source.views += 1" ) and refresh }
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Add a tag to the document:
    
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ruby
        Tire.index('articles-with-tags') do
          update 'article', '1', :script => "ctx._source.tags += tag",
                                 :params => { :tag => 'new-tag' }
          refresh
        end
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Set a title of the document:
    
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ruby
      @title = 'Foo Is Now Bar!'
    
      Tire.index('articles-with-tags') do |index|
    
        index.update 'article', '1', :script => "ctx._source.title = title",
                                     :params => { :title => @title }
        index.refresh
      end
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    See <http://www.elasticsearch.org/guide/reference/api/update.html> for more documentation.
    
    ---
    
    Closes #366.
    karmi committed Jun 24, 2012
  2. [#366] Added support for the Update API in Tire::Index

    Usage:
    
        tags = ['a', 'b', 'c']
    
        Tire.index 'my_index' do
          update 'document_type', 'document_id', {
            :script => "_ctx._source.tags = tags;',
            :params => {:tags => tags}
          }
        end
    ahfeel committed with karmi Jun 4, 2012
Commits on Jun 20, 2012
  1. [#352] Added MyModel#new_record? for Tire::Persistence

    Commit <erickt@40cb975> rewritten and cleaned up by @karmi
    erickt committed with karmi Apr 27, 2012
  2. [#352] Added, that accessing Tire::Search#json forces perform

    Conflicts:
    
    	lib/tire/search.rb
    erickt committed with karmi May 8, 2012