_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q19900 | Aggregation.avg_bucket | train | public function avg_bucket(string $name, string $bucketsPath = null): AvgBucket
{
return new AvgBucket($name, $bucketsPath);
} | php | {
"resource": ""
} |
q19901 | Aggregation.percentiles | train | public function percentiles(string $name, string $field = null): Percentiles
{
return new Percentiles($name, $field);
} | php | {
"resource": ""
} |
q19902 | Aggregation.scripted_metric | train | public function scripted_metric(
string $name,
string $initScript = null,
string $mapScript = null,
string $combineScript = null,
string $reduceScript = null
): ScriptedMetric {
return new ScriptedMetric($name, $initScript, $mapScript, $combineScript, $reduceScript);
... | php | {
"resource": ""
} |
q19903 | Aggregation.filter | train | public function filter(string $name, AbstractQuery $filter = null): Filter
{
return new Filter($name, $filter);
} | php | {
"resource": ""
} |
q19904 | Aggregation.reverse_nested | train | public function reverse_nested(string $name, string $path = null): ReverseNested
{
return new ReverseNested($name, $path);
} | php | {
"resource": ""
} |
q19905 | Aggregation.histogram | train | public function histogram(string $name, string $field, $interval): Histogram
{
return new Histogram($name, $field, $interval);
} | php | {
"resource": ""
} |
q19906 | Aggregation.date_histogram | train | public function date_histogram(string $name, string $field, $interval): DateHistogram
{
return new DateHistogram($name, $field, $interval);
} | php | {
"resource": ""
} |
q19907 | Aggregation.geo_distance | train | public function geo_distance(string $name, string $field, $origin): GeoDistance
{
return new GeoDistance($name, $field, $origin);
} | php | {
"resource": ""
} |
q19908 | Aggregation.bucket_script | train | public function bucket_script(string $name, array $bucketsPath = null, string $script = null): BucketScript
{
return new BucketScript($name, $bucketsPath, $script);
} | php | {
"resource": ""
} |
q19909 | Aggregation.serial_diff | train | public function serial_diff(string $name, string $bucketsPath = null): SerialDiff
{
return new SerialDiff($name, $bucketsPath);
} | php | {
"resource": ""
} |
q19910 | MoreLikeThis.setAnalyzer | train | public function setAnalyzer(string $analyzer): self
{
$analyzer = \trim($analyzer);
return $this->setParam('analyzer', $analyzer);
} | php | {
"resource": ""
} |
q19911 | Http._setupCurl | train | protected function _setupCurl($curlConnection)
{
if ($this->getConnection()->hasConfig('curl')) {
foreach ($this->getConnection()->getConfig('curl') as $key => $param) {
\curl_setopt($curlConnection, $key, $param);
}
}
} | php | {
"resource": ""
} |
q19912 | Http._getConnection | train | protected function _getConnection(bool $persistent = true)
{
if (!$persistent || !self::$_curlConnection) {
self::$_curlConnection = \curl_init();
}
return self::$_curlConnection;
} | php | {
"resource": ""
} |
q19913 | Task.refresh | train | public function refresh(array $options = [])
{
$endpoint = new \Elasticsearch\Endpoints\Tasks\Get();
$endpoint->setTaskId($this->_id);
$endpoint->setParams($options);
$this->_response = $this->_client->requestEndpoint($endpoint);
$this->_data = $this->getResponse()->getData(... | php | {
"resource": ""
} |
q19914 | ElasticsearchException._parseError | train | protected function _parseError(string $error)
{
$errors = \explode(']; nested: ', $error);
if (1 === \count($errors)) {
$this->_exception = $this->_extractException($errors[0]);
} else {
if (self::REMOTE_TRANSPORT_EXCEPTION === $this->_extractException($errors[0])) {... | php | {
"resource": ""
} |
q19915 | IndexTemplate.request | train | public function request($method, $data = [])
{
$path = '_template/'.$this->getName();
return $this->getClient()->request($path, $method, $data);
} | php | {
"resource": ""
} |
q19916 | Snapshot.registerRepository | train | public function registerRepository($name, $type, $settings = [])
{
$data = [
'type' => $type,
'settings' => $settings,
];
return $this->request($name, Request::PUT, $data);
} | php | {
"resource": ""
} |
q19917 | Snapshot.getRepository | train | public function getRepository($name)
{
try {
$response = $this->request($name);
} catch (ResponseException $e) {
if (404 == $e->getResponse()->getStatus()) {
throw new NotFoundException("Repository '".$name."' does not exist.");
}
throw... | php | {
"resource": ""
} |
q19918 | Snapshot.createSnapshot | train | public function createSnapshot($repository, $name, $options = [], $waitForCompletion = false)
{
return $this->request($repository.'/'.$name, Request::PUT, $options, ['wait_for_completion' => $waitForCompletion]);
} | php | {
"resource": ""
} |
q19919 | Snapshot.getSnapshot | train | public function getSnapshot($repository, $name)
{
try {
$response = $this->request($repository.'/'.$name);
} catch (ResponseException $e) {
if (404 == $e->getResponse()->getStatus()) {
throw new NotFoundException("Snapshot '".$name."' does not exist in reposit... | php | {
"resource": ""
} |
q19920 | Snapshot.restoreSnapshot | train | public function restoreSnapshot($repository, $name, $options = [], $waitForCompletion = false)
{
$endpoint = new Restore();
$endpoint->setRepository($repository);
$endpoint->setSnapshot($name);
$endpoint->setBody($options);
$endpoint->setParams(['wait_for_completion' => $wait... | php | {
"resource": ""
} |
q19921 | Snapshot.request | train | public function request($path, $method = Request::GET, $data = [], array $query = [])
{
return $this->_client->request('_snapshot/'.$path, $method, $data, $query);
} | php | {
"resource": ""
} |
q19922 | Settings.getPersistent | train | public function getPersistent(string $setting = '')
{
$data = $this->get();
$settings = $data['persistent'];
if ('' !== $setting) {
return $settings[$setting] ?? null;
}
return $settings;
} | php | {
"resource": ""
} |
q19923 | Settings.getTransient | train | public function getTransient(string $setting = '')
{
$data = $this->get();
$settings = $data['transient'];
if ('' !== $setting) {
if (isset($settings[$setting])) {
return $settings[$setting];
}
if (false !== \strpos($setting, '.')) {
... | php | {
"resource": ""
} |
q19924 | Settings.setReadOnly | train | public function setReadOnly(bool $readOnly = true, bool $persistent = false): Response
{
$key = 'cluster.blocks.read_only';
if ($persistent) {
return $this->setPersistent($key, $readOnly);
}
return $this->setTransient($key, $readOnly);
} | php | {
"resource": ""
} |
q19925 | Settings.request | train | public function request(array $data = [], string $method = Request::GET): Response
{
$path = '_cluster/settings';
return $this->getClient()->request($path, $method, $data);
} | php | {
"resource": ""
} |
q19926 | Cluster.getNodeNames | train | public function getNodeNames()
{
$data = $this->getState();
$nodeNames = [];
foreach ($data['nodes'] as $node) {
$nodeNames[] = $node['name'];
}
return $nodeNames;
} | php | {
"resource": ""
} |
q19927 | Cluster.getNodes | train | public function getNodes()
{
$nodes = [];
$data = $this->getState();
foreach ($data['nodes'] as $id => $name) {
$nodes[] = new Node($id, $this->getClient());
}
return $nodes;
} | php | {
"resource": ""
} |
q19928 | Request.send | train | public function send()
{
$transport = $this->getConnection()->getTransportObject();
// Refactor: Not full toArray needed in exec?
return $transport->exec($this, $this->getConnection()->toArray());
} | php | {
"resource": ""
} |
q19929 | InnerHits.addScriptField | train | public function addScriptField(string $name, AbstractScript $script): self
{
if (!isset($this->_params['script_fields'])) {
$this->_params['script_fields'] = new ScriptFields();
}
$this->_params['script_fields']->addScript($name, $script);
return $this;
} | php | {
"resource": ""
} |
q19930 | Client.getVersion | train | public function getVersion()
{
if ($this->_version) {
return $this->_version;
}
$data = $this->request('/')->getData();
return $this->_version = $data['version']['number'];
} | php | {
"resource": ""
} |
q19931 | Client._initConnections | train | protected function _initConnections()
{
$connections = [];
foreach ($this->getConfig('connections') as $connection) {
$connections[] = Connection::create($this->_prepareConnectionParams($connection));
}
if (isset($this->_config['servers'])) {
foreach ($this-... | php | {
"resource": ""
} |
q19932 | Client._prepareConnectionParams | train | protected function _prepareConnectionParams(array $config)
{
$params = [];
$params['config'] = [];
foreach ($config as $key => $value) {
if (\in_array($key, ['bigintConversion', 'curl', 'headers', 'url'])) {
$params['config'][$key] = $value;
} else {
... | php | {
"resource": ""
} |
q19933 | Client.addHeader | train | public function addHeader($header, $headerValue)
{
if (\is_string($header) && \is_string($headerValue)) {
$this->_config['headers'][$header] = $headerValue;
} else {
throw new InvalidException('Header must be a string');
}
return $this;
} | php | {
"resource": ""
} |
q19934 | Client.removeHeader | train | public function removeHeader($header)
{
if (\is_string($header)) {
if (\array_key_exists($header, $this->_config['headers'])) {
unset($this->_config['headers'][$header]);
}
} else {
throw new InvalidException('Header must be a string');
}
... | php | {
"resource": ""
} |
q19935 | Client.deleteIds | train | public function deleteIds(array $ids, $index, $type, $routing = false)
{
if (empty($ids)) {
throw new InvalidException('Array has to consist of at least one id');
}
$bulk = new Bulk($this);
$bulk->setIndex($index);
$bulk->setType($type);
foreach ($ids as... | php | {
"resource": ""
} |
q19936 | Client.bulk | train | public function bulk(array $params)
{
if (empty($params)) {
throw new InvalidException('Array has to consist of at least one param');
}
$bulk = new Bulk($this);
$bulk->addRawData($params);
return $bulk->send();
} | php | {
"resource": ""
} |
q19937 | Client.request | train | public function request($path, $method = Request::GET, $data = [], array $query = [], $contentType = Request::DEFAULT_CONTENT_TYPE)
{
$connection = $this->getConnection();
$request = $this->_lastRequest = new Request($path, $method, $data, $query, $connection, $contentType);
$this->_lastResp... | php | {
"resource": ""
} |
q19938 | Client.requestEndpoint | train | public function requestEndpoint(AbstractEndpoint $endpoint)
{
return $this->request(
\ltrim($endpoint->getURI(), '/'),
$endpoint->getMethod(),
null === $endpoint->getBody() ? [] : $endpoint->getBody(),
$endpoint->getParams()
);
} | php | {
"resource": ""
} |
q19939 | Client.forcemergeAll | train | public function forcemergeAll($args = [])
{
$endpoint = new ForceMerge();
$endpoint->setParams($args);
return $this->requestEndpoint($endpoint);
} | php | {
"resource": ""
} |
q19940 | AbstractUpdateAction.setType | train | public function setType($type)
{
if ($type instanceof Type) {
$this->setIndex($type->getIndex());
$type = $type->getName();
}
return $this->setParam('_type', $type);
} | php | {
"resource": ""
} |
q19941 | AbstractUpdateAction.setIndex | train | public function setIndex($index)
{
if ($index instanceof Index) {
$index = $index->getName();
}
return $this->setParam('_index', $index);
} | php | {
"resource": ""
} |
q19942 | AbstractTransport.sanityzeQueryStringBool | train | public function sanityzeQueryStringBool(array $query)
{
foreach ($query as $key => $value) {
if (\is_bool($value)) {
$query[$key] = ($value) ? 'true' : 'false';
}
}
return $query;
} | php | {
"resource": ""
} |
q19943 | AbstractTransport.create | train | public static function create($transport, Connection $connection, array $params = []): AbstractTransport
{
if (\is_array($transport) && isset($transport['type'])) {
$transportParams = $transport;
unset($transportParams['type']);
$params = \array_replace($params, $transpo... | php | {
"resource": ""
} |
q19944 | Guzzle._getGuzzleClient | train | protected function _getGuzzleClient(bool $persistent = true): Client
{
if (!$persistent || !self::$_guzzleClientConnection) {
self::$_guzzleClientConnection = new Client();
}
return self::$_guzzleClientConnection;
} | php | {
"resource": ""
} |
q19945 | Guzzle._getBaseUrl | train | protected function _getBaseUrl(Connection $connection): string
{
// If url is set, url is taken. Otherwise port, host and path
$url = $connection->hasConfig('url') ? $connection->getConfig('url') : '';
if (!empty($url)) {
$baseUri = $url;
} else {
$baseUri = ... | php | {
"resource": ""
} |
q19946 | Guzzle._getActionPath | train | protected function _getActionPath(Request $request): string
{
$action = $request->getPath();
if ($action) {
$action = '/'.\ltrim($action, '/');
}
if (!Util::isDateMathEscaped($action)) {
$action = Util::escapeDateMath($action);
}
$query = $re... | php | {
"resource": ""
} |
q19947 | Match.setFieldParam | train | public function setFieldParam(string $field, string $key, string $value): self
{
if (!isset($this->_params[$field])) {
$this->_params[$field] = [];
}
$this->_params[$field][$key] = $value;
return $this;
} | php | {
"resource": ""
} |
q19948 | Match.setFieldOperator | train | public function setFieldOperator(string $field, string $operator = self::OPERATOR_OR): self
{
return $this->setFieldParam($field, 'operator', $operator);
} | php | {
"resource": ""
} |
q19949 | Match.setFieldAnalyzer | train | public function setFieldAnalyzer(string $field, string $analyzer): self
{
return $this->setFieldParam($field, 'analyzer', $analyzer);
} | php | {
"resource": ""
} |
q19950 | Match.setFieldBoost | train | public function setFieldBoost(string $field, float $boost = 1.0): self
{
return $this->setFieldParam($field, 'boost', $boost);
} | php | {
"resource": ""
} |
q19951 | Match.setFieldFuzzyRewrite | train | public function setFieldFuzzyRewrite(string $field, string $fuzzyRewrite): self
{
return $this->setFieldParam($field, 'fuzzy_rewrite', $fuzzyRewrite);
} | php | {
"resource": ""
} |
q19952 | Match.setFieldPrefixLength | train | public function setFieldPrefixLength(string $field, int $prefixLength): self
{
return $this->setFieldParam($field, 'prefix_length', $prefixLength);
} | php | {
"resource": ""
} |
q19953 | Match.setFieldMaxExpansions | train | public function setFieldMaxExpansions(string $field, int $maxExpansions): self
{
return $this->setFieldParam($field, 'max_expansions', $maxExpansions);
} | php | {
"resource": ""
} |
q19954 | Match.setFieldZeroTermsQuery | train | public function setFieldZeroTermsQuery(string $field, string $zeroTermQuery = self::ZERO_TERM_NONE): self
{
return $this->setFieldParam($field, 'zero_terms_query', $zeroTermQuery);
} | php | {
"resource": ""
} |
q19955 | Match.setFieldCutoffFrequency | train | public function setFieldCutoffFrequency(string $field, float $cutoffFrequency): self
{
return $this->setFieldParam($field, 'cutoff_frequency', $cutoffFrequency);
} | php | {
"resource": ""
} |
q19956 | Bulk.setRequestParam | train | public function setRequestParam(string $name, $value): self
{
$this->_requestParams[$name] = $value;
return $this;
} | php | {
"resource": ""
} |
q19957 | AbstractDocument.create | train | public static function create($data, string $opType = null): self
{
//Check type
if (!$data instanceof Document && !$data instanceof AbstractScript) {
throw new \InvalidArgumentException('The data needs to be a Document or a Script.');
}
if (null === $opType && $data->ha... | php | {
"resource": ""
} |
q19958 | Info.get | train | public function get()
{
$data = $this->getData();
foreach (\func_get_args() as $arg) {
if (isset($data[$arg])) {
$data = $data[$arg];
} else {
return null;
}
}
return $data;
} | php | {
"resource": ""
} |
q19959 | Info.getPort | train | public function getPort(): string
{
// Returns string in format: inet[/192.168.1.115:9201]
$data = $this->get('http_address');
$data = \substr($data, 6, \strlen($data) - 7);
$data = \explode(':', $data);
return $data[1];
} | php | {
"resource": ""
} |
q19960 | Info.getIp | train | public function getIp(): string
{
// Returns string in format: inet[/192.168.1.115:9201]
$data = $this->get('http_address');
$data = \substr($data, 6, \strlen($data) - 7);
$data = \explode(':', $data);
return $data[0];
} | php | {
"resource": ""
} |
q19961 | Info.getPlugins | train | public function getPlugins(): array
{
if (!\in_array('plugins', $this->_params, true)) {
//Plugin data was not retrieved when refresh() was called last. Get it now.
$this->_params[] = 'plugins';
$this->refresh($this->_params);
}
return $this->get('plugins... | php | {
"resource": ""
} |
q19962 | Info.hasPlugin | train | public function hasPlugin($name): bool
{
foreach ($this->getPlugins() as $plugin) {
if ($plugin['name'] === $name) {
return true;
}
}
return false;
} | php | {
"resource": ""
} |
q19963 | Node.getName | train | public function getName()
{
if (empty($this->_name)) {
$this->_name = $this->getInfo()->getName();
}
return $this->_name;
} | php | {
"resource": ""
} |
q19964 | Type.addDocument | train | public function addDocument(Document $doc)
{
$endpoint = new \Elasticsearch\Endpoints\Index();
if (null !== $doc->getId() && '' !== $doc->getId()) {
$endpoint->setID($doc->getId());
}
$options = $doc->getOptions(
[
'version',
... | php | {
"resource": ""
} |
q19965 | Type.getDocument | train | public function getDocument($id, array $options = [])
{
$endpoint = new \Elasticsearch\Endpoints\Get();
$endpoint->setID($id);
$endpoint->setParams($options);
$response = $this->requestEndpoint($endpoint);
$result = $response->getData();
if (!isset($result['found'])... | php | {
"resource": ""
} |
q19966 | Type.setMapping | train | public function setMapping($mapping, array $query = [])
{
$mapping = Mapping::create($mapping);
$mapping->setType($this);
return $mapping->send($query);
} | php | {
"resource": ""
} |
q19967 | Type.getMapping | train | public function getMapping()
{
$response = $this->requestEndpoint(new Get());
$data = $response->getData();
$mapping = \array_shift($data);
if (isset($mapping['mappings'])) {
return $mapping['mappings'];
}
return [];
} | php | {
"resource": ""
} |
q19968 | Type.createSearch | train | public function createSearch($query = '', $options = null, BuilderInterface $builder = null)
{
$search = $this->getIndex()->createSearch($query, $options, $builder);
$search->addType($this);
return $search;
} | php | {
"resource": ""
} |
q19969 | Type.search | train | public function search($query = '', $options = null)
{
$search = $this->createSearch($query, $options);
return $search->search();
} | php | {
"resource": ""
} |
q19970 | Type.deleteById | train | public function deleteById($id, array $options = [])
{
if (empty($id) || !\trim($id)) {
throw new \InvalidArgumentException();
}
$endpoint = new Delete();
$endpoint->setID($id);
$endpoint->setParams($options);
$response = $this->requestEndpoint($endpoint... | php | {
"resource": ""
} |
q19971 | Type.deleteIds | train | public function deleteIds(array $ids, $routing = false)
{
return $this->getIndex()->getClient()->deleteIds($ids, $this->getIndex(), $this, $routing);
} | php | {
"resource": ""
} |
q19972 | Type.deleteByQuery | train | public function deleteByQuery($query, array $options = [])
{
$query = Query::create($query);
$endpoint = new DeleteByQuery();
$endpoint->setBody($query->toArray());
$endpoint->setParams($options);
return $this->requestEndpoint($endpoint);
} | php | {
"resource": ""
} |
q19973 | Type.request | train | public function request($path, $method, $data = [], array $query = [])
{
$path = $this->getName().'/'.$path;
return $this->getIndex()->request($path, $method, $data, $query);
} | php | {
"resource": ""
} |
q19974 | Type.requestEndpoint | train | public function requestEndpoint(AbstractEndpoint $endpoint)
{
$cloned = clone $endpoint;
$cloned->setType($this->getName());
return $this->getIndex()->requestEndpoint($cloned);
} | php | {
"resource": ""
} |
q19975 | Settings.get | train | public function get(string $setting = '')
{
$requestData = $this->request()->getData();
$data = \reset($requestData);
if (empty($data['settings']) || empty($data['settings']['index'])) {
// should not append, the request should throw a ResponseException
throw new Not... | php | {
"resource": ""
} |
q19976 | Settings.getBool | train | public function getBool(string $setting): bool
{
$data = $this->get($setting);
return 'true' === $data || '1' === $data || 'on' === $data || 'yes' === $data;
} | php | {
"resource": ""
} |
q19977 | Settings.setMergePolicy | train | public function setMergePolicy(string $key, string $value): Response
{
$this->_index->close();
$response = $this->set(['merge.policy.'.$key => $value]);
$this->_index->open();
return $response;
} | php | {
"resource": ""
} |
q19978 | Settings.request | train | public function request(array $data = [], string $method = Request::GET): Response
{
$path = '_settings';
if (!empty($data)) {
$data = ['index' => $data];
}
return $this->getIndex()->request($path, $method, $data);
} | php | {
"resource": ""
} |
q19979 | Health._retrieveHealthData | train | protected function _retrieveHealthData(): array
{
$endpoint = new \Elasticsearch\Endpoints\Cluster\Health();
$endpoint->setParams(['level' => 'shards']);
$response = $this->_client->requestEndpoint($endpoint);
return $response->getData();
} | php | {
"resource": ""
} |
q19980 | Health.getIndices | train | public function getIndices(): array
{
$indices = [];
foreach ($this->_data['indices'] as $indexName => $index) {
$indices[$indexName] = new Index($indexName, $index);
}
return $indices;
} | php | {
"resource": ""
} |
q19981 | ResultSet.hasError | train | public function hasError(): bool
{
foreach ($this->getResultSets() as $resultSet) {
if ($resultSet->getResponse()->hasError()) {
return true;
}
}
return false;
} | php | {
"resource": ""
} |
q19982 | AbstractSuggest.setName | train | public function setName(string $name): AbstractSuggest
{
if (empty($name)) {
throw new InvalidException('Suggest name has to be set');
}
$this->_name = $name;
return $this;
} | php | {
"resource": ""
} |
q19983 | Fuzzy.setField | train | public function setField(string $fieldName, string $value): self
{
if (!\is_string($value) || !\is_string($fieldName)) {
throw new InvalidException('The field and value arguments must be of type string.');
}
if (\count($this->getParams()) > 0 && \key($this->getParams()) !== $fiel... | php | {
"resource": ""
} |
q19984 | Fuzzy.setFieldOption | train | public function setFieldOption(string $option, $value): self
{
//Retrieve the single existing field for alteration.
$params = $this->getParams();
if (\count($params) < 1) {
throw new InvalidException('No field has been set');
}
$key = \key($params);
$param... | php | {
"resource": ""
} |
q19985 | Result.getData | train | public function getData()
{
if (isset($this->_hit['fields'])) {
return isset($this->_hit['_source'])
? \array_merge($this->getFields(), $this->getSource())
: $this->getFields();
}
return $this->getSource();
} | php | {
"resource": ""
} |
q19986 | Result.getDocument | train | public function getDocument()
{
$doc = new Document();
$doc->setData($this->getSource());
$hit = $this->getHit();
unset($hit['_source']);
unset($hit['_explanation']);
unset($hit['highlight']);
unset($hit['_score']);
$doc->setParams($hit);
retu... | php | {
"resource": ""
} |
q19987 | Pipeline.create | train | public function create()
{
if (empty($this->id)) {
throw new InvalidException('You should set a valid pipeline id');
}
if (empty($this->_params['description'])) {
throw new InvalidException('You should set a valid processor description.');
}
if (empt... | php | {
"resource": ""
} |
q19988 | Pipeline.getPipeline | train | public function getPipeline(string $id)
{
$endpoint = new Get();
$endpoint->setID($id);
return $this->requestEndpoint($endpoint);
} | php | {
"resource": ""
} |
q19989 | Pipeline.deletePipeline | train | public function deletePipeline(string $id)
{
$endpoint = new Delete();
$endpoint->setID($id);
return $this->requestEndpoint($endpoint);
} | php | {
"resource": ""
} |
q19990 | Pipeline.addProcessor | train | public function addProcessor(AbstractProcessor $processor)
{
if (empty($this->_processors)) {
$this->_processors['processors'] = $processor->toArray();
$this->_params['processors'] = [];
} else {
$this->_processors['processors'] = \array_merge($this->_processors['... | php | {
"resource": ""
} |
q19991 | ResponseException.getFailures | train | public function getFailures(): array
{
$errors = [];
foreach ($this->getActionExceptions() as $actionException) {
$errors[] = $actionException->getMessage();
}
return $errors;
} | php | {
"resource": ""
} |
q19992 | DateHistogram.setExtendedBounds | train | public function setExtendedBounds(string $min = '', string $max = ''): self
{
$bounds = [];
$bounds['min'] = $min;
$bounds['max'] = $max;
// switch if min is higher then max
if (\strtotime($min) > \strtotime($max)) {
$bounds['min'] = $max;
$bounds['max... | php | {
"resource": ""
} |
q19993 | Document.addFile | train | public function addFile($key, $filepath, $mimeType = '')
{
$value = \base64_encode(\file_get_contents($filepath));
if (!empty($mimeType)) {
$value = ['_content_type' => $mimeType, '_name' => $filepath, '_content' => $value];
}
$this->set($key, $value);
return $... | php | {
"resource": ""
} |
q19994 | Wildcard.setValue | train | public function setValue(string $key, string $value, float $boost = 1.0): self
{
return $this->setParam($key, ['value' => $value, 'boost' => $boost]);
} | php | {
"resource": ""
} |
q19995 | SpanFirst._setQuery | train | protected function _setQuery(string $type, $args): self
{
if (!\is_array($args) && !($args instanceof AbstractSpanQuery)) {
throw new InvalidException('Invalid parameter. Has to be array or instance of Elastica\Query\AbstractSpanQuery');
}
return $this->setParam($type, $args);
... | php | {
"resource": ""
} |
q19996 | Query.create | train | public static function create($query)
{
switch (true) {
case $query instanceof self:
return $query;
case $query instanceof AbstractQuery:
return new self($query);
case empty($query):
return new self(new MatchAll());
... | php | {
"resource": ""
} |
q19997 | Query.setScriptFields | train | public function setScriptFields($scriptFields)
{
if (\is_array($scriptFields)) {
$scriptFields = new ScriptFields($scriptFields);
}
return $this->setParam('script_fields', $scriptFields);
} | php | {
"resource": ""
} |
q19998 | Query.addScriptField | train | public function addScriptField($name, AbstractScript $script)
{
if (isset($this->_params['script_fields'])) {
$this->_params['script_fields']->addScript($name, $script);
} else {
$this->setScriptFields([$name => $script]);
}
return $this;
} | php | {
"resource": ""
} |
q19999 | Query.toArray | train | public function toArray()
{
if (!isset($this->_params['query']) && (0 == $this->_suggest)) {
$this->setQuery(new MatchAll());
}
if (isset($this->_params['post_filter']) && 0 === \count(($this->_params['post_filter'])->toArray())) {
unset($this->_params['post_filter']... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.