Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update #1

Merged
merged 34 commits into from
Oct 23, 2012
Merged

update #1

merged 34 commits into from
Oct 23, 2012

Conversation

NOX73
Copy link
Owner

@NOX73 NOX73 commented Oct 23, 2012

uodate origin

bgadoury and others added 30 commits October 12, 2012 08:38
… task

Previously, all records had to be loaded into memory (errr),
better to use the `Model.count` method

Closes #471
…ce as lambdas

Now, it's possible to do:

    class MyModel
      include Tire::Model::Persistence

      property :created_at, :default => lambda { Time.now }
    end

Note though, that the lambda is evaluated when you create the object, not when you access the property.

Closes #459
Use "tmp" or "scratch" folders for things you wanna keep along the project,
but not version them.
Previously, the `filter` facet type in Tire's DSL had the `terms` filter hardcoded.

With this patch, it's possible to use [any DSL method](https://github.com/karmi/tire/blob/master/lib/tire/search/facet.rb)
for the facet declaration.

See <http://www.elasticsearch.org/guide/reference/api/search/facets/filter-facet.html> for documentation.

Closes #425.
…ctiveSupport

ActiveSupport, in many cases, calls `to_json` methods with arguments.

This patch adds optional argument to all `to_json` methods to guard against that.
Allows finders and other users of retrieve to set wrappers safely
without race conditions due to the use of a global wrapper variable.
Using the :wrapper option avoids thread-safety issues with the global
wrapper config variable. In a threaded environment this would manifest
with searches occasionally being wrapped with the wrong model class.

Closes #453
Example Query:

``` ruby
Tire.search(@@index_name) do
  query do
    boolean do
      should do
        term :level, { value: "high",   boost: 3}
      end
    end
  end
end
```

More information about this can be found in #422 where there is more example code.

The resulting JSON output of the above is:

``` json
{
  "query": {
    "bool": {
      "should": [{
        "term": {
          "level": {
            "value": "high",
            "boost": 3
          }
        }
      }]
    }
  }
}�
```

This does not break any other behaviour.

Closes #422, closes #423.
…ted in elasticsearch

Previously, when the index could not be created due to eg. error in mapping,
it was silently ignored and data were still indexed (with dynamic mapping).

This was a source of hard-to-pin-down errors. When there's an error while
creating the index, the Rake task will exit(1) and print the HTTP response, now.

Closes #392
…ated on class load

Note, though, that for most production settings, it does _not_ make sense to rely
on automatic index creation. Create your indices properly, in advance,
in a controlled manner.

Closes #293
…tion are indexed

Previously, objects other then `String` or `Proc` were silently discarded
when evaluating the `:as` mapping option.

With this change, you may pass whatever object you like in the `:as` mapping option:

    class MyModel
        include Some::ORM
        include Tire::Model::Search

        mapping do
          indexes :field, :type => 'string', :analyzer => 'keyword', :as => SomeOtherObject.whatever
        end
      end
    end

    class MyModel
        include Some::ORM
        include Tire::Model::Search

        mapping do
          indexes :field, :type => 'string', :analyzer => 'keyword', :as => [1, 2, 3]
        end
      end
    end

This commit is a conceptual opposite of 0ccee42. Until #446 is decided,
this change brings some consistency to the behaviour.
* Restructure the code
* Use `params` Hash to encode URL parameters for elasticsearch
* Prepare solving #256 in a more robust way
This patch builds upon work in nickhoffman/tire@978d632 by @nickhoffman,
and the refactoring in 01828d3.

It allows to pass a `parent` parameter to Index#store.

See "Parents & Children" in <http://www.elasticsearch.org/guide/reference/api/index_.html>

Note, that adding support for other URL parameters, such as routing, timestamp, TTL, etc.
is just a matter of adding proper key in the `params` hash and adding tests.

Closes #256.
@NOX73 NOX73 merged commit 1c16b68 into NOX73:master Oct 23, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.