lukePeavey / quotable

Random Quotes API
MIT License
1.85k stars 224 forks source link

Querying for author or quotes returns unexpected empty array #179

Closed eliasljubec closed 1 year ago

eliasljubec commented 1 year ago

Describe the bug When I query for either an author or quote, I receive an empty array as a result. This outcome is unexpected, given that I have used the example links provided in the documentation and also tested with generic search terms, but still encountered the same issue.

To Reproduce

  1. Open an API client (Postman or Chrome)
  2. Make the following API request
GET https://api.quotable.io/search/quotes?query=life+happiness
GET https://api.quotable.io/search/authors?query=einstein

Expected Response Should not be empty

Actual Response

{
count: 0,
totalCount: 0,
page: 1,
totalPages: 0,
lastItemIndex: null,
results: [ ]
}
lukePeavey commented 1 year ago

Thanks for reporting. Working on fixing this issue

lukePeavey commented 1 year ago

This issue has been fixed

GET https://api.quotable.io/search/authors?query=einstein
{
  "count": 1,
  "totalCount": 1,
  "page": 1,
  "totalPages": 1,
  "lastItemIndex": null,
  "results": [
    {
      "_id": "L76FRuEeGIUJ",
      "name": "Albert Einstein",
      "link": "https://en.wikipedia.org/wiki/Albert_Einstein",
      "bio": "Albert Einstein (14 March 1879 – 18 April 1955) was a German-born theoretical physicist who developed the theory of relativity, one of the two pillars of modern physics (alongside quantum mechanics). His work is also known for its influence on the philosophy of science.",
      "description": "Theoretical physicist",
      "quoteCount": 30,
      "slug": "albert-einstein",
      "dateAdded": "2019-07-03",
      "dateModified": "2019-07-03"
    }
  ]
}
GET https://api.quotable.io/search/quotes?query=life+happiness

{
  "count": 20,
  "totalCount": 212,
  "page": 1,
  "totalPages": 11,
  "lastItemIndex": 20,
  "results": [
    {
      "_id": "NZx4vMwOCDxJ",
      "content": "There is only one happiness in life, to love and be loved.",
      "author": "George Sand",
      "tags": [
        "famous-quotes"
      ],
      "authorId": "9XleFuFL2nyc",
      "authorSlug": "george-sand",
      "length": 58,
      "dateAdded": "2019-10-18",
      "dateModified": "2019-10-18"
    },
    {
      "_id": "0umC2Yk5UX",
      "author": "The Buddha",
      "content": "One should train in deeds of merit—generosity, a balanced life, developing a loving mind—that yield long-lasting happiness.",
      "tags": [
        "wisdom",
        "happiness"
      ],
      "authorId": "bKQiIqr83",
      "authorSlug": "the-buddha",
      "length": 123,
      "dateAdded": "2023-03-30",
      "dateModified": "2023-03-30"
    },
    {
      "_id": "wQNfb7IAqrk",
      "content": "There is no way to happiness, happiness is the way.",
      "author": "Thích Nhất Hạnh",
      "tags": [
        "famous-quotes"
      ],
      "authorId": "N0pHADD097gY",
      "authorSlug": "thich-nhat-hanh",
      "length": 51,
      "dateAdded": "2020-03-07",
      "dateModified": "2020-03-07"
    }