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 - Query with date inequality acts like equality #2940

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

SearchAPI - Query with date inequality acts like equality #2940

scragraham opened this issue Dec 14, 2018 · 0 comments

Comments

@scragraham
Copy link
Contributor

I have two documents with dates:

       { 
          "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_date_less_than(self):
    """
    Test query less than a certain date
    """
    response = self.app.post(
      '/python/search/search',
      json={"index": "index-1", "query": "date_entered < 2019-04-04"})

    self.assertEquals(response.status_code, 200)
    self.assertIn('documents', response.json())
    documents = response.json()['documents']
    # Should only be one document
    self.assertEquals(len(documents), 1)
    doc = documents[0]
    # Make sure we got the right document back with that date.
    self.assertEquals(doc['date_entered'], '2018-12-12')
    self.assertEquals(doc['text4'], "This is a test of the national broadcasting system")

Expected
One document, with date_entered: 2018

Actual
One document, with date_entered: 2019

Search logs

2018-12-14 23:05:25,597 DEBUG query_parser.py:60 Query: date_entered < 2019-04-05
2018-12-14 23:05:25,598 DEBUG query_parser.py:62 Tree dump:(< (VALUE TEXT date_entered) (VALUE TEXT 2019-04-05))
2018-12-14 23:05:25,598 DEBUG query_parser.py:220 Query string: hawkeyepython27__index-1_date_entered:"2019\-04\-05"
2018-12-14 23:05:25,598 DEBUG query_parser.py:222 Encoded: hawkeyepython27__index-1_date_entered%3A%222019%5C-04%5C-05%22
2018-12-14 23:05:25,598 DEBUG query_parser.py:64 Query string q=_gaeindex_name%3Ahawkeyepython27__index-1+AND+hawkeyepython27__index-1_date_entered%3A%222019%5C-04%5C-05%22
2018-12-14 23:05:25,598 DEBUG query_parser.py:72 Field list:
2018-12-14 23:05:25,598 DEBUG query_parser.py:76 Using default field list
2018-12-14 23:05:25,599 DEBUG query_parser.py:90 SOLR STRING: q=_gaeindex_name%3Ahawkeyepython27__index-1+AND+hawkeyepython27__index-1_date_entered%3A%222019%5C-04%5C-05%22&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&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&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&rows=20&start=0
2018-12-14 23:05:25,599 DEBUG solr_interface.py:331 Solr query: q=_gaeindex_name%3Ahawkeyepython27__index-1+AND+hawkeyepython27__index-1_date_entered%3A%222019%5C-04%5C-05%22&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&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&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&rows=20&start=0
2018-12-14 23:05:25,599 DEBUG solr_interface.py:350 SOLR URL: http://192.168.33.12:8983/solr/select/?wt=json&q=_gaeindex_name%3Ahawkeyepython27__index-1+AND+hawkeyepython27__index-1_date_entered%3A%222019%5C-04%5C-05%22&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&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&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&rows=20&start=0
2018-12-14 23:05:25,601 DEBUG solr_interface.py:361 Response: {'responseHeader': {'status': 0, 'QTime': 1, 'params': {'defType': 'edismax', 'rows': '20', 'q': '_gaeindex_name:hawkeyepython27__index-1 AND hawkeyepython27__index-1_date_entered:"2019\\-04\\-05"', 'start': '0', 'wt': 'json', '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', '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', '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'}}, 'response': {'start': 0, 'numFound': 0, 'docs': []}} 
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