Skip to content

Search parametters don't accept lists of strings (and should) #85

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

Closed
eskombro opened this issue May 29, 2020 · 0 comments · Fixed by #87
Closed

Search parametters don't accept lists of strings (and should) #85

eskombro opened this issue May 29, 2020 · 0 comments · Fixed by #87
Assignees
Labels
bug Something isn't working

Comments

@eskombro
Copy link
Member

eskombro commented May 29, 2020

While working in the improve tests PR, #80, we realized that the search parameters like attributesToRetrieve can't handle a list of strings. you should be able to pass a list of fields, not just a single field or '*'.

The test we did and failed was:

    def test_basic_search_params_with_string_list(self):
        """Tests search with string list in query params"""
        response = self.index.search(
            'a',
            {
                'limit': 5,
                'attributesToRetrieve': ['title', 'overview'],
            }
        )
        assert isinstance(response, object)
        assert len(response['hits']) == 5
        assert "title" in response['hits'][0]
        assert "overview" in response['hits'][0]
        assert not "release_date" in response['hits'][0]

And the error shows that MeiliSearch response is sending all the fields

E       AssertionError: assert not 'release_date' in {'id': '537915', 'overview': 'A young woman falls for a guy with a dark secret and the two embark on a rocky relationship.', 'poster': 'https://image.tmdb.org/t/p/w1280/u3B2YKUjWABcxXZ6Nm9h10hLUbh.jpg', 'release_date': 1554944400, ...}

THIS TEST SHOULD BE ADDED WHEN ISSUE IS FIXED

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant