Code Monkey home page Code Monkey logo

Comments (2)

keithza avatar keithza commented on June 19, 2024 2

@mmachatschek there definitely seems to be an issue with laravel/scout and the documentation as well as the behavior of getScoutKeyName() in the laravel/scout code as well. The base method returns the qualified name meaning <table>.<key>. This causes issues.

I still feel that this should apply so that using the --key option in the scout:index command can be implemented without the need for implementing the change to the toSearchableArray() method and allow use of the custom key name for tables without an id field.

If getScoutKeyName() was implemented correctly in laravel/scout only one change would need to be made in the getKeyName() method and that change would cascade.

Regardless, before this can happen, laravel/scout needs to be amended.

from meilisearch-laravel-scout.

mmachatschek avatar mmachatschek commented on June 19, 2024

I think that this would not work out as expected.

The getScoutKeyName() method is only used for fetching the models from the database not from the search index. It looks to me as if the documentation and the method description on laravel/scout is not correct.

This means that if we change getKeyName() to getScoutKeyName() in the MeiliSearchEngine class, everyone that uses the library also would need to add a toSearchableArray method on each model and set the primaryKey name of that model to getScoutKeyName() and the value to getScoutKey().

For Aloglia this works because there is a mandatory field ObjectID that is sent with each create/update/delete. Whereas the identifier for a MeiliSearch index basically can be set to anything you want.

@keithza maybe you can point this out in the issues at laravel/scout

from meilisearch-laravel-scout.

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.