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

SearchAPI - AND query returns no documents #2939

Open
scragraham opened this issue Dec 14, 2018 · 0 comments
Open

SearchAPI - AND query returns no documents #2939

scragraham opened this issue Dec 14, 2018 · 0 comments

Comments

@scragraham
Copy link
Contributor

Summary
When running a search with an AND query, I epxected to get 2 documents back, instead an empty document list is returned.

Steps to Reproduce
Input json:

{"index": "index-1", "documents": [
        {
          "id": "a",
          "text1": "hello world",
          "text2": "testing search api and world"
        },
        {
          "id": "b",
          "anotherText": "There is also a corresponding asynchronous method, "
        },
        {
          "id": "c",
          "text3": "This string also contains the word world and api"
        },
        {
          "id": "firstdate",
          "date_entered": "2018-12-12",
          "text4": "This is a test of the national broadcasting system"
        },
        {
          "id": "seconddate",
          "date_entered": "2019-04-04",
          "text5": "Who are the britons?"
        }
      ]}

UnitTest

  def test_search_query_AND_two_results(self):
    response = self.app.post(
      '/python/search/search',
      json={"index": "index-1", "query": "world AND api"})

    self.assertEquals(response.status_code, 200)
    self.assertIn('documents', response.json())
    documents = response.json()['documents']
    self.assertEquals(len(documents), 2)

Test Failure

======================================================================
FAIL: test_search_query_AND_two_results (tests.search_tests.SearchTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/root/hawkeye/test-suite/tests/search_tests.py", line 94, in test_search_query_AND_two_results
    self.assertEquals(len(documents), 2)
AssertionError: 0 != 2

Expected
Two documents id: a, id: c

Actual
No documents.

SearchAPI logs

{
    "response": {
        "docs": [],
        "numFound": 0,
        "start": 0
    },
    "responseHeader": {
        "QTime": 10,
        "params": {
            "defType": "edismax",
            "fl": "id _gaeindex_locale hawkeyepython27__index-1_anotherText hawkeyepython27__index-1_date_entered hawkeyepython27__index-1_text1 hawkeyepython27__index-1_text2 hawkeyepython27__index-1_text3 hawkeyepython27__index-1_text4 hawkeyepython27__index-1_text5",
            "pf": "hawkeyepython27__index-1_anotherText hawkeyepython27__index-1_date_entered hawkeyepython27__index-1_text1 hawkeyepython27__index-1_text2 hawkeyepython27__index-1_text3 hawkeyepython27__index-1_text4 hawkeyepython27__index-1_text5",
            "q": "_gaeindex_name:hawkeyepython27__index-1 AND (%22world%22 AND%22api%22)",
            "qf": "hawkeyepython27__index-1_anotherText hawkeyepython27__index-1_date_entered hawkeyepython27__index-1_text1 hawkeyepython27__index-1_text2 hawkeyepython27__index-1_text3 hawkeyepython27__index-1_text4 hawkeyepython27__index-1_text5",
            "rows": "20",
            "start": "0",
            "wt": "json"
        },
        "status": 0
    }
}
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