Fixed Index.retrieve so that it works with ES 1.0.0 and previous versions #939

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
@jonstokes
Contributor

jonstokes commented Feb 21, 2014

The latest version of ES breaks the Index#retrieve function, and it no longer returns nil as it should. This fixes it.

@karmi karmi closed this in 7289d0f Feb 22, 2014

@karmi

This comment has been minimized.

Show comment Hide comment
@karmi

karmi Feb 22, 2014

Owner
@@ -364,7 +364,7 @@ def retrieve(type, id, options={})
wrapper = options[:wrapper] || Configuration.wrapper
if wrapper == Hash then h
else
- return nil if h['exists'] == false
+ return nil if (h['exists'] || h['found']) == false

This comment has been minimized.

Show comment Hide comment
@karmi

karmi Apr 12, 2014

Owner

@jonstokes This wasn't actually working I think :)

(false || nil) == false
# => false
@karmi

karmi Apr 12, 2014

Owner

@jonstokes This wasn't actually working I think :)

(false || nil) == false
# => false

This comment has been minimized.

Show comment Hide comment
@jonstokes

jonstokes Apr 13, 2014

Contributor

It works for me.
On Apr 12, 2014 3:45 AM, "Karel Minarik" notifications@github.com wrote:

In lib/tire/index.rb:

@@ -364,7 +364,7 @@ def retrieve(type, id, options={})
wrapper = options[:wrapper] || Configuration.wrapper
if wrapper == Hash then h
else

  •    return nil if h['exists'] == false
    
  •    return nil if (h['exists'] || h['found']) == false
    

@jonstokes https://github.com/jonstokes This wasn't actually working I
think :)

(false || nil) == false# => false

Reply to this email directly or view it on GitHubhttps://github.com/karmi/retire/pull/939/files#r11559105
.

@jonstokes

jonstokes Apr 13, 2014

Contributor

It works for me.
On Apr 12, 2014 3:45 AM, "Karel Minarik" notifications@github.com wrote:

In lib/tire/index.rb:

@@ -364,7 +364,7 @@ def retrieve(type, id, options={})
wrapper = options[:wrapper] || Configuration.wrapper
if wrapper == Hash then h
else

  •    return nil if h['exists'] == false
    
  •    return nil if (h['exists'] || h['found']) == false
    

@jonstokes https://github.com/jonstokes This wasn't actually working I
think :)

(false || nil) == false# => false

Reply to this email directly or view it on GitHubhttps://github.com/karmi/retire/pull/939/files#r11559105
.

karmi added a commit that referenced this pull request Apr 12, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment