Skip to content
This repository has been archived by the owner on Mar 4, 2019. It is now read-only.

Boolean with range queries fail #6

Closed
ryantology opened this issue Oct 7, 2012 · 3 comments
Closed

Boolean with range queries fail #6

ryantology opened this issue Oct 7, 2012 · 3 comments

Comments

@ryantology
Copy link
Contributor

I ran into some issues with boolean matches against fileds mapped as range (integers in particular).

This is a temp fix for this
https://github.com/ryantology/CakePHP-Elastic-Search-DataSource/commit/3badc2d14e65d6334106696529c320c9703e0925

The real issue is that the coupling of boolean searches and the range operators should be separated in some way. Not sure if you guys have run into the same issue.

The patch allows this query to work:

'conditions' => array(
    'bool' => array(
        'user_id must' => 2134,
        'content_type must_not' => 342
    )
)
@lorenzo
Copy link
Collaborator

lorenzo commented Dec 1, 2012

I will take a look at this

@sarce
Copy link
Contributor

sarce commented Jan 17, 2013

It's awkward, I know, but did you try adding the = operator in the keys?¿ :)

'conditions' => array(
    'bool' => array(
        'user_id must =' => 2134,
        'content_type must_not =' => 342
    )
)

@dkullmann
Copy link
Collaborator

I tried to make the conditions confirm to the CakePHP ORM as much as possible, but at some point this breaks down because SQL supports different functionality than ElasticSearch.

The idea is that you should be able to very easily switch data sources with as few changes as possible.

Based on that principle, I'd probably use = and !=, and perhaps even <> for should not (or something similar).

What do you guys think?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants