Code Monkey home page Code Monkey logo

Comments (3)

moy2010 avatar moy2010 commented on June 2, 2024 1

This is not a bug. When you search with Meilisearch's client it will return the SearchResults wrapper around whatever document model you are using for your documents (in this case, you are using crate::models::Posting).

SearchResults is just the response object with the details for the search result (i.e. how many hits or results were returned, in what page you are in case that you are using pagination, etc.) and it's obviously not meant to be exposed to the user, hence why I guess it doesn't implement Serialize. It's the API telling you that you are doing something wrong.

In your case, I would just extract the hits from it and send the response to the consumer of the /search-test endpoint.

from meilisearch-rust.

fiik346 avatar fiik346 commented on June 2, 2024 1

What is the solutions for this case?

from meilisearch-rust.

CommanderStorm avatar CommanderStorm commented on June 2, 2024 1

What is the solutions for this case?

The solution is entirely dependent on what you WANT the API to return.
Example:

  • do you want the formatted or unformatted resutlt?
  • do you want where the search matches
  • What other statisitcs (facets, paging, ) do you want?

I would say that adding your own struct for these return types is better because then you will get notified earlier (via compilation errors) of any changes you will need to migrate around.

from meilisearch-rust.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.