Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Utilize custom "options" of a builder #252

Open
robertbrowncc opened this issue Jul 4, 2023 · 2 comments
Open

[Feature] Utilize custom "options" of a builder #252

robertbrowncc opened this issue Jul 4, 2023 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@robertbrowncc
Copy link

robertbrowncc commented Jul 4, 2023

When I make a search call like this:

$results = Statement::search('automated_detection:true')->options([
   'size' => 100
])->keys();

I always get 10 results.

When I look at this function:

\Matchish\ScoutElasticSearch\Engines\ElasticSearchEngine::search
public function search(BaseBuilder $builder)
{
    return $this->performSearch($builder, []);
}

the [] is always sending blank options.

When I change it to bring in the options.

public function search(BaseBuilder $builder)
{
    return $this->performSearch($builder, $builder->options);
}

Then I get a result with 100 results in it.

Am I calling the options and search correctly? Is this a bug?

@robertbrowncc robertbrowncc added the bug Something isn't working label Jul 4, 2023
@robertbrowncc
Copy link
Author

I was able to get it to work like this too albeit a little funky:

$results = Statement::search('automated_detection:true',
    function (Client $client, Search $search) {
            $search->setSize(100);
            return $client->search(['index' => 'statements', 'body' => $search->toArray()]);
    })->keys();

@matchish
Copy link
Owner

Didn't notice options api. Make sense to integrate. Could be useful for simple cases

@matchish matchish added enhancement New feature or request help wanted Extra attention is needed and removed bug Something isn't working labels Jul 21, 2023
@matchish matchish changed the title [BUG] call to performSearch is blanking out options [FEATURE] Utilize custom "options" of a builder Jul 21, 2023
@matchish matchish changed the title [FEATURE] Utilize custom "options" of a builder [Feature] Utilize custom "options" of a builder Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants