Skip to content

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

Closed
@eskombro

Description

@eskombro

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions