Code Monkey home page Code Monkey logo

Comments (6)

 avatar commented on May 24, 2024 2

I also interested in this issue.

from scout.

paulvl avatar paulvl commented on May 24, 2024

You are talking about a relationship search right?
in that case you should do something like this, assuming that you have a relation named "user_type" which returns an UserType object that has a name attribute:

Modify toSearchableArray method on your User class

`

public function toSearchableArray()
{
    $array = $this->toArray();

    $extra_data = [];
    $extra_data['type_name'] = $this->user_type->name;

    return array_merge($array, $extra_data);
}

`

from scout.

i6448038 avatar i6448038 commented on May 24, 2024

no no no ,I mean I wann to search a custom field in the ES type,for example, I wann to search only the name field or anyother field which I wann to search of the user_type in the Elasticsearch,not all the fields in the user_type.

from scout.

Muffinman avatar Muffinman commented on May 24, 2024

It doesn't seem like you can - the ElasticsearchEngine class just passes an _all key to the ElasticSearch server.

You'll need to create a custom Search Engine to provide this feature yourself - or just use the Elasticsearch\Clientbuilder class directly.

The same goes for Boosting or any other advanced features which seem to be outside the scope of the scout project.

from scout.

rjbaker avatar rjbaker commented on May 24, 2024

Perhaps the Engine abstract class could be updated to return the underlying "driver". This could be analogous to Laravel's filesystem disk implementation abstracting local filesystem and cloud providers. You can still access the underlying driver instance and any proprietary methods. The only complexity is mapping the response into eloquent models.

from scout.

sede2 avatar sede2 commented on May 24, 2024

I think you could extend your model and override toSearchableArray() only returning 'name', but you will have to reimport manually this model if the original gets changed.

from 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.