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

Search parameters should be optional #4

Closed
curquiza opened this issue Mar 24, 2020 · 3 comments
Closed

Search parameters should be optional #4

curquiza opened this issue Mar 24, 2020 · 3 comments

Comments

@curquiza
Copy link
Member

curquiza commented Mar 24, 2020

The search returns no result if I don't pass the Limit parameter. It does not fail. It just returns empty Hits.

_, err := client.Search("indexUID").Search(meilisearch.SearchRequest{
	Query: "harry pottre",
})

=> no result

_, err := client.Search("indexUID").Search(meilisearch.SearchRequest{
	Query: "harry pottre",
        Limit: 10,
})

=> result

We should be able to pass only the Query parameter

Edit

I understand that 2 parameters at least are needed because

searchRes, err := client.Search("indexUID").Search(meilisearch.SearchRequest{
	Query: "harry pottre",
	AttributesToHighlight: "*",
})

returns results as well.

My bad, it does not even run at all, I open an issue for that: #7

Version

v0.9.0 of MeiliSearch.

@curquiza curquiza changed the title Limit parameter during search should be optional Search parameters should be optional Mar 24, 2020
@alexisvisco
Copy link
Contributor

Hi thanks for your report: The default value of an int in Go is 0 so if you don't initialize the field Limit from the SearchRequest you get 0 result: it's normal.

Maybe we can provide a default limit in accordance to the MeiliSearch engine ?

@curquiza
Copy link
Member Author

Hi!

The MeiliSearch engine uses a limit of 20 by default.

But isn't it possible to provide a function that sends a simple request without any parameter if the user does not provide any? 🙂 Except for the mandatory one (query) of course

@alexisvisco
Copy link
Contributor

With the fix added in dev it should be possible :)

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

2 participants