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

Improve Query and SearchResults #46

Merged
merged 25 commits into from
Oct 19, 2020
Merged

Improve Query and SearchResults #46

merged 25 commits into from
Oct 19, 2020

Conversation

Mubelotix
Copy link
Collaborator

@Mubelotix Mubelotix commented Aug 21, 2020

Will close #41

TODO

Query

  • Add the matches option
  • Change attributes_to_crop into an array
  • Change attributes_to_highlight into an array
  • Change attributes_to_retrieve into an array
  • Change method of the search route from GET to POST
  • Make the query string optional

Results

  • Support matches_info
  • Support formatted results

@Mubelotix
Copy link
Collaborator Author

It will also close #45

@Mubelotix Mubelotix linked an issue Aug 22, 2020 that may be closed by this pull request
@Mubelotix Mubelotix marked this pull request as ready for review August 22, 2020 08:31
Copy link
Member

@curquiza curquiza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for these changes!

Some questions:

  • are there any tests for the search method but with optional parameters (attributesToCrop, facetsDistribution...)? If not, can you add some of them? 🙂
  • Do your changes involve modification in this PR Add code-sample file #40?

I put the breaking-changes flag since your changes seem to be breaking! (this flag will automatically increase the minor number of the version instead of the patch one)

src/search.rs Outdated Show resolved Hide resolved
src/search.rs Outdated Show resolved Hide resolved
@curquiza curquiza added the breaking-change The related changes are breaking for the users label Aug 22, 2020
/// The object that contains information about the matches.
#[serde(rename = "_matchesInfo")]
pub matches_info: Option<HashMap<String, Vec<MatchRange>>>
}

#[derive(Deserialize, Debug)]
#[serde(rename_all = "camelCase")]
/// A struct containing search results and other information about the search.
pub struct SearchResults<T> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could make it a serde_json::Value when the user don't specify it?
On the SearchResults or SearchResult structs, I don't know, what do you think about that?

struct SearchResults<T: Value> {

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if it would be useful in some cases. But is this possible without making a new method ? If yes we could do it anyway

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand, why would it need a new method? The T type must implement Ser/Deserialize so it works with serde_json::Value if the user doesn't specify the T type itself.

Ask me any question, I am not sure my message above helps much, and also, this is not mandatory to implement.

src/search.rs Outdated Show resolved Hide resolved
@Mubelotix
Copy link
Collaborator Author

Yes it's a breaking change so there will be some things to change in the sample file @curquiza

@Mubelotix
Copy link
Collaborator Author

@curquiza I think it would be better to write new tests when we improve the existing ones (see #29). There will be major changes soon.

@curquiza
Copy link
Member

curquiza commented Sep 9, 2020

Okay, @Mubelotix, but it should be done soon in case there is an error. For the momebt, I have no proof it works without any test.

@curquiza
Copy link
Member

curquiza commented Sep 9, 2020

Have all the changes asked @Kerollmops been taken into account? Is this PR ready for merging?

@Mubelotix Mubelotix linked an issue Sep 24, 2020 that may be closed by this pull request
@Mubelotix
Copy link
Collaborator Author

Let's merge fast so we can merge #40 too.

Copy link
Member

@Kerollmops Kerollmops left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great work 😄 But maybe you could chnage the builder a little bit!

README.md Outdated Show resolved Hide resolved
src/search.rs Outdated Show resolved Hide resolved
src/search.rs Outdated Show resolved Hide resolved
src/search.rs Outdated Show resolved Hide resolved
src/search.rs Outdated Show resolved Hide resolved
Mubelotix and others added 4 commits October 11, 2020 10:27
Co-authored-by: Kerollmops <clement@meilisearch.com>
@curquiza
Copy link
Member

bors try

bors bot added a commit that referenced this pull request Oct 12, 2020
@bors
Copy link
Contributor

bors bot commented Oct 12, 2020

try

Build failed:

@curquiza
Copy link
Member

curquiza commented Oct 12, 2020

@Mubelotix, the tests fail when you make your branch up to date with master. It will be impossible to merge even if Kero approves your PR.
Maybe you should rebase your branch to check what's wrong 🙂

Copy link
Member

@Kerollmops Kerollmops left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for these changes, I started to complain about the build, execute and execute_query but it is not that bad in fact.

I think the Index::execute_query is here just to be able to use the same query on multiple indexes 👍

@curquiza
Copy link
Member

bors try

bors bot added a commit that referenced this pull request Oct 19, 2020
@bors
Copy link
Contributor

bors bot commented Oct 19, 2020

try

Build succeeded:

Copy link
Member

@curquiza curquiza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@curquiza
Copy link
Member

bors merge

@bors
Copy link
Contributor

bors bot commented Oct 19, 2020

Build succeeded:

@bors bors bot merged commit 6e89e9e into master Oct 19, 2020
@bors bors bot deleted the search-improvements branch October 19, 2020 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change The related changes are breaking for the users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Empty query returns no results Change search route method Improve Query and SearchResults
3 participants