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

Make it work with Doctrine Criteria #3

Open
kinncj opened this issue Jul 25, 2016 · 1 comment
Open

Make it work with Doctrine Criteria #3

kinncj opened this issue Jul 25, 2016 · 1 comment

Comments

@kinncj
Copy link
Member

kinncj commented Jul 25, 2016

Once #2 is implemented, figure a way to make it work with Doctrine Common Criteria.
To be honest, I guess this would be a separated project, gotta find a better name though... ElasticDoctrineCriteria sounds gross.

$criteria = Criteria::create()
    ->where(
        Criteria::expr()->orX(
            Criteria::expr()->andX(
                Criteria::expr()->eq("term", "birthday"),
                Criteria::expr()->eq("value", "1987-12-22"),
                Criteria::expr()->eq("boost", 2.0)
            ),
            Criteria::expr()->andX(
                Criteria::expr()->eq("term", "birthday"),
                Criteria::expr()->eq("value", "1988-04-28"),
                Criteria::expr()->eq("boost", 1.0)
            )
        )   
    )
;

$qb = new ElasticQueryBuilder($criteria);

echo $criteria->getQuery();
{
  "query": {
    "bool": {
      "should": [
        {
          "term": {
            "birthday": {
              "value": "1987-12-22",
              "boost": 2.0
            }
          }
        },
        {
          "term": {
            "birthday": {
              "value": "1988-04-28",
              "boost": 1.0
            }
          }
        }
      ]
    }
  }
}
@kinncj kinncj changed the title Make it work with Doctrine Query Builder Make it work with Doctrine Criteria Jul 25, 2016
@kinncj
Copy link
Member Author

kinncj commented Jul 25, 2016

If we decided to go down with #2 (comment)
we may not even need to create a new project, we can assume the above API as the final one.

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

No branches or pull requests

1 participant