Skip to content

AlgoliaEngine::map does not respect the order of the Engine results #341

Closed
@nunomaduro

Description

@nunomaduro

Context: Engines, like Algolia, allow to define the ranking - order of the results.

An example could be: I want products to be sorted by the quantity, so when I type "iphone" i want to get the ones that I have more in stock.

Problem: The method AlgoliaEngine::map does not return the models in the same order of the returned results by Algolia. Mainly because a whereIn is applied behind-the-scenes.

Solution: Sort the models by the same order of the given results just before returning the result of AlgoliaEngine::map.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions