Explorer icon indicating copy to clipboard operation
Explorer copied to clipboard

Add Custom Query Parameters

Open chengxianga2008 opened this issue 3 years ago • 8 comments

Hi there

I want to add custom query parameter in search function, as documented here https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html such as track_total_hits because it only return maximum 10000 record, I have to manually add this paramter to query builder. But there is no place to add in the ScoutSearchCommandBuilder

Can you add some custom Params after this

    $query = new Query();
    $query->setFields($this->fields);
    $query->setSort($this->sort);
    $query->setLimit($this->limit);
    $query->setOffset($this->offset);

like + $query->setParams($this->params);

Regards Jack

chengxianga2008 avatar Feb 14 '22 00:02 chengxianga2008

Sure, that should be doable.

Jeroen-G avatar Feb 14 '22 10:02 Jeroen-G

@Jeroen-G Thanks a lot, you are legend

chengxianga2008 avatar Feb 14 '22 10:02 chengxianga2008

@Jeroen-G Hello Jeroren, when the new version can be released? I am waiting for the new parameter input now.

chengxianga2008 avatar Feb 27 '22 23:02 chengxianga2008

Sorry, I have not yet started working on this.

Jeroen-G avatar Feb 28 '22 06:02 Jeroen-G

Hi Jeroen, just wondering when the new feature will be released? I am awaiting for on the production. @Jeroen-G

chengxianga2008 avatar Mar 07 '22 23:03 chengxianga2008

Feel free to contribute 😄

Jeroen-G avatar Mar 08 '22 12:03 Jeroen-G

I add #89 pull request.

the usage Model::search()->param("track_total_hits", true);

please approve it, and add new tag to publish

chengxianga2008 avatar Mar 11 '22 02:03 chengxianga2008

Hi @Jeroen-G I added my own fork, can't wait it for publishing, will merge back if next version has this feature

chengxianga2008 avatar Mar 11 '22 11:03 chengxianga2008

Custom query properties are now a thing in 3.5.0

Jeroen-G avatar Mar 19 '23 14:03 Jeroen-G