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

authors: change author a search #114

Merged
merged 2 commits into from
Mar 18, 2020

Conversation

drjova
Copy link
Contributor

@drjova drjova commented Mar 16, 2020

No description provided.

@drjova drjova force-pushed the change-author-search branch 5 times, most recently from 2deecd8 to ea8ab35 Compare March 16, 2020 13:32
@drjova drjova marked this pull request as ready for review March 16, 2020 13:38
@drjova drjova force-pushed the change-author-search branch 2 times, most recently from 0b7027f to bf6850c Compare March 16, 2020 13:55
@drjova
Copy link
Contributor Author

drjova commented Mar 17, 2020

@michamos updated :)

@drjova
Copy link
Contributor Author

drjova commented Mar 17, 2020

# POST records/_doc
{
  "authors": {
    "first_name": "John",
   "last_name": "Smith"
  }
}
# POST records/_doc
{
  "authors": {
    "first_name": "J",
   "last_name": "Smith"
  }
}
# POST records/_doc
{
  "authors": {
      "first_name": "Jane",
  "last_name": "Smith"
  }
}

a John Smith

# POST records/_search
{
  "query": {
    "nested": {
      "path": "authors",
      "query": {
        "bool": {
          "must": [
            {
              "match": {
                "authors.last_name": {
                  "query": "Smith",
                  "operator": "AND"
                }
              }
            },
            {
              "bool": {
                "should": [
                  {
                    "bool": {
                      "should": [
                        {
                          "prefix": {
                            "authors.first_name": "john"
                          }
                        },
                        {
                          "match": {
                            "authors.first_name": {
                              "query": "j."
                            }
                          }
                        }
                      ]
                    }
                  }
                ]
              }
            }
          ]
        }
      }
    }
  }
}

It doesn't include Jane

{
  "took" : 1,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 2,
      "relation" : "eq"
    },
    "max_score" : 2.7348382,
    "hits" : [
      {
        "_index" : "records",
        "_type" : "_doc",
        "_id" : "ZR3253ABFgYe4zxv2ZMf",
        "_score" : 2.7348382,
        "_source" : {
          "authors" : {
            "first_name" : "J",
            "last_name" : "Smith"
          }
        }
      },
      {
        "_index" : "records",
        "_type" : "_doc",
        "_id" : "ZB3253ABFgYe4zxv0ZN8",
        "_score" : 1.8266785,
        "_source" : {
          "authors" : {
            "first_name" : "John",
            "last_name" : "Smith"
          }
        }
      }
    ]
  }
}


@drjova drjova force-pushed the change-author-search branch 6 times, most recently from d18c480 to 6c68e14 Compare March 17, 2020 14:43
@drjova
Copy link
Contributor Author

drjova commented Mar 18, 2020

@michamos updated

@drjova drjova force-pushed the change-author-search branch 2 times, most recently from acc8b37 to ed44bfa Compare March 18, 2020 11:10
@drjova
Copy link
Contributor Author

drjova commented Mar 18, 2020

@michamos updated

@drjova
Copy link
Contributor Author

drjova commented Mar 18, 2020

@michamos ping

@drjova drjova merged commit 009fe05 into inspirehep:master Mar 18, 2020
@drjova drjova deleted the change-author-search branch March 18, 2020 17:33
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.

None yet

2 participants