repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
drutiny/drutiny
src/Driver/DrushDriver.php
DrushDriver.sqlq
public function sqlq($sql) { // $args = ['--db-prefix', '"' . $sql . '"']; $sql = strtr($sql, [ "{" => '', "}" => '' ]); $output = trim($this->__call('sqlq', ['"' . $sql . '"'])); $output = $this->cleanOutput($output); return $output; }
php
public function sqlq($sql) { // $args = ['--db-prefix', '"' . $sql . '"']; $sql = strtr($sql, [ "{" => '', "}" => '' ]); $output = trim($this->__call('sqlq', ['"' . $sql . '"'])); $output = $this->cleanOutput($output); return $output; }
[ "public", "function", "sqlq", "(", "$", "sql", ")", "{", "// $args = ['--db-prefix', '\"' . $sql . '\"'];", "$", "sql", "=", "strtr", "(", "$", "sql", ",", "[", "\"{\"", "=>", "''", ",", "\"}\"", "=>", "''", "]", ")", ";", "$", "output", "=", "trim", "...
Override for drush command 'sqlq'.
[ "Override", "for", "drush", "command", "sqlq", "." ]
train
https://github.com/drutiny/drutiny/blob/ba16557024f36e0f2f1612aae7f35cac9f460d81/src/Driver/DrushDriver.php#L242-L251
drutiny/drutiny
src/Driver/DrushDriver.php
DrushDriver.evaluate
public function evaluate(\Closure $callback, Array $args = []) { $args = array_values($args); $func = new \ReflectionFunction($callback); $filename = $func->getFileName(); $start_line = $func->getStartLine() - 1; // it's actually - 1, otherwise you wont get the function() block $end_line = $func->ge...
php
public function evaluate(\Closure $callback, Array $args = []) { $args = array_values($args); $func = new \ReflectionFunction($callback); $filename = $func->getFileName(); $start_line = $func->getStartLine() - 1; // it's actually - 1, otherwise you wont get the function() block $end_line = $func->ge...
[ "public", "function", "evaluate", "(", "\\", "Closure", "$", "callback", ",", "Array", "$", "args", "=", "[", "]", ")", "{", "$", "args", "=", "array_values", "(", "$", "args", ")", ";", "$", "func", "=", "new", "\\", "ReflectionFunction", "(", "$", ...
This function takes PHP in this execution scope (Closure) and executes it against the Drupal target using Drush php-script. @param \Closure $callback @param array $args @return mixed
[ "This", "function", "takes", "PHP", "in", "this", "execution", "scope", "(", "Closure", ")", "and", "executes", "it", "against", "the", "Drupal", "target", "using", "Drush", "php", "-", "script", "." ]
train
https://github.com/drutiny/drutiny/blob/ba16557024f36e0f2f1612aae7f35cac9f460d81/src/Driver/DrushDriver.php#L268-L316
drutiny/drutiny
src/Profile.php
Profile.loadFromFile
public static function loadFromFile($filepath) { $info = Yaml::parseFile($filepath); $name = str_replace('.profile.yml', '', pathinfo($filepath, PATHINFO_BASENAME)); $profile = new static(); $profile->setTitle($info['title']) ->setName($name) ->setFilepath($filepath); if ...
php
public static function loadFromFile($filepath) { $info = Yaml::parseFile($filepath); $name = str_replace('.profile.yml', '', pathinfo($filepath, PATHINFO_BASENAME)); $profile = new static(); $profile->setTitle($info['title']) ->setName($name) ->setFilepath($filepath); if ...
[ "public", "static", "function", "loadFromFile", "(", "$", "filepath", ")", "{", "$", "info", "=", "Yaml", "::", "parseFile", "(", "$", "filepath", ")", ";", "$", "name", "=", "str_replace", "(", "'.profile.yml'", ",", "''", ",", "pathinfo", "(", "$", "...
Load a profile from file. @var $filepath string
[ "Load", "a", "profile", "from", "file", "." ]
train
https://github.com/drutiny/drutiny/blob/ba16557024f36e0f2f1612aae7f35cac9f460d81/src/Profile.php#L88-L132
drutiny/drutiny
src/Profile.php
Profile.getFormatOption
public function getFormatOption($format, $options = []) { $format = isset($this->format[$format]) ? $this->format[$format] : Format::create($format, $options); if (isset($options['output']) && empty($format->getOutput())) { $format->setOutput($options['output']); } return $format; }
php
public function getFormatOption($format, $options = []) { $format = isset($this->format[$format]) ? $this->format[$format] : Format::create($format, $options); if (isset($options['output']) && empty($format->getOutput())) { $format->setOutput($options['output']); } return $format; }
[ "public", "function", "getFormatOption", "(", "$", "format", ",", "$", "options", "=", "[", "]", ")", "{", "$", "format", "=", "isset", "(", "$", "this", "->", "format", "[", "$", "format", "]", ")", "?", "$", "this", "->", "format", "[", "$", "f...
Add a FormatOptions to the profile.
[ "Add", "a", "FormatOptions", "to", "the", "profile", "." ]
train
https://github.com/drutiny/drutiny/blob/ba16557024f36e0f2f1612aae7f35cac9f460d81/src/Profile.php#L146-L153
drutiny/drutiny
src/Profile.php
Profile.addPolicyDefinition
public function addPolicyDefinition(PolicyDefinition $definition) { // Do not include excluded dependencies if (!in_array($definition->getName(), $this->excludedPolicies)) { $this->policies[$definition->getName()] = $definition; } return $this; }
php
public function addPolicyDefinition(PolicyDefinition $definition) { // Do not include excluded dependencies if (!in_array($definition->getName(), $this->excludedPolicies)) { $this->policies[$definition->getName()] = $definition; } return $this; }
[ "public", "function", "addPolicyDefinition", "(", "PolicyDefinition", "$", "definition", ")", "{", "// Do not include excluded dependencies", "if", "(", "!", "in_array", "(", "$", "definition", "->", "getName", "(", ")", ",", "$", "this", "->", "excludedPolicies", ...
Add a PolicyDefinition to the profile.
[ "Add", "a", "PolicyDefinition", "to", "the", "profile", "." ]
train
https://github.com/drutiny/drutiny/blob/ba16557024f36e0f2f1612aae7f35cac9f460d81/src/Profile.php#L158-L165
drutiny/drutiny
src/Profile.php
Profile.getPolicyDefinition
public function getPolicyDefinition($name) { return isset($this->policies[$name]) ? $this->policies[$name] : FALSE; }
php
public function getPolicyDefinition($name) { return isset($this->policies[$name]) ? $this->policies[$name] : FALSE; }
[ "public", "function", "getPolicyDefinition", "(", "$", "name", ")", "{", "return", "isset", "(", "$", "this", "->", "policies", "[", "$", "name", "]", ")", "?", "$", "this", "->", "policies", "[", "$", "name", "]", ":", "FALSE", ";", "}" ]
Add a PolicyDefinition to the profile.
[ "Add", "a", "PolicyDefinition", "to", "the", "profile", "." ]
train
https://github.com/drutiny/drutiny/blob/ba16557024f36e0f2f1612aae7f35cac9f460d81/src/Profile.php#L176-L179
drutiny/drutiny
src/Profile.php
Profile.getAllPolicyDefinitions
public function getAllPolicyDefinitions() { // Sort $policies // 1. By weight. Lighter policies float to the top. // 2. By name, alphabetical sorting. uasort($this->policies, function (PolicyDefinition $a, PolicyDefinition $b) { // 1. By weight. Lighter policies float to the top. if ($a-...
php
public function getAllPolicyDefinitions() { // Sort $policies // 1. By weight. Lighter policies float to the top. // 2. By name, alphabetical sorting. uasort($this->policies, function (PolicyDefinition $a, PolicyDefinition $b) { // 1. By weight. Lighter policies float to the top. if ($a-...
[ "public", "function", "getAllPolicyDefinitions", "(", ")", "{", "// Sort $policies", "// 1. By weight. Lighter policies float to the top.", "// 2. By name, alphabetical sorting.", "uasort", "(", "$", "this", "->", "policies", ",", "function", "(", "PolicyDefinition", "$", "a"...
Add a PolicyDefinition to the profile.
[ "Add", "a", "PolicyDefinition", "to", "the", "profile", "." ]
train
https://github.com/drutiny/drutiny/blob/ba16557024f36e0f2f1612aae7f35cac9f460d81/src/Profile.php#L184-L202
drutiny/drutiny
src/Profile.php
Profile.addInclude
public function addInclude(Profile $profile) { $profile->setParent($this); $this->include[$profile->getName()] = $profile; foreach ($profile->getAllPolicyDefinitions() as $policy) { // Do not override policies already specified, they take priority. if ($this->getPolicyDefinition($policy->getNa...
php
public function addInclude(Profile $profile) { $profile->setParent($this); $this->include[$profile->getName()] = $profile; foreach ($profile->getAllPolicyDefinitions() as $policy) { // Do not override policies already specified, they take priority. if ($this->getPolicyDefinition($policy->getNa...
[ "public", "function", "addInclude", "(", "Profile", "$", "profile", ")", "{", "$", "profile", "->", "setParent", "(", "$", "this", ")", ";", "$", "this", "->", "include", "[", "$", "profile", "->", "getName", "(", ")", "]", "=", "$", "profile", ";", ...
Add a Profile to the profile.
[ "Add", "a", "Profile", "to", "the", "profile", "." ]
train
https://github.com/drutiny/drutiny/blob/ba16557024f36e0f2f1612aae7f35cac9f460d81/src/Profile.php#L275-L287
drutiny/drutiny
src/Profile.php
Profile.setParent
public function setParent(Profile $parent) { // Ensure parent doesn't already have this profile loaded. // This prevents recursive looping. if (!$parent->getParent($this->getName())) { $this->parent = $parent; return $this; } throw new \Exception($this->getName() . ' already found in p...
php
public function setParent(Profile $parent) { // Ensure parent doesn't already have this profile loaded. // This prevents recursive looping. if (!$parent->getParent($this->getName())) { $this->parent = $parent; return $this; } throw new \Exception($this->getName() . ' already found in p...
[ "public", "function", "setParent", "(", "Profile", "$", "parent", ")", "{", "// Ensure parent doesn't already have this profile loaded.", "// This prevents recursive looping.", "if", "(", "!", "$", "parent", "->", "getParent", "(", "$", "this", "->", "getName", "(", "...
Add a Profile to the profile.
[ "Add", "a", "Profile", "to", "the", "profile", "." ]
train
https://github.com/drutiny/drutiny/blob/ba16557024f36e0f2f1612aae7f35cac9f460d81/src/Profile.php#L308-L317
drutiny/drutiny
src/Profile.php
Profile.getParent
public function getParent($name = NULL) { if (!$this->parent) { return FALSE; } if ($name) { if ($this->parent->getName() == $name) { return $this->parent; } if ($parent = $this->parent->getInclude($name)) { return $parent; } // Recurse up the tree to fi...
php
public function getParent($name = NULL) { if (!$this->parent) { return FALSE; } if ($name) { if ($this->parent->getName() == $name) { return $this->parent; } if ($parent = $this->parent->getInclude($name)) { return $parent; } // Recurse up the tree to fi...
[ "public", "function", "getParent", "(", "$", "name", "=", "NULL", ")", "{", "if", "(", "!", "$", "this", "->", "parent", ")", "{", "return", "FALSE", ";", "}", "if", "(", "$", "name", ")", "{", "if", "(", "$", "this", "->", "parent", "->", "get...
Find a parent in the tree of parent profiles.
[ "Find", "a", "parent", "in", "the", "tree", "of", "parent", "profiles", "." ]
train
https://github.com/drutiny/drutiny/blob/ba16557024f36e0f2f1612aae7f35cac9f460d81/src/Profile.php#L322-L338
drutiny/drutiny
src/Policy/Dependency.php
Dependency.execute
public function execute(Sandbox $sandbox) { $language = new ExpressionLanguage($sandbox); Container::getLogger()->info("Evaluating expression: " . $language->compile($this->expression)); try { if ($return = $language->evaluate($this->expression)) { Container::getLogger()->debug(__CLASS__ . "...
php
public function execute(Sandbox $sandbox) { $language = new ExpressionLanguage($sandbox); Container::getLogger()->info("Evaluating expression: " . $language->compile($this->expression)); try { if ($return = $language->evaluate($this->expression)) { Container::getLogger()->debug(__CLASS__ . "...
[ "public", "function", "execute", "(", "Sandbox", "$", "sandbox", ")", "{", "$", "language", "=", "new", "ExpressionLanguage", "(", "$", "sandbox", ")", ";", "Container", "::", "getLogger", "(", ")", "->", "info", "(", "\"Evaluating expression: \"", ".", "$",...
Evaluate the dependency.
[ "Evaluate", "the", "dependency", "." ]
train
https://github.com/drutiny/drutiny/blob/ba16557024f36e0f2f1612aae7f35cac9f460d81/src/Policy/Dependency.php#L95-L112
silverstripe/silverstripe-fulltextsearch
src/Search/Processors/SearchUpdateBatchedProcessor.php
SearchUpdateBatchedProcessor.process
public function process() { // Skip blank queues if (empty($this->batches)) { return true; } // Don't re-process completed queue if ($this->currentBatch >= count($this->batches)) { return true; } // Send current patch to indexes ...
php
public function process() { // Skip blank queues if (empty($this->batches)) { return true; } // Don't re-process completed queue if ($this->currentBatch >= count($this->batches)) { return true; } // Send current patch to indexes ...
[ "public", "function", "process", "(", ")", "{", "// Skip blank queues", "if", "(", "empty", "(", "$", "this", "->", "batches", ")", ")", "{", "return", "true", ";", "}", "// Don't re-process completed queue", "if", "(", "$", "this", "->", "currentBatch", ">=...
Process the current queue @return boolean
[ "Process", "the", "current", "queue" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Processors/SearchUpdateBatchedProcessor.php#L84-L102
silverstripe/silverstripe-fulltextsearch
src/Search/Processors/SearchUpdateBatchedProcessor.php
SearchUpdateBatchedProcessor.segmentBatches
protected function segmentBatches($source) { // Measure batch_size $batchSize = static::config()->get('batch_size'); if ($batchSize === 0) { return array($source); } $softCap = static::config()->get('batch_soft_cap'); // Clear batches $batches = a...
php
protected function segmentBatches($source) { // Measure batch_size $batchSize = static::config()->get('batch_size'); if ($batchSize === 0) { return array($source); } $softCap = static::config()->get('batch_soft_cap'); // Clear batches $batches = a...
[ "protected", "function", "segmentBatches", "(", "$", "source", ")", "{", "// Measure batch_size", "$", "batchSize", "=", "static", "::", "config", "(", ")", "->", "get", "(", "'batch_size'", ")", ";", "if", "(", "$", "batchSize", "===", "0", ")", "{", "r...
Segments batches acording to the specified rules @param array $source Source input @return array Batches
[ "Segments", "batches", "acording", "to", "the", "specified", "rules" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Processors/SearchUpdateBatchedProcessor.php#L110-L172
silverstripe/silverstripe-fulltextsearch
src/Search/Extensions/SearchUpdater_ObjectHandler.php
SearchUpdater_ObjectHandler.triggerReindex
public function triggerReindex() { if (!$this->owner->ID) { return; } $id = $this->owner->ID; $class = $this->owner->ClassName; $state = SearchVariant::current_state($class); $base = DataObject::getSchema()->baseDataClass($class); $key = "$id:$bas...
php
public function triggerReindex() { if (!$this->owner->ID) { return; } $id = $this->owner->ID; $class = $this->owner->ClassName; $state = SearchVariant::current_state($class); $base = DataObject::getSchema()->baseDataClass($class); $key = "$id:$bas...
[ "public", "function", "triggerReindex", "(", ")", "{", "if", "(", "!", "$", "this", "->", "owner", "->", "ID", ")", "{", "return", ";", "}", "$", "id", "=", "$", "this", "->", "owner", "->", "ID", ";", "$", "class", "=", "$", "this", "->", "own...
Forces this object to trigger a re-index in the current state
[ "Forces", "this", "object", "to", "trigger", "a", "re", "-", "index", "in", "the", "current", "state" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Extensions/SearchUpdater_ObjectHandler.php#L54-L82
silverstripe/silverstripe-fulltextsearch
src/Solr/Solr.php
Solr.configure_server
public static function configure_server($options = array()) { self::$solr_options = array_merge(self::$solr_options, $options); self::$merged_solr_options = null; self::$service_singleton = null; self::$service_core_singletons = array(); }
php
public static function configure_server($options = array()) { self::$solr_options = array_merge(self::$solr_options, $options); self::$merged_solr_options = null; self::$service_singleton = null; self::$service_core_singletons = array(); }
[ "public", "static", "function", "configure_server", "(", "$", "options", "=", "array", "(", ")", ")", "{", "self", "::", "$", "solr_options", "=", "array_merge", "(", "self", "::", "$", "solr_options", ",", "$", "options", ")", ";", "self", "::", "$", ...
Update the configuration for Solr. See $solr_options for a discussion of the accepted array keys @param array $options - The options to update
[ "Update", "the", "configuration", "for", "Solr", ".", "See", "$solr_options", "for", "a", "discussion", "of", "the", "accepted", "array", "keys" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/Solr.php#L64-L71
silverstripe/silverstripe-fulltextsearch
src/Solr/Solr.php
Solr.solr_options
public static function solr_options() { if (self::$merged_solr_options) { return self::$merged_solr_options; } $defaults = array( 'host' => 'localhost', 'port' => 8983, 'path' => '/solr', 'version' => '4' ); // Bui...
php
public static function solr_options() { if (self::$merged_solr_options) { return self::$merged_solr_options; } $defaults = array( 'host' => 'localhost', 'port' => 8983, 'path' => '/solr', 'version' => '4' ); // Bui...
[ "public", "static", "function", "solr_options", "(", ")", "{", "if", "(", "self", "::", "$", "merged_solr_options", ")", "{", "return", "self", "::", "$", "merged_solr_options", ";", "}", "$", "defaults", "=", "array", "(", "'host'", "=>", "'localhost'", "...
Get the configured Solr options with the defaults all merged in @return array - The merged options
[ "Get", "the", "configured", "Solr", "options", "with", "the", "defaults", "all", "merged", "in" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/Solr.php#L77-L112
silverstripe/silverstripe-fulltextsearch
src/Solr/Solr.php
Solr.service
public static function service($core = null) { $options = self::solr_options(); if (!self::$service_singleton) { self::$service_singleton = Injector::inst()->create( $options['service'], $options['host'], $options['port'], ...
php
public static function service($core = null) { $options = self::solr_options(); if (!self::$service_singleton) { self::$service_singleton = Injector::inst()->create( $options['service'], $options['host'], $options['port'], ...
[ "public", "static", "function", "service", "(", "$", "core", "=", "null", ")", "{", "$", "options", "=", "self", "::", "solr_options", "(", ")", ";", "if", "(", "!", "self", "::", "$", "service_singleton", ")", "{", "self", "::", "$", "service_singleto...
Get a SolrService @param string $core Optional name of index class @return SolrService|SolrService_Core
[ "Get", "a", "SolrService" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/Solr.php#L132-L155
silverstripe/silverstripe-fulltextsearch
src/Search/Queries/SearchQuery.php
SearchQuery.addFuzzySearchTerm
public function addFuzzySearchTerm($text, $fields = null, $boost = []) { $this->search[] = [ 'text' => $text, 'fields' => $fields ? (array) $fields : null, 'boost' => $boost, 'fuzzy' => true ]; return $this; }
php
public function addFuzzySearchTerm($text, $fields = null, $boost = []) { $this->search[] = [ 'text' => $text, 'fields' => $fields ? (array) $fields : null, 'boost' => $boost, 'fuzzy' => true ]; return $this; }
[ "public", "function", "addFuzzySearchTerm", "(", "$", "text", ",", "$", "fields", "=", "null", ",", "$", "boost", "=", "[", "]", ")", "{", "$", "this", "->", "search", "[", "]", "=", "[", "'text'", "=>", "$", "text", ",", "'fields'", "=>", "$", "...
Similar to {@link addSearchTerm()}, but uses stemming and other similarity algorithms to find the searched terms. For example, a term "fishing" would also likely find results containing "fish" or "fisher". Depends on search implementation. @param string $text See {@link addSearchTerm()} @param array $fields See {@l...
[ "Similar", "to", "{", "@link", "addSearchTerm", "()", "}", "but", "uses", "stemming", "and", "other", "similarity", "algorithms", "to", "find", "the", "searched", "terms", ".", "For", "example", "a", "term", "fishing", "would", "also", "likely", "find", "res...
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Queries/SearchQuery.php#L102-L111
silverstripe/silverstripe-fulltextsearch
src/Search/Queries/SearchQuery.php
SearchQuery.addFilter
public function addFilter($field, $values) { $requires = isset($this->require[$field]) ? $this->require[$field] : []; $values = is_array($values) ? $values : [$values]; $this->require[$field] = array_merge($requires, $values); return $this; }
php
public function addFilter($field, $values) { $requires = isset($this->require[$field]) ? $this->require[$field] : []; $values = is_array($values) ? $values : [$values]; $this->require[$field] = array_merge($requires, $values); return $this; }
[ "public", "function", "addFilter", "(", "$", "field", ",", "$", "values", ")", "{", "$", "requires", "=", "isset", "(", "$", "this", "->", "require", "[", "$", "field", "]", ")", "?", "$", "this", "->", "require", "[", "$", "field", "]", ":", "["...
Similar to {@link addSearchTerm()}, but typically used to further narrow down based on other facets which don't influence the field relevancy. @param string $field Composite name of the field @param mixed $values Scalar value, array of values, or an instance of SearchQuery_Range @return $this
[ "Similar", "to", "{", "@link", "addSearchTerm", "()", "}", "but", "typically", "used", "to", "further", "narrow", "down", "based", "on", "other", "facets", "which", "don", "t", "influence", "the", "field", "relevancy", "." ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Queries/SearchQuery.php#L151-L157
silverstripe/silverstripe-fulltextsearch
src/Search/Queries/SearchQuery.php
SearchQuery.addExclude
public function addExclude($field, $values) { $excludes = isset($this->exclude[$field]) ? $this->exclude[$field] : []; $values = is_array($values) ? $values : [$values]; $this->exclude[$field] = array_merge($excludes, $values); return $this; }
php
public function addExclude($field, $values) { $excludes = isset($this->exclude[$field]) ? $this->exclude[$field] : []; $values = is_array($values) ? $values : [$values]; $this->exclude[$field] = array_merge($excludes, $values); return $this; }
[ "public", "function", "addExclude", "(", "$", "field", ",", "$", "values", ")", "{", "$", "excludes", "=", "isset", "(", "$", "this", "->", "exclude", "[", "$", "field", "]", ")", "?", "$", "this", "->", "exclude", "[", "$", "field", "]", ":", "[...
Excludes results which match these criteria, inverse of {@link addFilter()}. @param string $field @param mixed $values @return $this
[ "Excludes", "results", "which", "match", "these", "criteria", "inverse", "of", "{", "@link", "addFilter", "()", "}", "." ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Queries/SearchQuery.php#L174-L180
silverstripe/silverstripe-fulltextsearch
src/Search/Queries/SearchQuery.php
SearchQuery.filterBy
public function filterBy( $target, $value = null, $comparison = null, AbstractSearchQueryWriter $searchQueryWriter = null ) { if (!$target instanceof SearchCriteriaInterface) { $target = new SearchCriteria($target, $value, $comparison, $searchQueryWriter); ...
php
public function filterBy( $target, $value = null, $comparison = null, AbstractSearchQueryWriter $searchQueryWriter = null ) { if (!$target instanceof SearchCriteriaInterface) { $target = new SearchCriteria($target, $value, $comparison, $searchQueryWriter); ...
[ "public", "function", "filterBy", "(", "$", "target", ",", "$", "value", "=", "null", ",", "$", "comparison", "=", "null", ",", "AbstractSearchQueryWriter", "$", "searchQueryWriter", "=", "null", ")", "{", "if", "(", "!", "$", "target", "instanceof", "Sear...
You can pass through a string value, Criteria object, or Criterion object for $target. String value might be "SiteTree_Title" or whatever field in your index that you're trying to target. If you require complex filtering then you can build your Criteria object first with multiple layers/levels of Criteria, and then p...
[ "You", "can", "pass", "through", "a", "string", "value", "Criteria", "object", "or", "Criterion", "object", "for", "$target", "." ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Queries/SearchQuery.php#L206-L219
silverstripe/silverstripe-fulltextsearch
src/Solr/Reindex/Handlers/SolrReindexBase.php
SolrReindexBase.processIndex
protected function processIndex( LoggerInterface $logger, SolrIndex $indexInstance, $batchSize, $taskName, $classes = null ) { // Filter classes for this index $indexClasses = $this->getClassesForIndex($indexInstance, $classes); // Clear all records i...
php
protected function processIndex( LoggerInterface $logger, SolrIndex $indexInstance, $batchSize, $taskName, $classes = null ) { // Filter classes for this index $indexClasses = $this->getClassesForIndex($indexInstance, $classes); // Clear all records i...
[ "protected", "function", "processIndex", "(", "LoggerInterface", "$", "logger", ",", "SolrIndex", "$", "indexInstance", ",", "$", "batchSize", ",", "$", "taskName", ",", "$", "classes", "=", "null", ")", "{", "// Filter classes for this index", "$", "indexClasses"...
Process index for a single SolrIndex instance @param LoggerInterface $logger @param SolrIndex $indexInstance @param int $batchSize @param string $taskName @param string $classes
[ "Process", "index", "for", "a", "single", "SolrIndex", "instance" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/Reindex/Handlers/SolrReindexBase.php#L36-L58
silverstripe/silverstripe-fulltextsearch
src/Solr/Reindex/Handlers/SolrReindexBase.php
SolrReindexBase.getClassesForIndex
protected function getClassesForIndex(SolrIndex $index, $filterClasses = null) { // Get base classes $classes = $index->getClasses(); if (!$filterClasses) { return $classes; } // Apply filter if (!is_array($filterClasses)) { $filterClasses = e...
php
protected function getClassesForIndex(SolrIndex $index, $filterClasses = null) { // Get base classes $classes = $index->getClasses(); if (!$filterClasses) { return $classes; } // Apply filter if (!is_array($filterClasses)) { $filterClasses = e...
[ "protected", "function", "getClassesForIndex", "(", "SolrIndex", "$", "index", ",", "$", "filterClasses", "=", "null", ")", "{", "// Get base classes", "$", "classes", "=", "$", "index", "->", "getClasses", "(", ")", ";", "if", "(", "!", "$", "filterClasses"...
Get valid classes and options for an index with an optional filter @param SolrIndex $index @param string|array $filterClasses Optional class or classes to limit to @return array List of classes, where the key is the classname and value is list of options
[ "Get", "valid", "classes", "and", "options", "for", "an", "index", "with", "an", "optional", "filter" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/Reindex/Handlers/SolrReindexBase.php#L67-L80
silverstripe/silverstripe-fulltextsearch
src/Solr/Reindex/Handlers/SolrReindexBase.php
SolrReindexBase.processVariant
protected function processVariant( LoggerInterface $logger, SolrIndex $indexInstance, $state, $class, $includeSubclasses, $batchSize, $taskName ) { // Set state SearchVariant::activate_state($state); // Count records $query = $...
php
protected function processVariant( LoggerInterface $logger, SolrIndex $indexInstance, $state, $class, $includeSubclasses, $batchSize, $taskName ) { // Set state SearchVariant::activate_state($state); // Count records $query = $...
[ "protected", "function", "processVariant", "(", "LoggerInterface", "$", "logger", ",", "SolrIndex", "$", "indexInstance", ",", "$", "state", ",", "$", "class", ",", "$", "includeSubclasses", ",", "$", "batchSize", ",", "$", "taskName", ")", "{", "// Set state"...
Process re-index for a given variant state and class @param LoggerInterface $logger @param SolrIndex $indexInstance @param array $state Variant state @param string $class @param bool $includeSubclasses @param int $batchSize @param string $taskName
[ "Process", "re", "-", "index", "for", "a", "given", "variant", "state", "and", "class" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/Reindex/Handlers/SolrReindexBase.php#L93-L125
silverstripe/silverstripe-fulltextsearch
src/Solr/Reindex/Handlers/SolrReindexBase.php
SolrReindexBase.runGroup
public function runGroup( LoggerInterface $logger, SolrIndex $indexInstance, $state, $class, $groups, $group ) { // Set time limit and state Environment::increaseTimeLimitTo(); SearchVariant::activate_state($state); $logger->info("Addin...
php
public function runGroup( LoggerInterface $logger, SolrIndex $indexInstance, $state, $class, $groups, $group ) { // Set time limit and state Environment::increaseTimeLimitTo(); SearchVariant::activate_state($state); $logger->info("Addin...
[ "public", "function", "runGroup", "(", "LoggerInterface", "$", "logger", ",", "SolrIndex", "$", "indexInstance", ",", "$", "state", ",", "$", "class", ",", "$", "groups", ",", "$", "group", ")", "{", "// Set time limit and state", "Environment", "::", "increas...
Explicitly invoke the process that performs the group processing. Can be run either by a background task or a queuedjob. Does not commit changes to the index, so this must be controlled externally. @param LoggerInterface $logger @param SolrIndex $indexInstance @param array $state @param string $class @param int $grou...
[ "Explicitly", "invoke", "the", "process", "that", "performs", "the", "group", "processing", ".", "Can", "be", "run", "either", "by", "a", "background", "task", "or", "a", "queuedjob", "." ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/Reindex/Handlers/SolrReindexBase.php#L161-L194
silverstripe/silverstripe-fulltextsearch
src/Solr/Reindex/Handlers/SolrReindexBase.php
SolrReindexBase.getRecordsInGroup
protected function getRecordsInGroup(SolrIndex $indexInstance, $class, $groups, $group) { // Generate filtered list of local records $baseClass = DataObject::getSchema()->baseDataClass($class); $items = DataList::create($class) ->where(sprintf( '"%s"."ID" %% \'%d\...
php
protected function getRecordsInGroup(SolrIndex $indexInstance, $class, $groups, $group) { // Generate filtered list of local records $baseClass = DataObject::getSchema()->baseDataClass($class); $items = DataList::create($class) ->where(sprintf( '"%s"."ID" %% \'%d\...
[ "protected", "function", "getRecordsInGroup", "(", "SolrIndex", "$", "indexInstance", ",", "$", "class", ",", "$", "groups", ",", "$", "group", ")", "{", "// Generate filtered list of local records", "$", "baseClass", "=", "DataObject", "::", "getSchema", "(", ")"...
Gets the datalist of records in the given group in the current state Assumes that the desired variant state is in effect. @param SolrIndex $indexInstance @param string $class @param int $groups @param int $group @return DataList
[ "Gets", "the", "datalist", "of", "records", "in", "the", "given", "group", "in", "the", "current", "state" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/Reindex/Handlers/SolrReindexBase.php#L207-L228
silverstripe/silverstripe-fulltextsearch
src/Solr/Reindex/Handlers/SolrReindexBase.php
SolrReindexBase.clearRecords
protected function clearRecords(SolrIndex $indexInstance, $class, $groups = null, $group = null) { // Clear by classname $conditions = array("+(ClassHierarchy:{$class})"); // If grouping, delete from this group only if ($groups) { $conditions[] = "+_query_:\"{!frange l={...
php
protected function clearRecords(SolrIndex $indexInstance, $class, $groups = null, $group = null) { // Clear by classname $conditions = array("+(ClassHierarchy:{$class})"); // If grouping, delete from this group only if ($groups) { $conditions[] = "+_query_:\"{!frange l={...
[ "protected", "function", "clearRecords", "(", "SolrIndex", "$", "indexInstance", ",", "$", "class", ",", "$", "groups", "=", "null", ",", "$", "group", "=", "null", ")", "{", "// Clear by classname", "$", "conditions", "=", "array", "(", "\"+(ClassHierarchy:{$...
Clear all records of the given class in the current state ONLY. Optionally delete from a given group (where the group is defined as the ID % total groups) @param SolrIndex $indexInstance Index instance @param string $class Class name @param int $groups Number of groups, if clearing from a striped group @param int $gr...
[ "Clear", "all", "records", "of", "the", "given", "class", "in", "the", "current", "state", "ONLY", "." ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/Reindex/Handlers/SolrReindexBase.php#L240-L263
silverstripe/silverstripe-fulltextsearch
src/Solr/Reindex/Handlers/SolrReindexQueuedHandler.php
SolrReindexQueuedHandler.cancelExistingJobs
protected function cancelExistingJobs($type) { $clearable = array( // Paused jobs need to be discarded QueuedJob::STATUS_PAUSED, // These types would be automatically started QueuedJob::STATUS_NEW, QueuedJob::STATUS_WAIT, // Cancel an...
php
protected function cancelExistingJobs($type) { $clearable = array( // Paused jobs need to be discarded QueuedJob::STATUS_PAUSED, // These types would be automatically started QueuedJob::STATUS_NEW, QueuedJob::STATUS_WAIT, // Cancel an...
[ "protected", "function", "cancelExistingJobs", "(", "$", "type", ")", "{", "$", "clearable", "=", "array", "(", "// Paused jobs need to be discarded", "QueuedJob", "::", "STATUS_PAUSED", ",", "// These types would be automatically started", "QueuedJob", "::", "STATUS_NEW", ...
Cancel any cancellable jobs @param string $type Type of job to cancel @return int Number of jobs cleared
[ "Cancel", "any", "cancellable", "jobs" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/Reindex/Handlers/SolrReindexQueuedHandler.php#L41-L66
silverstripe/silverstripe-fulltextsearch
src/Solr/Writers/SolrSearchQueryWriterRange.php
SolrSearchQueryWriterRange.getLeftComparison
protected function getLeftComparison(SearchCriterion $searchCriterion) { switch ($searchCriterion->getComparison()) { case SearchCriterion::GREATER_EQUAL: case SearchCriterion::GREATER_THAN: return $searchCriterion->getValue(); case SearchCriterion::ISNULL...
php
protected function getLeftComparison(SearchCriterion $searchCriterion) { switch ($searchCriterion->getComparison()) { case SearchCriterion::GREATER_EQUAL: case SearchCriterion::GREATER_THAN: return $searchCriterion->getValue(); case SearchCriterion::ISNULL...
[ "protected", "function", "getLeftComparison", "(", "SearchCriterion", "$", "searchCriterion", ")", "{", "switch", "(", "$", "searchCriterion", "->", "getComparison", "(", ")", ")", "{", "case", "SearchCriterion", "::", "GREATER_EQUAL", ":", "case", "SearchCriterion"...
Select the value that we want as our left comparison value. @param SearchCriterion $searchCriterion @return mixed|string @throws InvalidArgumentException
[ "Select", "the", "value", "that", "we", "want", "as", "our", "left", "comparison", "value", "." ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/Writers/SolrSearchQueryWriterRange.php#L56-L70
silverstripe/silverstripe-fulltextsearch
src/Solr/Writers/SolrSearchQueryWriterRange.php
SolrSearchQueryWriterRange.getOpenComparisonContainer
protected function getOpenComparisonContainer($comparison) { switch ($comparison) { case SearchCriterion::GREATER_EQUAL: case SearchCriterion::LESS_EQUAL: case SearchCriterion::ISNULL: case SearchCriterion::ISNOTNULL: return '['; ca...
php
protected function getOpenComparisonContainer($comparison) { switch ($comparison) { case SearchCriterion::GREATER_EQUAL: case SearchCriterion::LESS_EQUAL: case SearchCriterion::ISNULL: case SearchCriterion::ISNOTNULL: return '['; ca...
[ "protected", "function", "getOpenComparisonContainer", "(", "$", "comparison", ")", "{", "switch", "(", "$", "comparison", ")", "{", "case", "SearchCriterion", "::", "GREATER_EQUAL", ":", "case", "SearchCriterion", "::", "LESS_EQUAL", ":", "case", "SearchCriterion",...
Does our comparison need a container? EG: "[* TO *]"? If so, return the opening container brace. @param string $comparison @return string @throws InvalidArgumentException
[ "Does", "our", "comparison", "need", "a", "container?", "EG", ":", "[", "*", "TO", "*", "]", "?", "If", "so", "return", "the", "opening", "container", "brace", "." ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/Writers/SolrSearchQueryWriterRange.php#L112-L126
silverstripe/silverstripe-fulltextsearch
src/Solr/Reindex/Jobs/SolrReindexQueuedJobBase.php
SolrReindexQueuedJobBase.getLogger
protected function getLogger() { if ($this->logger) { return $this->logger; } // Set logger for this job $this->logger = $this ->getLoggerFactory() ->getQueuedJobLogger($this); return $this->logger; }
php
protected function getLogger() { if ($this->logger) { return $this->logger; } // Set logger for this job $this->logger = $this ->getLoggerFactory() ->getQueuedJobLogger($this); return $this->logger; }
[ "protected", "function", "getLogger", "(", ")", "{", "if", "(", "$", "this", "->", "logger", ")", "{", "return", "$", "this", "->", "logger", ";", "}", "// Set logger for this job", "$", "this", "->", "logger", "=", "$", "this", "->", "getLoggerFactory", ...
Gets a logger for this job @return LoggerInterface
[ "Gets", "a", "logger", "for", "this", "job" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/Reindex/Jobs/SolrReindexQueuedJobBase.php#L62-L73
silverstripe/silverstripe-fulltextsearch
src/Solr/Reindex/Handlers/SolrReindexImmediateHandler.php
SolrReindexImmediateHandler.processGroup
protected function processGroup( LoggerInterface $logger, SolrIndex $indexInstance, $state, $class, $groups, $group, $taskName ) { $indexClass = get_class($indexInstance); // Build script parameters $indexClassEscaped = $indexClass; ...
php
protected function processGroup( LoggerInterface $logger, SolrIndex $indexInstance, $state, $class, $groups, $group, $taskName ) { $indexClass = get_class($indexInstance); // Build script parameters $indexClassEscaped = $indexClass; ...
[ "protected", "function", "processGroup", "(", "LoggerInterface", "$", "logger", ",", "SolrIndex", "$", "indexInstance", ",", "$", "state", ",", "$", "class", ",", "$", "groups", ",", "$", "group", ",", "$", "taskName", ")", "{", "$", "indexClass", "=", "...
Process a single group. Without queuedjobs, it's necessary to shell this out to a background task as this is very memory intensive. The sub-process will then invoke $processor->runGroup() in {@see Solr_Reindex::doReindex} @param LoggerInterface $logger @param SolrIndex $indexInstance Index instance @param array $sta...
[ "Process", "a", "single", "group", "." ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/Reindex/Handlers/SolrReindexImmediateHandler.php#L68-L123
silverstripe/silverstripe-fulltextsearch
src/Solr/Control/ContentControllerExtension.php
ContentControllerExtension.SearchForm
public function SearchForm() { $searchText = _t('SilverStripe\\CMS\\Search\\SearchForm.SEARCH', 'Search'); /** @var HTTPRequest $currentRequest */ $currentRequest = $this->owner->getRequest(); if ($currentRequest && $currentRequest->getVar('Search')) { $searchText = $cu...
php
public function SearchForm() { $searchText = _t('SilverStripe\\CMS\\Search\\SearchForm.SEARCH', 'Search'); /** @var HTTPRequest $currentRequest */ $currentRequest = $this->owner->getRequest(); if ($currentRequest && $currentRequest->getVar('Search')) { $searchText = $cu...
[ "public", "function", "SearchForm", "(", ")", "{", "$", "searchText", "=", "_t", "(", "'SilverStripe\\\\CMS\\\\Search\\\\SearchForm.SEARCH'", ",", "'Search'", ")", ";", "/** @var HTTPRequest $currentRequest */", "$", "currentRequest", "=", "$", "this", "->", "owner", ...
Site search form @return SearchForm
[ "Site", "search", "form" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/Control/ContentControllerExtension.php#L25-L42
silverstripe/silverstripe-fulltextsearch
src/Solr/Control/ContentControllerExtension.php
ContentControllerExtension.results
public function results($data, $form, $request) { $data = [ 'Results' => $form->getResults(), 'Query' => DBField::create_field('Text', $form->getSearchQuery()), 'Title' => _t('SilverStripe\\CMS\\Search\\SearchForm.SearchResults', 'Search Results') ]; retur...
php
public function results($data, $form, $request) { $data = [ 'Results' => $form->getResults(), 'Query' => DBField::create_field('Text', $form->getSearchQuery()), 'Title' => _t('SilverStripe\\CMS\\Search\\SearchForm.SearchResults', 'Search Results') ]; retur...
[ "public", "function", "results", "(", "$", "data", ",", "$", "form", ",", "$", "request", ")", "{", "$", "data", "=", "[", "'Results'", "=>", "$", "form", "->", "getResults", "(", ")", ",", "'Query'", "=>", "DBField", "::", "create_field", "(", "'Tex...
Process and render search results. @param array $data The raw request data submitted by user @param SearchForm $form The form instance that was submitted @param HTTPRequest $request Request generated for this action
[ "Process", "and", "render", "search", "results", "." ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/Control/ContentControllerExtension.php#L51-L59
silverstripe/silverstripe-fulltextsearch
src/Solr/Services/Solr4Service_Core.php
Solr4Service_Core.commit
public function commit($expungeDeletes = false, $waitFlush = null, $waitSearcher = true, $timeout = 3600) { if ($waitFlush) { user_error('waitFlush must be false when using Solr 4.0+' . E_USER_ERROR); } $expungeValue = $expungeDeletes ? 'true' : 'false'; $searcherValue =...
php
public function commit($expungeDeletes = false, $waitFlush = null, $waitSearcher = true, $timeout = 3600) { if ($waitFlush) { user_error('waitFlush must be false when using Solr 4.0+' . E_USER_ERROR); } $expungeValue = $expungeDeletes ? 'true' : 'false'; $searcherValue =...
[ "public", "function", "commit", "(", "$", "expungeDeletes", "=", "false", ",", "$", "waitFlush", "=", "null", ",", "$", "waitSearcher", "=", "true", ",", "$", "timeout", "=", "3600", ")", "{", "if", "(", "$", "waitFlush", ")", "{", "user_error", "(", ...
Replace underlying commit function to remove waitFlush in 4.0+, since it's been deprecated and 4.4 throws errors if you pass it
[ "Replace", "underlying", "commit", "function", "to", "remove", "waitFlush", "in", "4", ".", "0", "+", "since", "it", "s", "been", "deprecated", "and", "4", ".", "4", "throws", "errors", "if", "you", "pass", "it" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/Services/Solr4Service_Core.php#L11-L22
silverstripe/silverstripe-fulltextsearch
src/Solr/Services/Solr4Service_Core.php
Solr4Service_Core.addDocuments
public function addDocuments( $documents, $allowDups = false, $overwritePending = true, $overwriteCommitted = true, $commitWithin = 0 ) { $overwriteVal = $allowDups ? 'false' : 'true'; $commitWithin = (int) $commitWithin; $commitWithinString = $commitW...
php
public function addDocuments( $documents, $allowDups = false, $overwritePending = true, $overwriteCommitted = true, $commitWithin = 0 ) { $overwriteVal = $allowDups ? 'false' : 'true'; $commitWithin = (int) $commitWithin; $commitWithinString = $commitW...
[ "public", "function", "addDocuments", "(", "$", "documents", ",", "$", "allowDups", "=", "false", ",", "$", "overwritePending", "=", "true", ",", "$", "overwriteCommitted", "=", "true", ",", "$", "commitWithin", "=", "0", ")", "{", "$", "overwriteVal", "="...
Solr 4.0 compat http://wiki.apache.org/solr/UpdateXmlMessages#Optional_attributes_for_.22add.22 Remove allowDups, overwritePending and overwriteComitted
[ "Solr", "4", ".", "0", "compat", "http", ":", "//", "wiki", ".", "apache", ".", "org", "/", "solr", "/", "UpdateXmlMessages#Optional_attributes_for_", ".", "22add", ".", "22", "Remove", "allowDups", "overwritePending", "and", "overwriteComitted" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/Services/Solr4Service_Core.php#L42-L62
silverstripe/silverstripe-fulltextsearch
src/Search/Extensions/ProxyDBExtension.php
ProxyDBExtension.updateProxy
public function updateProxy(ProxyGenerator &$proxy) { $proxy = $proxy->addMethod('manipulate', function ($args, $next) { $manipulation = $args[0]; SearchUpdater::handle_manipulation($manipulation); return $next(...$args); }); }
php
public function updateProxy(ProxyGenerator &$proxy) { $proxy = $proxy->addMethod('manipulate', function ($args, $next) { $manipulation = $args[0]; SearchUpdater::handle_manipulation($manipulation); return $next(...$args); }); }
[ "public", "function", "updateProxy", "(", "ProxyGenerator", "&", "$", "proxy", ")", "{", "$", "proxy", "=", "$", "proxy", "->", "addMethod", "(", "'manipulate'", ",", "function", "(", "$", "args", ",", "$", "next", ")", "{", "$", "manipulation", "=", "...
@param ProxyGenerator $proxy Ensure the search index is kept up to date by monitoring SilverStripe database manipulations
[ "@param", "ProxyGenerator", "$proxy" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Extensions/ProxyDBExtension.php#L21-L28
silverstripe/silverstripe-fulltextsearch
src/Solr/Tasks/Solr_Configure.php
Solr_Configure.updateIndex
protected function updateIndex($instance, $store) { $index = $instance->getIndexName(); $this->getLogger()->info("Configuring $index."); // Upload the config files for this index $this->getLogger()->info("Uploading configuration ..."); $instance->uploadConfig($store); ...
php
protected function updateIndex($instance, $store) { $index = $instance->getIndexName(); $this->getLogger()->info("Configuring $index."); // Upload the config files for this index $this->getLogger()->info("Uploading configuration ..."); $instance->uploadConfig($store); ...
[ "protected", "function", "updateIndex", "(", "$", "instance", ",", "$", "store", ")", "{", "$", "index", "=", "$", "instance", "->", "getIndexName", "(", ")", ";", "$", "this", "->", "getLogger", "(", ")", "->", "info", "(", "\"Configuring $index.\"", ")...
Update the index on the given store @param SolrIndex $instance Instance @param SolrConfigStore $store
[ "Update", "the", "index", "on", "the", "given", "store" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/Tasks/Solr_Configure.php#L52-L72
silverstripe/silverstripe-fulltextsearch
src/Solr/Tasks/Solr_Configure.php
Solr_Configure.getSolrConfigStore
protected function getSolrConfigStore() { $options = Solr::solr_options(); if (!isset($options['indexstore']) || !($indexstore = $options['indexstore'])) { throw new Exception('No index configuration for Solr provided', E_USER_ERROR); } // Find the IndexStore handler, w...
php
protected function getSolrConfigStore() { $options = Solr::solr_options(); if (!isset($options['indexstore']) || !($indexstore = $options['indexstore'])) { throw new Exception('No index configuration for Solr provided', E_USER_ERROR); } // Find the IndexStore handler, w...
[ "protected", "function", "getSolrConfigStore", "(", ")", "{", "$", "options", "=", "Solr", "::", "solr_options", "(", ")", ";", "if", "(", "!", "isset", "(", "$", "options", "[", "'indexstore'", "]", ")", "||", "!", "(", "$", "indexstore", "=", "$", ...
Get config store @return SolrConfigStore @throws Exception
[ "Get", "config", "store" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/Tasks/Solr_Configure.php#L80-L104
silverstripe/silverstripe-fulltextsearch
src/Search/Variants/SearchVariant.php
SearchVariant.variants
public static function variants($class = null, $includeSubclasses = true) { if (!$class) { // Build up and cache a list of all search variants (subclasses of SearchVariant) if (self::$variants === null) { $classes = ClassInfo::subclassesFor(static::class); ...
php
public static function variants($class = null, $includeSubclasses = true) { if (!$class) { // Build up and cache a list of all search variants (subclasses of SearchVariant) if (self::$variants === null) { $classes = ClassInfo::subclassesFor(static::class); ...
[ "public", "static", "function", "variants", "(", "$", "class", "=", "null", ",", "$", "includeSubclasses", "=", "true", ")", "{", "if", "(", "!", "$", "class", ")", "{", "// Build up and cache a list of all search variants (subclasses of SearchVariant)", "if", "(", ...
Returns an array of variants. With no arguments, returns all variants With a classname as the first argument, returns the variants that apply to that class (optionally including subclasses) @static @param string $class - The class name to get variants for @param bool $includeSubclasses - True if variants should be i...
[ "Returns", "an", "array", "of", "variants", "." ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Variants/SearchVariant.php#L94-L131
silverstripe/silverstripe-fulltextsearch
src/Search/Variants/SearchVariant.php
SearchVariant.with
public static function with($class = null, $includeSubclasses = true) { // Make the cache key $key = $class ? $class . '!' . $includeSubclasses : '!'; // If no SearchVariant_Caller instance yet, create it if (!isset(self::$call_instances[$key])) { self::$call_instances[$k...
php
public static function with($class = null, $includeSubclasses = true) { // Make the cache key $key = $class ? $class . '!' . $includeSubclasses : '!'; // If no SearchVariant_Caller instance yet, create it if (!isset(self::$call_instances[$key])) { self::$call_instances[$k...
[ "public", "static", "function", "with", "(", "$", "class", "=", "null", ",", "$", "includeSubclasses", "=", "true", ")", "{", "// Make the cache key", "$", "key", "=", "$", "class", "?", "$", "class", ".", "'!'", ".", "$", "includeSubclasses", ":", "'!'"...
Lets you call any function on all variants that support it, in the same manner as "Object#extend" calls a method from extensions. Usage: SearchVariant::with(...)->call($method, $arg1, ...); @static @param string $class - (Optional) a classname. If passed, only variants that apply to that class will be checked / call...
[ "Lets", "you", "call", "any", "function", "on", "all", "variants", "that", "support", "it", "in", "the", "same", "manner", "as", "Object#extend", "calls", "a", "method", "from", "extensions", "." ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Variants/SearchVariant.php#L159-L169
silverstripe/silverstripe-fulltextsearch
src/Search/Variants/SearchVariant.php
SearchVariant.withCommon
public static function withCommon(array $classes = []) { // Allow caching $cacheKey = sha1(serialize($classes)); if (isset(self::$call_instances[$cacheKey])) { return self::$call_instances[$cacheKey]; } // Construct new array of variants applicable to at least on...
php
public static function withCommon(array $classes = []) { // Allow caching $cacheKey = sha1(serialize($classes)); if (isset(self::$call_instances[$cacheKey])) { return self::$call_instances[$cacheKey]; } // Construct new array of variants applicable to at least on...
[ "public", "static", "function", "withCommon", "(", "array", "$", "classes", "=", "[", "]", ")", "{", "// Allow caching", "$", "cacheKey", "=", "sha1", "(", "serialize", "(", "$", "classes", ")", ")", ";", "if", "(", "isset", "(", "self", "::", "$", "...
Similar to {@link SearchVariant::with}, except will only use variants that apply to at least one of the classes in the input array, where {@link SearchVariant::with} will run the query on the specific class you give it. @param string[] $classes @return SearchVariant_Caller
[ "Similar", "to", "{", "@link", "SearchVariant", "::", "with", "}", "except", "will", "only", "use", "variants", "that", "apply", "to", "at", "least", "one", "of", "the", "classes", "in", "the", "input", "array", "where", "{", "@link", "SearchVariant", "::"...
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Variants/SearchVariant.php#L178-L210
silverstripe/silverstripe-fulltextsearch
src/Search/Variants/SearchVariant.php
SearchVariant.current_state
public static function current_state($class = null, $includeSubclasses = true) { $state = array(); foreach (self::variants($class, $includeSubclasses) as $variant => $instance) { $state[$variant] = $instance->currentState(); } return $state; }
php
public static function current_state($class = null, $includeSubclasses = true) { $state = array(); foreach (self::variants($class, $includeSubclasses) as $variant => $instance) { $state[$variant] = $instance->currentState(); } return $state; }
[ "public", "static", "function", "current_state", "(", "$", "class", "=", "null", ",", "$", "includeSubclasses", "=", "true", ")", "{", "$", "state", "=", "array", "(", ")", ";", "foreach", "(", "self", "::", "variants", "(", "$", "class", ",", "$", "...
Get the current state of every variant @static @return array
[ "Get", "the", "current", "state", "of", "every", "variant" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Variants/SearchVariant.php#L228-L235
silverstripe/silverstripe-fulltextsearch
src/Search/Variants/SearchVariant.php
SearchVariant.activate_state
public static function activate_state($state) { foreach (self::variants() as $variant => $instance) { if (isset($state[$variant]) && $instance->appliesToEnvironment()) { $instance->activateState($state[$variant]); } } }
php
public static function activate_state($state) { foreach (self::variants() as $variant => $instance) { if (isset($state[$variant]) && $instance->appliesToEnvironment()) { $instance->activateState($state[$variant]); } } }
[ "public", "static", "function", "activate_state", "(", "$", "state", ")", "{", "foreach", "(", "self", "::", "variants", "(", ")", "as", "$", "variant", "=>", "$", "instance", ")", "{", "if", "(", "isset", "(", "$", "state", "[", "$", "variant", "]",...
Activate all the states in the passed argument @static @param array $state A set of (string)$variantClass => (any)$state pairs , e.g. as returned by SearchVariant::current_state() @return void
[ "Activate", "all", "the", "states", "in", "the", "passed", "argument" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Variants/SearchVariant.php#L244-L251
silverstripe/silverstripe-fulltextsearch
src/Search/Variants/SearchVariant.php
SearchVariant.reindex_states
public static function reindex_states($class = null, $includeSubclasses = true) { $allstates = array(); foreach (self::variants($class, $includeSubclasses) as $variant => $instance) { if ($states = $instance->reindexStates()) { $allstates[$variant] = $states; ...
php
public static function reindex_states($class = null, $includeSubclasses = true) { $allstates = array(); foreach (self::variants($class, $includeSubclasses) as $variant => $instance) { if ($states = $instance->reindexStates()) { $allstates[$variant] = $states; ...
[ "public", "static", "function", "reindex_states", "(", "$", "class", "=", "null", ",", "$", "includeSubclasses", "=", "true", ")", "{", "$", "allstates", "=", "array", "(", ")", ";", "foreach", "(", "self", "::", "variants", "(", "$", "class", ",", "$"...
Return an iterator that, when used in a for loop, activates one combination of reindex states per loop, and restores back to the original state at the end @static @param string $class - The class name to get variants for @param bool $includeSubclasses - True if variants should be included if they apply to at least one ...
[ "Return", "an", "iterator", "that", "when", "used", "in", "a", "for", "loop", "activates", "one", "combination", "of", "reindex", "states", "per", "loop", "and", "restores", "back", "to", "the", "original", "state", "at", "the", "end" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Variants/SearchVariant.php#L261-L272
silverstripe/silverstripe-fulltextsearch
src/Search/Variants/SearchVariant.php
SearchVariant.addFilterField
protected function addFilterField($index, $name, $field) { // If field already exists, make sure to merge origin / base fields if (isset($index->filterFields[$name])) { $field['base'] = $this->mergeClasses( $index->filterFields[$name]['base'], $field['base...
php
protected function addFilterField($index, $name, $field) { // If field already exists, make sure to merge origin / base fields if (isset($index->filterFields[$name])) { $field['base'] = $this->mergeClasses( $index->filterFields[$name]['base'], $field['base...
[ "protected", "function", "addFilterField", "(", "$", "index", ",", "$", "name", ",", "$", "field", ")", "{", "// If field already exists, make sure to merge origin / base fields", "if", "(", "isset", "(", "$", "index", "->", "filterFields", "[", "$", "name", "]", ...
Add new filter field to index safely. This method will respect existing filters with the same field name that correspond to multiple classes @param SearchIndex $index @param string $name Field name @param array $field Field spec
[ "Add", "new", "filter", "field", "to", "index", "safely", "." ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Variants/SearchVariant.php#L285-L300
silverstripe/silverstripe-fulltextsearch
src/Search/Variants/SearchVariant.php
SearchVariant.mergeClasses
protected function mergeClasses($left, $right) { // Merge together and remove dupes if (!is_array($left)) { $left = array($left); } if (!is_array($right)) { $right = array($right); } $merged = array_values(array_unique(array_merge($left, $right...
php
protected function mergeClasses($left, $right) { // Merge together and remove dupes if (!is_array($left)) { $left = array($left); } if (!is_array($right)) { $right = array($right); } $merged = array_values(array_unique(array_merge($left, $right...
[ "protected", "function", "mergeClasses", "(", "$", "left", ",", "$", "right", ")", "{", "// Merge together and remove dupes", "if", "(", "!", "is_array", "(", "$", "left", ")", ")", "{", "$", "left", "=", "array", "(", "$", "left", ")", ";", "}", "if",...
Merge sets of (or individual) class names together for a search index field. If there is only one unique class name, then just return it as a string instead of array. @param array|string $left Left class(es) @param array|string $right Right class(es) @return array|string List of classes, or single class
[ "Merge", "sets", "of", "(", "or", "individual", ")", "class", "names", "together", "for", "a", "search", "index", "field", "." ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Variants/SearchVariant.php#L311-L327
silverstripe/silverstripe-fulltextsearch
src/Solr/Forms/SearchForm.php
SearchForm.getResults
public function getResults() { // Get request data from request handler $request = $this->getRequestHandler()->getRequest(); $searchTerms = $request->requestVar('Search'); $query = SearchQuery::create()->addSearchTerm($searchTerms); if ($start = $request->requestVar('start'...
php
public function getResults() { // Get request data from request handler $request = $this->getRequestHandler()->getRequest(); $searchTerms = $request->requestVar('Search'); $query = SearchQuery::create()->addSearchTerm($searchTerms); if ($start = $request->requestVar('start'...
[ "public", "function", "getResults", "(", ")", "{", "// Get request data from request handler", "$", "request", "=", "$", "this", "->", "getRequestHandler", "(", ")", "->", "getRequest", "(", ")", ";", "$", "searchTerms", "=", "$", "request", "->", "requestVar", ...
Return dataObjectSet of the results using current request to get info from form. Simplest implementation loops over all Solr indexes @return ArrayData
[ "Return", "dataObjectSet", "of", "the", "results", "using", "current", "request", "to", "get", "info", "from", "form", ".", "Simplest", "implementation", "loops", "over", "all", "Solr", "indexes" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/Forms/SearchForm.php#L60-L95
silverstripe/silverstripe-fulltextsearch
src/Solr/Services/SolrService.php
SolrService.coreCommand
protected function coreCommand($command, $core, $params = array()) { $command = strtoupper($command); $params = array_merge($params, array('action' => $command, 'wt' => 'json')); $params[$command == 'CREATE' ? 'name' : 'core'] = $core; return $this->_sendRawGet($this->_constructUrl(...
php
protected function coreCommand($command, $core, $params = array()) { $command = strtoupper($command); $params = array_merge($params, array('action' => $command, 'wt' => 'json')); $params[$command == 'CREATE' ? 'name' : 'core'] = $core; return $this->_sendRawGet($this->_constructUrl(...
[ "protected", "function", "coreCommand", "(", "$", "command", ",", "$", "core", ",", "$", "params", "=", "array", "(", ")", ")", "{", "$", "command", "=", "strtoupper", "(", "$", "command", ")", ";", "$", "params", "=", "array_merge", "(", "$", "param...
Handle encoding the GET parameters and making the HTTP call to execute a core command
[ "Handle", "encoding", "the", "GET", "parameters", "and", "making", "the", "HTTP", "call", "to", "execute", "a", "core", "command" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/Services/SolrService.php#L22-L29
silverstripe/silverstripe-fulltextsearch
src/Solr/Services/SolrService.php
SolrService.coreIsActive
public function coreIsActive($core) { // Request the status of the full core name $result = $this->coreCommand('STATUS', $core); return isset($result->status->$core->uptime); }
php
public function coreIsActive($core) { // Request the status of the full core name $result = $this->coreCommand('STATUS', $core); return isset($result->status->$core->uptime); }
[ "public", "function", "coreIsActive", "(", "$", "core", ")", "{", "// Request the status of the full core name", "$", "result", "=", "$", "this", "->", "coreCommand", "(", "'STATUS'", ",", "$", "core", ")", ";", "return", "isset", "(", "$", "result", "->", "...
Is the passed core active? @param string $core The name of the core (an encoded class name) @return boolean True if that core exists & is active
[ "Is", "the", "passed", "core", "active?" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/Services/SolrService.php#L36-L41
silverstripe/silverstripe-fulltextsearch
src/Solr/Services/SolrService.php
SolrService.coreCreate
public function coreCreate($core, $instancedir, $config = null, $schema = null, $datadir = null) { $args = array('instanceDir' => $instancedir); if ($config) { $args['config'] = $config; } if ($schema) { $args['schema'] = $schema; } if ($datadi...
php
public function coreCreate($core, $instancedir, $config = null, $schema = null, $datadir = null) { $args = array('instanceDir' => $instancedir); if ($config) { $args['config'] = $config; } if ($schema) { $args['schema'] = $schema; } if ($datadi...
[ "public", "function", "coreCreate", "(", "$", "core", ",", "$", "instancedir", ",", "$", "config", "=", "null", ",", "$", "schema", "=", "null", ",", "$", "datadir", "=", "null", ")", "{", "$", "args", "=", "array", "(", "'instanceDir'", "=>", "$", ...
Create a new core @param $core string - The name of the core @param $instancedir string - The base path of the core on the server @param $config string - The filename of solrconfig.xml on the server. Default is $instancedir/solrconfig.xml @param $schema string - The filename of schema.xml on the server. Default is $ins...
[ "Create", "a", "new", "core" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/Services/SolrService.php#L52-L66
silverstripe/silverstripe-fulltextsearch
src/Solr/Services/SolrService.php
SolrService.serviceForCore
public function serviceForCore($core) { $klass = Config::inst()->get(get_called_class(), 'core_class'); return new $klass($this->_host, $this->_port, $this->_path . $core, $this->_httpTransport); }
php
public function serviceForCore($core) { $klass = Config::inst()->get(get_called_class(), 'core_class'); return new $klass($this->_host, $this->_port, $this->_path . $core, $this->_httpTransport); }
[ "public", "function", "serviceForCore", "(", "$", "core", ")", "{", "$", "klass", "=", "Config", "::", "inst", "(", ")", "->", "get", "(", "get_called_class", "(", ")", ",", "'core_class'", ")", ";", "return", "new", "$", "klass", "(", "$", "this", "...
Create a new Solr4Service_Core instance for the passed core @param $core string - The name of the core @return Solr4Service_Core
[ "Create", "a", "new", "Solr4Service_Core", "instance", "for", "the", "passed", "core" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/Services/SolrService.php#L83-L87
silverstripe/silverstripe-fulltextsearch
src/Solr/SolrIndex.php
SolrIndex.getIndexName
public function getIndexName() { $name = $this->sanitiseClassName(get_class($this), '-'); $indexParts = [$name]; if ($indexPrefix = Environment::getEnv('SS_SOLR_INDEX_PREFIX')) { array_unshift($indexParts, $indexPrefix); } if ($indexSuffix = Environment::getEnv...
php
public function getIndexName() { $name = $this->sanitiseClassName(get_class($this), '-'); $indexParts = [$name]; if ($indexPrefix = Environment::getEnv('SS_SOLR_INDEX_PREFIX')) { array_unshift($indexParts, $indexPrefix); } if ($indexSuffix = Environment::getEnv...
[ "public", "function", "getIndexName", "(", ")", "{", "$", "name", "=", "$", "this", "->", "sanitiseClassName", "(", "get_class", "(", "$", "this", ")", ",", "'-'", ")", ";", "$", "indexParts", "=", "[", "$", "name", "]", ";", "if", "(", "$", "index...
Helper for returning the correct index name. Supports prefixing and suffixing @return string
[ "Helper", "for", "returning", "the", "correct", "index", "name", ".", "Supports", "prefixing", "and", "suffixing" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/SolrIndex.php#L112-L127
silverstripe/silverstripe-fulltextsearch
src/Solr/SolrIndex.php
SolrIndex.addAnalyzer
public function addAnalyzer($field, $type, $params) { $fullFields = $this->fieldData($field); if ($fullFields) { foreach ($fullFields as $fullField => $spec) { if (!isset($this->analyzerFields[$fullField])) { $this->analyzerFields[$fullField] = array()...
php
public function addAnalyzer($field, $type, $params) { $fullFields = $this->fieldData($field); if ($fullFields) { foreach ($fullFields as $fullField => $spec) { if (!isset($this->analyzerFields[$fullField])) { $this->analyzerFields[$fullField] = array()...
[ "public", "function", "addAnalyzer", "(", "$", "field", ",", "$", "type", ",", "$", "params", ")", "{", "$", "fullFields", "=", "$", "this", "->", "fieldData", "(", "$", "field", ")", ";", "if", "(", "$", "fullFields", ")", "{", "foreach", "(", "$"...
Index-time analyzer which is applied to a specific field. Can be used to remove HTML tags, apply stemming, etc. @see http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.WhitespaceTokenizerFactory @param string $field @param string $type @param array $params parameters for the analyzer, usually at least a...
[ "Index", "-", "time", "analyzer", "which", "is", "applied", "to", "a", "specific", "field", ".", "Can", "be", "used", "to", "remove", "HTML", "tags", "apply", "stemming", "etc", "." ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/SolrIndex.php#L144-L155
silverstripe/silverstripe-fulltextsearch
src/Solr/SolrIndex.php
SolrIndex.getCopyDestinations
protected function getCopyDestinations() { $copyFields = $this->config()->copy_fields; if ($copyFields) { return $copyFields; } // Fallback to default field $df = $this->getDefaultField(); return array($df); }
php
protected function getCopyDestinations() { $copyFields = $this->config()->copy_fields; if ($copyFields) { return $copyFields; } // Fallback to default field $df = $this->getDefaultField(); return array($df); }
[ "protected", "function", "getCopyDestinations", "(", ")", "{", "$", "copyFields", "=", "$", "this", "->", "config", "(", ")", "->", "copy_fields", ";", "if", "(", "$", "copyFields", ")", "{", "return", "$", "copyFields", ";", "}", "// Fallback to default fie...
Get list of fields each text field should be copied into. This will fallback to the default field if omitted. @return array
[ "Get", "list", "of", "fields", "each", "text", "field", "should", "be", "copied", "into", ".", "This", "will", "fallback", "to", "the", "default", "field", "if", "omitted", "." ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/SolrIndex.php#L173-L182
silverstripe/silverstripe-fulltextsearch
src/Solr/SolrIndex.php
SolrIndex.getCollatedSuggestion
protected function getCollatedSuggestion($collation = '') { if (is_string($collation)) { return $collation; } if (is_object($collation)) { if (isset($collation->misspellingsAndCorrections)) { foreach ($collation->misspellingsAndCorrections as $key => $...
php
protected function getCollatedSuggestion($collation = '') { if (is_string($collation)) { return $collation; } if (is_object($collation)) { if (isset($collation->misspellingsAndCorrections)) { foreach ($collation->misspellingsAndCorrections as $key => $...
[ "protected", "function", "getCollatedSuggestion", "(", "$", "collation", "=", "''", ")", "{", "if", "(", "is_string", "(", "$", "collation", ")", ")", "{", "return", "$", "collation", ";", "}", "if", "(", "is_object", "(", "$", "collation", ")", ")", "...
Extract first suggestion text from collated values @param mixed $collation @return string
[ "Extract", "first", "suggestion", "text", "from", "collated", "values" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/SolrIndex.php#L233-L246
silverstripe/silverstripe-fulltextsearch
src/Solr/SolrIndex.php
SolrIndex.getNiceSuggestion
protected function getNiceSuggestion($collation = '') { $collationParts = explode(' ', $collation); // Remove advanced query params from the beginning of each collation part. foreach ($collationParts as $key => &$part) { $part = ltrim($part, '+'); } return implo...
php
protected function getNiceSuggestion($collation = '') { $collationParts = explode(' ', $collation); // Remove advanced query params from the beginning of each collation part. foreach ($collationParts as $key => &$part) { $part = ltrim($part, '+'); } return implo...
[ "protected", "function", "getNiceSuggestion", "(", "$", "collation", "=", "''", ")", "{", "$", "collationParts", "=", "explode", "(", "' '", ",", "$", "collation", ")", ";", "// Remove advanced query params from the beginning of each collation part.", "foreach", "(", ...
Extract a human friendly spelling suggestion from a Solr spellcheck collation string. @param string $collation @return String
[ "Extract", "a", "human", "friendly", "spelling", "suggestion", "from", "a", "Solr", "spellcheck", "collation", "string", "." ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/SolrIndex.php#L253-L263
silverstripe/silverstripe-fulltextsearch
src/Solr/SolrIndex.php
SolrIndex.addStoredField
public function addStoredField($field, $forceType = null, $extraOptions = array()) { $options = array_merge($extraOptions, array('stored' => 'true')); $this->addFulltextField($field, $forceType, $options); }
php
public function addStoredField($field, $forceType = null, $extraOptions = array()) { $options = array_merge($extraOptions, array('stored' => 'true')); $this->addFulltextField($field, $forceType, $options); }
[ "public", "function", "addStoredField", "(", "$", "field", ",", "$", "forceType", "=", "null", ",", "$", "extraOptions", "=", "array", "(", ")", ")", "{", "$", "options", "=", "array_merge", "(", "$", "extraOptions", ",", "array", "(", "'stored'", "=>", ...
Add a field that should be stored @param string $field The field to add @param string $forceType The type to force this field as (required in some cases, when not detectable from metadata) @param array $extraOptions Dependent on search implementation
[ "Add", "a", "field", "that", "should", "be", "stored" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/SolrIndex.php#L285-L289
silverstripe/silverstripe-fulltextsearch
src/Solr/SolrIndex.php
SolrIndex.addBoostedField
public function addBoostedField($field, $forceType = null, $extraOptions = array(), $boost = 2) { $options = array_merge($extraOptions, array('boost' => $boost)); $this->addFulltextField($field, $forceType, $options); }
php
public function addBoostedField($field, $forceType = null, $extraOptions = array(), $boost = 2) { $options = array_merge($extraOptions, array('boost' => $boost)); $this->addFulltextField($field, $forceType, $options); }
[ "public", "function", "addBoostedField", "(", "$", "field", ",", "$", "forceType", "=", "null", ",", "$", "extraOptions", "=", "array", "(", ")", ",", "$", "boost", "=", "2", ")", "{", "$", "options", "=", "array_merge", "(", "$", "extraOptions", ",", ...
Add a fulltext field with a boosted value @param string $field The field to add @param string $forceType The type to force this field as (required in some cases, when not detectable from metadata) @param array $extraOptions Dependent on search implementation @param float $boost Numeric boosting value (defaults to 2)
[ "Add", "a", "fulltext", "field", "with", "a", "boosted", "value" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/SolrIndex.php#L300-L304
silverstripe/silverstripe-fulltextsearch
src/Solr/SolrIndex.php
SolrIndex.setFieldBoosting
public function setFieldBoosting($field, $level) { if (!isset($this->fulltextFields[$field])) { throw new \InvalidArgumentException("No fulltext field $field exists on " . $this->getIndexName()); } if ($level === null) { unset($this->boostedFields[$field]); } ...
php
public function setFieldBoosting($field, $level) { if (!isset($this->fulltextFields[$field])) { throw new \InvalidArgumentException("No fulltext field $field exists on " . $this->getIndexName()); } if ($level === null) { unset($this->boostedFields[$field]); } ...
[ "public", "function", "setFieldBoosting", "(", "$", "field", ",", "$", "level", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "fulltextFields", "[", "$", "field", "]", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "...
Set the default boosting level for a specific field. Will control the default value for qf param (Query Fields), but will not override a query-specific value. Fields must be added before having a field boosting specified @param string $field Full field key (Model_Field) @param float|null $level Numeric boosting value...
[ "Set", "the", "default", "boosting", "level", "for", "a", "specific", "field", ".", "Will", "control", "the", "default", "value", "for", "qf", "param", "(", "Query", "Fields", ")", "but", "will", "not", "override", "a", "query", "-", "specific", "value", ...
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/SolrIndex.php#L336-L346
silverstripe/silverstripe-fulltextsearch
src/Solr/SolrIndex.php
SolrIndex.getQueryFields
public function getQueryFields() { // Not necessary to specify this unless boosting if (empty($this->boostedFields)) { return null; } $queryFields = array(); foreach ($this->boostedFields as $fieldName => $boost) { $queryFields[] = $fieldName . '^' . $...
php
public function getQueryFields() { // Not necessary to specify this unless boosting if (empty($this->boostedFields)) { return null; } $queryFields = array(); foreach ($this->boostedFields as $fieldName => $boost) { $queryFields[] = $fieldName . '^' . $...
[ "public", "function", "getQueryFields", "(", ")", "{", "// Not necessary to specify this unless boosting", "if", "(", "empty", "(", "$", "this", "->", "boostedFields", ")", ")", "{", "return", "null", ";", "}", "$", "queryFields", "=", "array", "(", ")", ";", ...
Determine the best default value for the 'qf' parameter @return array|null List of query fields, or null if not specified
[ "Determine", "the", "best", "default", "value", "for", "the", "qf", "parameter" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/SolrIndex.php#L363-L381
silverstripe/silverstripe-fulltextsearch
src/Solr/SolrIndex.php
SolrIndex.toXmlTag
protected function toXmlTag($tag, $attrs, $content = null) { $xml = "<$tag "; if ($attrs) { $attrStrs = array(); foreach ($attrs as $attrName => $attrVal) { $attrStrs[] = "$attrName='$attrVal'"; } $xml .= $attrStrs ? implode(' ', $attrS...
php
protected function toXmlTag($tag, $attrs, $content = null) { $xml = "<$tag "; if ($attrs) { $attrStrs = array(); foreach ($attrs as $attrName => $attrVal) { $attrStrs[] = "$attrName='$attrVal'"; } $xml .= $attrStrs ? implode(' ', $attrS...
[ "protected", "function", "toXmlTag", "(", "$", "tag", ",", "$", "attrs", ",", "$", "content", "=", "null", ")", "{", "$", "xml", "=", "\"<$tag \"", ";", "if", "(", "$", "attrs", ")", "{", "$", "attrStrs", "=", "array", "(", ")", ";", "foreach", "...
Convert definition to XML tag @param string $tag @param string $attrs Map of attributes @param string $content Inner content @return String XML tag
[ "Convert", "definition", "to", "XML", "tag" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/SolrIndex.php#L440-L452
silverstripe/silverstripe-fulltextsearch
src/Solr/SolrIndex.php
SolrIndex.getCopyFieldDefinitions
public function getCopyFieldDefinitions() { $xml = array(); // Default copy fields foreach ($this->getCopyDestinations() as $copyTo) { foreach ($this->fulltextFields as $name => $field) { $xml[] = "<copyField source='{$name}' dest='{$copyTo}' />"; } ...
php
public function getCopyFieldDefinitions() { $xml = array(); // Default copy fields foreach ($this->getCopyDestinations() as $copyTo) { foreach ($this->fulltextFields as $name => $field) { $xml[] = "<copyField source='{$name}' dest='{$copyTo}' />"; } ...
[ "public", "function", "getCopyFieldDefinitions", "(", ")", "{", "$", "xml", "=", "array", "(", ")", ";", "// Default copy fields", "foreach", "(", "$", "this", "->", "getCopyDestinations", "(", ")", "as", "$", "copyTo", ")", "{", "foreach", "(", "$", "this...
Generate XML for copy field definitions @return string
[ "Generate", "XML", "for", "copy", "field", "definitions" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/SolrIndex.php#L474-L493
silverstripe/silverstripe-fulltextsearch
src/Solr/SolrIndex.php
SolrIndex.classIs
protected function classIs($class, $base) { if (is_array($base)) { foreach ($base as $nextBase) { if ($this->classIs($class, $nextBase)) { return true; } } return false; } // Check single origin ...
php
protected function classIs($class, $base) { if (is_array($base)) { foreach ($base as $nextBase) { if ($this->classIs($class, $nextBase)) { return true; } } return false; } // Check single origin ...
[ "protected", "function", "classIs", "(", "$", "class", ",", "$", "base", ")", "{", "if", "(", "is_array", "(", "$", "base", ")", ")", "{", "foreach", "(", "$", "base", "as", "$", "nextBase", ")", "{", "if", "(", "$", "this", "->", "classIs", "(",...
Determine if the given object is one of the given type @param string $class @param array|string $base Class or list of base classes @return bool
[ "Determine", "if", "the", "given", "object", "is", "one", "of", "the", "given", "type" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/SolrIndex.php#L502-L515
silverstripe/silverstripe-fulltextsearch
src/Solr/SolrIndex.php
SolrIndex.clearObsoleteClasses
public function clearObsoleteClasses($classes) { if (empty($classes)) { return false; } // Delete all records which do not match the necessary classname rules $conditions = array(); foreach ($classes as $class => $options) { if ($options['include_chil...
php
public function clearObsoleteClasses($classes) { if (empty($classes)) { return false; } // Delete all records which do not match the necessary classname rules $conditions = array(); foreach ($classes as $class => $options) { if ($options['include_chil...
[ "public", "function", "clearObsoleteClasses", "(", "$", "classes", ")", "{", "if", "(", "empty", "(", "$", "classes", ")", ")", "{", "return", "false", ";", "}", "// Delete all records which do not match the necessary classname rules", "$", "conditions", "=", "array...
Clear all records which do not match the given classname whitelist. Can also be used to trim an index when reducing to a narrower set of classes. Ignores current state / variant. @param array $classes List of non-obsolete classes in the same format as SolrIndex::getClasses() @return bool Flag if successful @throws \...
[ "Clear", "all", "records", "which", "do", "not", "match", "the", "given", "classname", "whitelist", "." ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/SolrIndex.php#L651-L673
silverstripe/silverstripe-fulltextsearch
src/Solr/SolrIndex.php
SolrIndex.applySearchVariants
protected function applySearchVariants(SearchQuery $query) { $classes = count($query->classes) ? $query->classes : $this->getClasses(); /** @var SearchVariant_Caller $variantCaller */ $variantCaller = SearchVariant::withCommon($classes); $variantCaller->call('alterQuery', $query, $t...
php
protected function applySearchVariants(SearchQuery $query) { $classes = count($query->classes) ? $query->classes : $this->getClasses(); /** @var SearchVariant_Caller $variantCaller */ $variantCaller = SearchVariant::withCommon($classes); $variantCaller->call('alterQuery', $query, $t...
[ "protected", "function", "applySearchVariants", "(", "SearchQuery", "$", "query", ")", "{", "$", "classes", "=", "count", "(", "$", "query", "->", "classes", ")", "?", "$", "query", "->", "classes", ":", "$", "this", "->", "getClasses", "(", ")", ";", ...
With a common set of variants that are relevant to at least one class in the list (from either the query or the current index), allow them to alter the query to add their variant column conditions. @param SearchQuery $query
[ "With", "a", "common", "set", "of", "variants", "that", "are", "relevant", "to", "at", "least", "one", "class", "in", "the", "list", "(", "from", "either", "the", "query", "or", "the", "current", "index", ")", "allow", "them", "to", "alter", "the", "qu...
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/SolrIndex.php#L861-L868
silverstripe/silverstripe-fulltextsearch
src/Solr/SolrIndex.php
SolrIndex.getQueryComponent
protected function getQueryComponent(SearchQuery $searchQuery, &$hlq = array()) { $q = array(); foreach ($searchQuery->search as $search) { $text = $search['text']; preg_match_all('/"[^"]*"|\S+/', $text, $parts); $fuzzy = $search['fuzzy'] ? '~' : ''; ...
php
protected function getQueryComponent(SearchQuery $searchQuery, &$hlq = array()) { $q = array(); foreach ($searchQuery->search as $search) { $text = $search['text']; preg_match_all('/"[^"]*"|\S+/', $text, $parts); $fuzzy = $search['fuzzy'] ? '~' : ''; ...
[ "protected", "function", "getQueryComponent", "(", "SearchQuery", "$", "searchQuery", ",", "&", "$", "hlq", "=", "array", "(", ")", ")", "{", "$", "q", "=", "array", "(", ")", ";", "foreach", "(", "$", "searchQuery", "->", "search", "as", "$", "search"...
Get the query (q) component for this search @param SearchQuery $searchQuery @param array &$hlq Highlight query returned by reference @return array
[ "Get", "the", "query", "(", "q", ")", "component", "for", "this", "search" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/SolrIndex.php#L889-L920
silverstripe/silverstripe-fulltextsearch
src/Solr/SolrIndex.php
SolrIndex.getRequireFiltersComponent
protected function getRequireFiltersComponent(SearchQuery $searchQuery) { $fq = array(); foreach ($searchQuery->require as $field => $values) { $requireq = array(); foreach ($values as $value) { if ($value === SearchQuery::$missing) { $req...
php
protected function getRequireFiltersComponent(SearchQuery $searchQuery) { $fq = array(); foreach ($searchQuery->require as $field => $values) { $requireq = array(); foreach ($values as $value) { if ($value === SearchQuery::$missing) { $req...
[ "protected", "function", "getRequireFiltersComponent", "(", "SearchQuery", "$", "searchQuery", ")", "{", "$", "fq", "=", "array", "(", ")", ";", "foreach", "(", "$", "searchQuery", "->", "require", "as", "$", "field", "=>", "$", "values", ")", "{", "$", ...
Parse all require constraints for inclusion in a filter query @param SearchQuery $searchQuery @return array List of parsed string values for each require
[ "Parse", "all", "require", "constraints", "for", "inclusion", "in", "a", "filter", "query" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/SolrIndex.php#L928-L957
silverstripe/silverstripe-fulltextsearch
src/Solr/SolrIndex.php
SolrIndex.getExcludeFiltersComponent
protected function getExcludeFiltersComponent(SearchQuery $searchQuery) { $fq = array(); foreach ($searchQuery->exclude as $field => $values) { // Handle namespaced class names $field = $this->sanitiseClassName($field); $excludeq = []; $missing = fals...
php
protected function getExcludeFiltersComponent(SearchQuery $searchQuery) { $fq = array(); foreach ($searchQuery->exclude as $field => $values) { // Handle namespaced class names $field = $this->sanitiseClassName($field); $excludeq = []; $missing = fals...
[ "protected", "function", "getExcludeFiltersComponent", "(", "SearchQuery", "$", "searchQuery", ")", "{", "$", "fq", "=", "array", "(", ")", ";", "foreach", "(", "$", "searchQuery", "->", "exclude", "as", "$", "field", "=>", "$", "values", ")", "{", "// Han...
Parse all exclude constraints for inclusion in a filter query @param SearchQuery $searchQuery @return array List of parsed string values for each exclusion
[ "Parse", "all", "exclude", "constraints", "for", "inclusion", "in", "a", "filter", "query" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/SolrIndex.php#L965-L998
silverstripe/silverstripe-fulltextsearch
src/Solr/SolrIndex.php
SolrIndex.getFiltersComponent
public function getFiltersComponent(SearchQuery $searchQuery) { $criteriaComponent = $this->getCriteriaComponent($searchQuery); $components = array_merge( $this->getRequireFiltersComponent($searchQuery), $this->getExcludeFiltersComponent($searchQuery) ); if ...
php
public function getFiltersComponent(SearchQuery $searchQuery) { $criteriaComponent = $this->getCriteriaComponent($searchQuery); $components = array_merge( $this->getRequireFiltersComponent($searchQuery), $this->getExcludeFiltersComponent($searchQuery) ); if ...
[ "public", "function", "getFiltersComponent", "(", "SearchQuery", "$", "searchQuery", ")", "{", "$", "criteriaComponent", "=", "$", "this", "->", "getCriteriaComponent", "(", "$", "searchQuery", ")", ";", "$", "components", "=", "array_merge", "(", "$", "this", ...
Get all filter conditions for this search @param SearchQuery $searchQuery @return array @throws \Exception
[ "Get", "all", "filter", "conditions", "for", "this", "search" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/SolrIndex.php#L1037-L1051
silverstripe/silverstripe-fulltextsearch
src/Solr/SolrIndex.php
SolrIndex.uploadConfig
public function uploadConfig($store) { // Upload the config files for this index $store->uploadString( $this->getIndexName(), 'schema.xml', (string)$this->generateSchema() ); // Upload additional files foreach (glob($this->getExtrasPath() ...
php
public function uploadConfig($store) { // Upload the config files for this index $store->uploadString( $this->getIndexName(), 'schema.xml', (string)$this->generateSchema() ); // Upload additional files foreach (glob($this->getExtrasPath() ...
[ "public", "function", "uploadConfig", "(", "$", "store", ")", "{", "// Upload the config files for this index", "$", "store", "->", "uploadString", "(", "$", "this", "->", "getIndexName", "(", ")", ",", "'schema.xml'", ",", "(", "string", ")", "$", "this", "->...
Upload config for this index to the given store @param SolrConfigStore $store
[ "Upload", "config", "for", "this", "index", "to", "the", "given", "store" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/SolrIndex.php#L1077-L1092
silverstripe/silverstripe-fulltextsearch
src/Search/Variants/SearchVariantSubsites.php
SearchVariantSubsites.alterQuery
public function alterQuery($query, $index) { if ($this->isFieldFiltered('_subsite', $query) || !$this->appliesToEnvironment()) { return; } $subsite = $this->currentState(); $query->addFilter('_subsite', [$subsite, SearchQuery::$missing]); }
php
public function alterQuery($query, $index) { if ($this->isFieldFiltered('_subsite', $query) || !$this->appliesToEnvironment()) { return; } $subsite = $this->currentState(); $query->addFilter('_subsite', [$subsite, SearchQuery::$missing]); }
[ "public", "function", "alterQuery", "(", "$", "query", ",", "$", "index", ")", "{", "if", "(", "$", "this", "->", "isFieldFiltered", "(", "'_subsite'", ",", "$", "query", ")", "||", "!", "$", "this", "->", "appliesToEnvironment", "(", ")", ")", "{", ...
This field has been altered to allow a user to obtain search results for a particular subsite When attempting to do this in project code, SearchVariantSubsites kicks and overwrites any filter you've applied This fix prevents the module from doing this if a filter is applied on the index or the query, or if a field is b...
[ "This", "field", "has", "been", "altered", "to", "allow", "a", "user", "to", "obtain", "search", "results", "for", "a", "particular", "subsite", "When", "attempting", "to", "do", "this", "in", "project", "code", "SearchVariantSubsites", "kicks", "and", "overwr...
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Variants/SearchVariantSubsites.php#L108-L116
silverstripe/silverstripe-fulltextsearch
src/Search/Variants/SearchVariantSubsites.php
SearchVariantSubsites.extractManipulationWriteState
public function extractManipulationWriteState(&$writes) { $self = get_class($this); $tableName = DataObject::getSchema()->tableName(Subsite::class); $query = SQLSelect::create('"ID"', '"' . $tableName . '"'); $subsites = array_merge(['0'], $query->execute()->column()); forea...
php
public function extractManipulationWriteState(&$writes) { $self = get_class($this); $tableName = DataObject::getSchema()->tableName(Subsite::class); $query = SQLSelect::create('"ID"', '"' . $tableName . '"'); $subsites = array_merge(['0'], $query->execute()->column()); forea...
[ "public", "function", "extractManipulationWriteState", "(", "&", "$", "writes", ")", "{", "$", "self", "=", "get_class", "(", "$", "this", ")", ";", "$", "tableName", "=", "DataObject", "::", "getSchema", "(", ")", "->", "tableName", "(", "Subsite", "::", ...
We need _really_ complicated logic to find just the changed subsites (because we use versions there's no explicit deletes, just new versions with different members) so just always use all of them
[ "We", "need", "_really_", "complicated", "logic", "to", "find", "just", "the", "changed", "subsites", "(", "because", "we", "use", "versions", "there", "s", "no", "explicit", "deletes", "just", "new", "versions", "with", "different", "members", ")", "so", "j...
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Variants/SearchVariantSubsites.php#L122-L160
silverstripe/silverstripe-fulltextsearch
src/Search/Indexes/SearchIndex.php
SearchIndex.fieldData
public function fieldData($field, $forceType = null, $extraOptions = []) { $fullfield = str_replace(".", "_", $field); $sources = $this->getClasses(); foreach ($sources as $source => $options) { $sources[$source]['base'] = DataObject::getSchema()->baseDataClass($source); ...
php
public function fieldData($field, $forceType = null, $extraOptions = []) { $fullfield = str_replace(".", "_", $field); $sources = $this->getClasses(); foreach ($sources as $source => $options) { $sources[$source]['base'] = DataObject::getSchema()->baseDataClass($source); ...
[ "public", "function", "fieldData", "(", "$", "field", ",", "$", "forceType", "=", "null", ",", "$", "extraOptions", "=", "[", "]", ")", "{", "$", "fullfield", "=", "str_replace", "(", "\".\"", ",", "\"_\"", ",", "$", "field", ")", ";", "$", "sources"...
Examines the classes this index is built on to try and find defined fields in the class hierarchy for those classes. Looks for db and viewable-data fields, although can't necessarily find type for viewable-data fields. If multiple classes have a relation with the same name all of these will be included in the search in...
[ "Examines", "the", "classes", "this", "index", "is", "built", "on", "to", "try", "and", "find", "defined", "fields", "in", "the", "class", "hierarchy", "for", "those", "classes", ".", "Looks", "for", "db", "and", "viewable", "-", "data", "fields", "althoug...
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Indexes/SearchIndex.php#L103-L256
silverstripe/silverstripe-fulltextsearch
src/Search/Indexes/SearchIndex.php
SearchIndex.addClass
public function addClass($class, $options = array()) { if ($this->fulltextFields || $this->filterFields || $this->sortFields) { throw new Exception('Can\'t add class to Index after fields have already been added'); } $options = array_merge(array( 'include_children' =...
php
public function addClass($class, $options = array()) { if ($this->fulltextFields || $this->filterFields || $this->sortFields) { throw new Exception('Can\'t add class to Index after fields have already been added'); } $options = array_merge(array( 'include_children' =...
[ "public", "function", "addClass", "(", "$", "class", ",", "$", "options", "=", "array", "(", ")", ")", "{", "if", "(", "$", "this", "->", "fulltextFields", "||", "$", "this", "->", "filterFields", "||", "$", "this", "->", "sortFields", ")", "{", "thr...
Add a DataObject subclass whose instances should be included in this index Can only be called when addFulltextField, addFilterField, addSortField and addAllFulltextFields have not yet been called for this index instance @throws Exception @param string $class - The class to include @param array $options - TODO: Remove
[ "Add", "a", "DataObject", "subclass", "whose", "instances", "should", "be", "included", "in", "this", "index" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Indexes/SearchIndex.php#L280-L291
silverstripe/silverstripe-fulltextsearch
src/Search/Indexes/SearchIndex.php
SearchIndex.addFulltextField
public function addFulltextField($field, $forceType = null, $extraOptions = array()) { $this->fulltextFields = array_merge($this->fulltextFields, $this->fieldData($field, $forceType, $extraOptions)); }
php
public function addFulltextField($field, $forceType = null, $extraOptions = array()) { $this->fulltextFields = array_merge($this->fulltextFields, $this->fieldData($field, $forceType, $extraOptions)); }
[ "public", "function", "addFulltextField", "(", "$", "field", ",", "$", "forceType", "=", "null", ",", "$", "extraOptions", "=", "array", "(", ")", ")", "{", "$", "this", "->", "fulltextFields", "=", "array_merge", "(", "$", "this", "->", "fulltextFields", ...
Add a field that should be fulltext searchable @param string $field - The field to add @param string $forceType - The type to force this field as (required in some cases, when not detectable from metadata) @param string $extraOptions - Dependent on search implementation
[ "Add", "a", "field", "that", "should", "be", "fulltext", "searchable" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Indexes/SearchIndex.php#L307-L310
silverstripe/silverstripe-fulltextsearch
src/Search/Indexes/SearchIndex.php
SearchIndex.addFilterField
public function addFilterField($field, $forceType = null, $extraOptions = array()) { $this->filterFields = array_merge($this->filterFields, $this->fieldData($field, $forceType, $extraOptions)); }
php
public function addFilterField($field, $forceType = null, $extraOptions = array()) { $this->filterFields = array_merge($this->filterFields, $this->fieldData($field, $forceType, $extraOptions)); }
[ "public", "function", "addFilterField", "(", "$", "field", ",", "$", "forceType", "=", "null", ",", "$", "extraOptions", "=", "array", "(", ")", ")", "{", "$", "this", "->", "filterFields", "=", "array_merge", "(", "$", "this", "->", "filterFields", ",",...
Add a field that should be filterable @param string $field - The field to add @param string $forceType - The type to force this field as (required in some cases, when not detectable from metadata) @param string $extraOptions - Dependent on search implementation
[ "Add", "a", "field", "that", "should", "be", "filterable" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Indexes/SearchIndex.php#L323-L326
silverstripe/silverstripe-fulltextsearch
src/Search/Indexes/SearchIndex.php
SearchIndex.addSortField
public function addSortField($field, $forceType = null, $extraOptions = array()) { $this->sortFields = array_merge($this->sortFields, $this->fieldData($field, $forceType, $extraOptions)); }
php
public function addSortField($field, $forceType = null, $extraOptions = array()) { $this->sortFields = array_merge($this->sortFields, $this->fieldData($field, $forceType, $extraOptions)); }
[ "public", "function", "addSortField", "(", "$", "field", ",", "$", "forceType", "=", "null", ",", "$", "extraOptions", "=", "array", "(", ")", ")", "{", "$", "this", "->", "sortFields", "=", "array_merge", "(", "$", "this", "->", "sortFields", ",", "$"...
Add a field that should be sortable @param string $field - The field to add @param string $forceType - The type to force this field as (required in some cases, when not detectable from metadata) @param string $extraOptions - Dependent on search implementation
[ "Add", "a", "field", "that", "should", "be", "sortable" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Indexes/SearchIndex.php#L339-L342
silverstripe/silverstripe-fulltextsearch
src/Search/Indexes/SearchIndex.php
SearchIndex.addAllFulltextFields
public function addAllFulltextFields($includeSubclasses = true) { foreach ($this->getClasses() as $class => $options) { $classHierarchy = SearchIntrospection::hierarchy($class, $includeSubclasses, true); foreach ($classHierarchy as $dataClass) { $fields = DataObject:...
php
public function addAllFulltextFields($includeSubclasses = true) { foreach ($this->getClasses() as $class => $options) { $classHierarchy = SearchIntrospection::hierarchy($class, $includeSubclasses, true); foreach ($classHierarchy as $dataClass) { $fields = DataObject:...
[ "public", "function", "addAllFulltextFields", "(", "$", "includeSubclasses", "=", "true", ")", "{", "foreach", "(", "$", "this", "->", "getClasses", "(", ")", "as", "$", "class", "=>", "$", "options", ")", "{", "$", "classHierarchy", "=", "SearchIntrospectio...
Add all database-backed text fields as fulltext searchable fields. For every class included in the index, examines those classes and all subclasses looking for "Text" database fields (Varchar, Text, HTMLText, etc) and adds them all as fulltext searchable fields.
[ "Add", "all", "database", "-", "backed", "text", "fields", "as", "fulltext", "searchable", "fields", "." ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Indexes/SearchIndex.php#L355-L374
silverstripe/silverstripe-fulltextsearch
src/Search/Indexes/SearchIndex.php
SearchIndex.variantStateExcluded
public function variantStateExcluded($state) { foreach ($this->excludedVariantStates as $excludedstate) { $matches = true; foreach ($excludedstate as $variant => $variantstate) { if (!isset($state[$variant]) || $state[$variant] != $variantstate) { ...
php
public function variantStateExcluded($state) { foreach ($this->excludedVariantStates as $excludedstate) { $matches = true; foreach ($excludedstate as $variant => $variantstate) { if (!isset($state[$variant]) || $state[$variant] != $variantstate) { ...
[ "public", "function", "variantStateExcluded", "(", "$", "state", ")", "{", "foreach", "(", "$", "this", "->", "excludedVariantStates", "as", "$", "excludedstate", ")", "{", "$", "matches", "=", "true", ";", "foreach", "(", "$", "excludedstate", "as", "$", ...
Returns true if some variant state should be ignored
[ "Returns", "true", "if", "some", "variant", "state", "should", "be", "ignored" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Indexes/SearchIndex.php#L393-L409
silverstripe/silverstripe-fulltextsearch
src/Search/Indexes/SearchIndex.php
SearchIndex.getDerivedFields
public function getDerivedFields() { if ($this->derivedFields === null) { $this->derivedFields = array(); foreach ($this->getFieldsIterator() as $name => $field) { if (count($field['lookup_chain']) < 2) { continue; } ...
php
public function getDerivedFields() { if ($this->derivedFields === null) { $this->derivedFields = array(); foreach ($this->getFieldsIterator() as $name => $field) { if (count($field['lookup_chain']) < 2) { continue; } ...
[ "public", "function", "getDerivedFields", "(", ")", "{", "if", "(", "$", "this", "->", "derivedFields", "===", "null", ")", "{", "$", "this", "->", "derivedFields", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "getFieldsIterator", "(",...
Returns an array where each member is all the fields and the classes that are at the end of some specific lookup chain from one of the base classes
[ "Returns", "an", "array", "where", "each", "member", "is", "all", "the", "fields", "and", "the", "classes", "that", "are", "at", "the", "end", "of", "some", "specific", "lookup", "chain", "from", "one", "of", "the", "base", "classes" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Indexes/SearchIndex.php#L431-L462
silverstripe/silverstripe-fulltextsearch
src/Search/Indexes/SearchIndex.php
SearchIndex.getDocumentIDForState
public function getDocumentIDForState($base, $id, $state) { ksort($state); $parts = array('id' => $id, 'base' => $base, 'state' => json_encode($state)); return implode('-', array_values($parts)); }
php
public function getDocumentIDForState($base, $id, $state) { ksort($state); $parts = array('id' => $id, 'base' => $base, 'state' => json_encode($state)); return implode('-', array_values($parts)); }
[ "public", "function", "getDocumentIDForState", "(", "$", "base", ",", "$", "id", ",", "$", "state", ")", "{", "ksort", "(", "$", "state", ")", ";", "$", "parts", "=", "array", "(", "'id'", "=>", "$", "id", ",", "'base'", "=>", "$", "base", ",", "...
Get the "document ID" (a database & variant unique id) given some "Base" class, DataObject ID and state array @param string $base - The base class of the object @param integer $id - The ID of the object @param array $state - The variant state of the object @return string - The document ID as a string
[ "Get", "the", "document", "ID", "(", "a", "database", "&", "variant", "unique", "id", ")", "given", "some", "Base", "class", "DataObject", "ID", "and", "state", "array" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Indexes/SearchIndex.php#L472-L477
silverstripe/silverstripe-fulltextsearch
src/Search/Indexes/SearchIndex.php
SearchIndex.getDocumentID
public function getDocumentID($object, $base, $includesubs) { return $this->getDocumentIDForState($base, $object->ID, SearchVariant::current_state($base, $includesubs)); }
php
public function getDocumentID($object, $base, $includesubs) { return $this->getDocumentIDForState($base, $object->ID, SearchVariant::current_state($base, $includesubs)); }
[ "public", "function", "getDocumentID", "(", "$", "object", ",", "$", "base", ",", "$", "includesubs", ")", "{", "return", "$", "this", "->", "getDocumentIDForState", "(", "$", "base", ",", "$", "object", "->", "ID", ",", "SearchVariant", "::", "current_sta...
Get the "document ID" (a database & variant unique id) given some "Base" class and DataObject @param DataObject $object - The object @param string $base - The base class of the object @param boolean $includesubs - TODO: Probably going away @return string - The document ID as a string
[ "Get", "the", "document", "ID", "(", "a", "database", "&", "variant", "unique", "id", ")", "given", "some", "Base", "class", "and", "DataObject" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Indexes/SearchIndex.php#L487-L490
silverstripe/silverstripe-fulltextsearch
src/Search/Indexes/SearchIndex.php
SearchIndex._getFieldValue
protected function _getFieldValue($object, $field) { $errorHandler = function ($no, $str) { throw new Exception('HTML Parse Error: ' . $str); }; set_error_handler($errorHandler, E_ALL); try { foreach ($field['lookup_chain'] as $step) { // Just...
php
protected function _getFieldValue($object, $field) { $errorHandler = function ($no, $str) { throw new Exception('HTML Parse Error: ' . $str); }; set_error_handler($errorHandler, E_ALL); try { foreach ($field['lookup_chain'] as $step) { // Just...
[ "protected", "function", "_getFieldValue", "(", "$", "object", ",", "$", "field", ")", "{", "$", "errorHandler", "=", "function", "(", "$", "no", ",", "$", "str", ")", "{", "throw", "new", "Exception", "(", "'HTML Parse Error: '", ".", "$", "str", ")", ...
Given an object and a field definition (as returned by fieldData) get the current value of that field on that object @param DataObject $object - The object to get the value from @param array $field - The field definition to use @return mixed - The value of the field, or null if we couldn't look it up for some reason
[ "Given", "an", "object", "and", "a", "field", "definition", "(", "as", "returned", "by", "fieldData", ")", "get", "the", "current", "value", "of", "that", "field", "on", "that", "object" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Indexes/SearchIndex.php#L499-L559
silverstripe/silverstripe-fulltextsearch
src/Search/Indexes/SearchIndex.php
SearchIndex.getDirtyIDs
public function getDirtyIDs($class, $id, $statefulids, $fields) { $dirty = array(); // First, if this object is directly contained in the index, add it foreach ($this->classes as $searchclass => $options) { if ($searchclass == $class || ($options['include_children'] && is_subcla...
php
public function getDirtyIDs($class, $id, $statefulids, $fields) { $dirty = array(); // First, if this object is directly contained in the index, add it foreach ($this->classes as $searchclass => $options) { if ($searchclass == $class || ($options['include_children'] && is_subcla...
[ "public", "function", "getDirtyIDs", "(", "$", "class", ",", "$", "id", ",", "$", "statefulids", ",", "$", "fields", ")", "{", "$", "dirty", "=", "array", "(", ")", ";", "// First, if this object is directly contained in the index, add it", "foreach", "(", "$", ...
Given a class, object id, set of stateful ids and a list of changed fields (in a special format), return what statefulids need updating in this index Internal function used by SearchUpdater. @param string $class @param int $id @param array $statefulids @param array $fields @return array
[ "Given", "a", "class", "object", "id", "set", "of", "stateful", "ids", "and", "a", "list", "of", "changed", "fields", "(", "in", "a", "special", "format", ")", "return", "what", "statefulids", "need", "updating", "in", "this", "index" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Indexes/SearchIndex.php#L583-L660
silverstripe/silverstripe-fulltextsearch
src/Search/Updaters/SearchUpdater.php
SearchUpdater.handle_manipulation
public static function handle_manipulation($manipulation) { if (!static::config()->get('enabled')) { return; } // First, extract any state that is in the manipulation itself foreach ($manipulation as $table => $details) { if (!isset($manipulation[$table]['cla...
php
public static function handle_manipulation($manipulation) { if (!static::config()->get('enabled')) { return; } // First, extract any state that is in the manipulation itself foreach ($manipulation as $table => $details) { if (!isset($manipulation[$table]['cla...
[ "public", "static", "function", "handle_manipulation", "(", "$", "manipulation", ")", "{", "if", "(", "!", "static", "::", "config", "(", ")", "->", "get", "(", "'enabled'", ")", ")", "{", "return", ";", "}", "// First, extract any state that is in the manipulat...
Called by the ProxyDBExtension database connector with every manipulation made against the database. Check every index to see what objects need re-inserting into what indexes to keep the index fresh, but doesn't actually do it yet. TODO: This is pretty sensitive to the format of manipulation that DataObject::write pr...
[ "Called", "by", "the", "ProxyDBExtension", "database", "connector", "with", "every", "manipulation", "made", "against", "the", "database", "." ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Updaters/SearchUpdater.php#L62-L133
silverstripe/silverstripe-fulltextsearch
src/Search/Updaters/SearchUpdater.php
SearchUpdater.process_writes
public static function process_writes($writes) { foreach ($writes as $write) { // For every index foreach (FullTextSearch::get_indexes() as $index => $instance) { // If that index as a field from this class if (SearchIntrospection::is_subclass_of($writ...
php
public static function process_writes($writes) { foreach ($writes as $write) { // For every index foreach (FullTextSearch::get_indexes() as $index => $instance) { // If that index as a field from this class if (SearchIntrospection::is_subclass_of($writ...
[ "public", "static", "function", "process_writes", "(", "$", "writes", ")", "{", "foreach", "(", "$", "writes", "as", "$", "write", ")", "{", "// For every index", "foreach", "(", "FullTextSearch", "::", "get_indexes", "(", ")", "as", "$", "index", "=>", "$...
Send updates to the current search processor for execution @param array $writes
[ "Send", "updates", "to", "the", "current", "search", "processor", "for", "execution" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Updaters/SearchUpdater.php#L140-L168
silverstripe/silverstripe-fulltextsearch
src/Search/SearchIntrospection.php
SearchIntrospection.is_subclass_of
public static function is_subclass_of($class, $of) { $ancestry = isset(self::$ancestry[$class]) ? self::$ancestry[$class] : (self::$ancestry[$class] = ClassInfo::ancestry($class)); return is_array($of) ? (bool)array_intersect($of, $ancestry) : array_key_exists($of, $ancestry); }
php
public static function is_subclass_of($class, $of) { $ancestry = isset(self::$ancestry[$class]) ? self::$ancestry[$class] : (self::$ancestry[$class] = ClassInfo::ancestry($class)); return is_array($of) ? (bool)array_intersect($of, $ancestry) : array_key_exists($of, $ancestry); }
[ "public", "static", "function", "is_subclass_of", "(", "$", "class", ",", "$", "of", ")", "{", "$", "ancestry", "=", "isset", "(", "self", "::", "$", "ancestry", "[", "$", "class", "]", ")", "?", "self", "::", "$", "ancestry", "[", "$", "class", "]...
Check if class is subclass of (a) the class in $of, or (b) any of the classes in the array $of @static @param $class @param $of @return bool
[ "Check", "if", "class", "is", "subclass", "of", "(", "a", ")", "the", "class", "in", "$of", "or", "(", "b", ")", "any", "of", "the", "classes", "in", "the", "array", "$of" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/SearchIntrospection.php#L21-L25
silverstripe/silverstripe-fulltextsearch
src/Search/SearchIntrospection.php
SearchIntrospection.hierarchy
public static function hierarchy($class, $includeSubclasses = true, $dataOnly = false) { $key = "$class!" . ($includeSubclasses ? 'sc' : 'an') . '!' . ($dataOnly ? 'do' : 'al'); if (!isset(self::$hierarchy[$key])) { $classes = array_values(ClassInfo::ancestry($class)); if ($...
php
public static function hierarchy($class, $includeSubclasses = true, $dataOnly = false) { $key = "$class!" . ($includeSubclasses ? 'sc' : 'an') . '!' . ($dataOnly ? 'do' : 'al'); if (!isset(self::$hierarchy[$key])) { $classes = array_values(ClassInfo::ancestry($class)); if ($...
[ "public", "static", "function", "hierarchy", "(", "$", "class", ",", "$", "includeSubclasses", "=", "true", ",", "$", "dataOnly", "=", "false", ")", "{", "$", "key", "=", "\"$class!\"", ".", "(", "$", "includeSubclasses", "?", "'sc'", ":", "'an'", ")", ...
Get all the classes involved in a DataObject hierarchy - both super and optionally subclasses @static @param string $class - The class to query @param bool $includeSubclasses - True to return subclasses as well as super classes @param bool $dataOnly - True to only return classes that have tables @return array - Intege...
[ "Get", "all", "the", "classes", "involved", "in", "a", "DataObject", "hierarchy", "-", "both", "super", "and", "optionally", "subclasses" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/SearchIntrospection.php#L38-L65
silverstripe/silverstripe-fulltextsearch
src/Search/SearchIntrospection.php
SearchIntrospection.add_unique_by_ancestor
public static function add_unique_by_ancestor(&$list, $class) { // If class already has parent in list, just ignore if (self::is_subclass_of($class, $list)) { return; } // Strip out any subclasses of $class already in the list $children = ClassInfo::subclassesFor...
php
public static function add_unique_by_ancestor(&$list, $class) { // If class already has parent in list, just ignore if (self::is_subclass_of($class, $list)) { return; } // Strip out any subclasses of $class already in the list $children = ClassInfo::subclassesFor...
[ "public", "static", "function", "add_unique_by_ancestor", "(", "&", "$", "list", ",", "$", "class", ")", "{", "// If class already has parent in list, just ignore", "if", "(", "self", "::", "is_subclass_of", "(", "$", "class", ",", "$", "list", ")", ")", "{", ...
Add classes to list, keeping only the parent when parent & child are both in list after add
[ "Add", "classes", "to", "list", "keeping", "only", "the", "parent", "when", "parent", "&", "child", "are", "both", "in", "list", "after", "add" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/SearchIntrospection.php#L70-L83
silverstripe/silverstripe-fulltextsearch
src/Search/SearchIntrospection.php
SearchIntrospection.has_extension
public static function has_extension($class, $extension, $includeSubclasses = true) { foreach (self::hierarchy($class, $includeSubclasses) as $relatedclass) { if ($relatedclass::has_extension($extension)) { return true; } } return false; }
php
public static function has_extension($class, $extension, $includeSubclasses = true) { foreach (self::hierarchy($class, $includeSubclasses) as $relatedclass) { if ($relatedclass::has_extension($extension)) { return true; } } return false; }
[ "public", "static", "function", "has_extension", "(", "$", "class", ",", "$", "extension", ",", "$", "includeSubclasses", "=", "true", ")", "{", "foreach", "(", "self", "::", "hierarchy", "(", "$", "class", ",", "$", "includeSubclasses", ")", "as", "$", ...
Does this class, it's parent (or optionally one of it's children) have the passed extension attached?
[ "Does", "this", "class", "it", "s", "parent", "(", "or", "optionally", "one", "of", "it", "s", "children", ")", "have", "the", "passed", "extension", "attached?" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/SearchIntrospection.php#L88-L96
silverstripe/silverstripe-fulltextsearch
src/Search/Criteria/SearchCriteria.php
SearchCriteria.create
public static function create( $target, $value = null, $comparison = null, AbstractSearchQueryWriter $searchQueryWriter = null ) { return new SearchCriteria($target, $value, $comparison, $searchQueryWriter); }
php
public static function create( $target, $value = null, $comparison = null, AbstractSearchQueryWriter $searchQueryWriter = null ) { return new SearchCriteria($target, $value, $comparison, $searchQueryWriter); }
[ "public", "static", "function", "create", "(", "$", "target", ",", "$", "value", "=", "null", ",", "$", "comparison", "=", "null", ",", "AbstractSearchQueryWriter", "$", "searchQueryWriter", "=", "null", ")", "{", "return", "new", "SearchCriteria", "(", "$",...
Static create method provided so that you can perform method chaining. @param $target @param null $value @param null $comparison @param AbstractSearchQueryWriter $searchQueryWriter @return SearchCriteria
[ "Static", "create", "method", "provided", "so", "that", "you", "can", "perform", "method", "chaining", "." ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Criteria/SearchCriteria.php#L76-L83
silverstripe/silverstripe-fulltextsearch
src/Solr/Tasks/Solr_BuildTask.php
Solr_BuildTask.run
public function run($request) { $name = get_class($this); $verbose = $request->getVar('verbose'); // Set new logger $logger = $this ->getLoggerFactory() ->getOutputLogger($name, $verbose); $this->setLogger($logger); }
php
public function run($request) { $name = get_class($this); $verbose = $request->getVar('verbose'); // Set new logger $logger = $this ->getLoggerFactory() ->getOutputLogger($name, $verbose); $this->setLogger($logger); }
[ "public", "function", "run", "(", "$", "request", ")", "{", "$", "name", "=", "get_class", "(", "$", "this", ")", ";", "$", "verbose", "=", "$", "request", "->", "getVar", "(", "'verbose'", ")", ";", "// Set new logger", "$", "logger", "=", "$", "thi...
Setup task @param HTTPRequest $request
[ "Setup", "task" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Solr/Tasks/Solr_BuildTask.php#L58-L68
silverstripe/silverstripe-fulltextsearch
src/Search/FullTextSearch.php
FullTextSearch.get_indexes
public static function get_indexes($class = null, $rebuild = false) { if ($rebuild) { self::$all_indexes = null; self::$indexes_by_subclass = array(); } if (!$class) { if (self::$all_indexes === null) { // Get declared indexes, or otherwis...
php
public static function get_indexes($class = null, $rebuild = false) { if ($rebuild) { self::$all_indexes = null; self::$indexes_by_subclass = array(); } if (!$class) { if (self::$all_indexes === null) { // Get declared indexes, or otherwis...
[ "public", "static", "function", "get_indexes", "(", "$", "class", "=", "null", ",", "$", "rebuild", "=", "false", ")", "{", "if", "(", "$", "rebuild", ")", "{", "self", "::", "$", "all_indexes", "=", "null", ";", "self", "::", "$", "indexes_by_subclass...
Get all the instantiable search indexes (so all the user created indexes, but not the connector or library level abstract indexes). Can optionally be filtered to only return indexes that are subclasses of some class @static @param string $class - Class name to filter indexes by, so that all returned indexes are subcla...
[ "Get", "all", "the", "instantiable", "search", "indexes", "(", "so", "all", "the", "user", "created", "indexes", "but", "not", "the", "connector", "or", "library", "level", "abstract", "indexes", ")", ".", "Can", "optionally", "be", "filtered", "to", "only",...
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/FullTextSearch.php#L38-L99
silverstripe/silverstripe-fulltextsearch
src/Search/FullTextSearch.php
FullTextSearch.force_index_list
public static function force_index_list() { $indexes = func_get_args(); // No arguments = back to automatic if (!$indexes) { self::get_indexes(null, true); return; } // Arguments can be a single array if (is_array($indexes[0])) { ...
php
public static function force_index_list() { $indexes = func_get_args(); // No arguments = back to automatic if (!$indexes) { self::get_indexes(null, true); return; } // Arguments can be a single array if (is_array($indexes[0])) { ...
[ "public", "static", "function", "force_index_list", "(", ")", "{", "$", "indexes", "=", "func_get_args", "(", ")", ";", "// No arguments = back to automatic", "if", "(", "!", "$", "indexes", ")", "{", "self", "::", "get_indexes", "(", "null", ",", "true", ")...
Sometimes, like when in tests, you want to restrain the actual indexes to a subset Call with one argument - an array of class names, index instances or classname => indexinstance pairs (can be mixed). Alternatively call with multiple arguments, each of which is a class name or index instance From then on, fulltext se...
[ "Sometimes", "like", "when", "in", "tests", "you", "want", "to", "restrain", "the", "actual", "indexes", "to", "a", "subset" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/FullTextSearch.php#L114-L145
silverstripe/silverstripe-fulltextsearch
src/Utils/Logging/MonologFactory.php
MonologFactory.getStreamHandler
protected function getStreamHandler(FormatterInterface $formatter, $stream, $level = Logger::DEBUG, $bubble = true) { // Unless cli, force output to php://output $stream = Director::is_cli() ? $stream : 'php://output'; $handler = Injector::inst()->createWithArgs( StreamHandler::c...
php
protected function getStreamHandler(FormatterInterface $formatter, $stream, $level = Logger::DEBUG, $bubble = true) { // Unless cli, force output to php://output $stream = Director::is_cli() ? $stream : 'php://output'; $handler = Injector::inst()->createWithArgs( StreamHandler::c...
[ "protected", "function", "getStreamHandler", "(", "FormatterInterface", "$", "formatter", ",", "$", "stream", ",", "$", "level", "=", "Logger", "::", "DEBUG", ",", "$", "bubble", "=", "true", ")", "{", "// Unless cli, force output to php://output", "$", "stream", ...
Generate a handler for the given stream @param FormatterInterface $formatter @param string $stream Name of preferred stream @param int $level @param bool $bubble @return HandlerInterface
[ "Generate", "a", "handler", "for", "the", "given", "stream" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Utils/Logging/MonologFactory.php#L53-L63
silverstripe/silverstripe-fulltextsearch
src/Utils/Logging/MonologFactory.php
MonologFactory.getFormatter
protected function getFormatter() { // Get formatter $format = LineFormatter::SIMPLE_FORMAT; if (!Director::is_cli()) { $format = "<p>$format</p>"; } return Injector::inst()->createWithArgs( LineFormatter::class, array($format) ); ...
php
protected function getFormatter() { // Get formatter $format = LineFormatter::SIMPLE_FORMAT; if (!Director::is_cli()) { $format = "<p>$format</p>"; } return Injector::inst()->createWithArgs( LineFormatter::class, array($format) ); ...
[ "protected", "function", "getFormatter", "(", ")", "{", "// Get formatter", "$", "format", "=", "LineFormatter", "::", "SIMPLE_FORMAT", ";", "if", "(", "!", "Director", "::", "is_cli", "(", ")", ")", "{", "$", "format", "=", "\"<p>$format</p>\"", ";", "}", ...
Gets a formatter for standard output @return FormatterInterface
[ "Gets", "a", "formatter", "for", "standard", "output" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Utils/Logging/MonologFactory.php#L70-L81
silverstripe/silverstripe-fulltextsearch
src/Search/Processors/SearchUpdateProcessor.php
SearchUpdateProcessor.prepareIndexes
protected function prepareIndexes() { $originalState = SearchVariant::current_state(); $dirtyIndexes = array(); $dirty = $this->getSource(); $indexes = FullTextSearch::get_indexes(); foreach ($dirty as $base => $statefulids) { if (!$statefulids) { ...
php
protected function prepareIndexes() { $originalState = SearchVariant::current_state(); $dirtyIndexes = array(); $dirty = $this->getSource(); $indexes = FullTextSearch::get_indexes(); foreach ($dirty as $base => $statefulids) { if (!$statefulids) { ...
[ "protected", "function", "prepareIndexes", "(", ")", "{", "$", "originalState", "=", "SearchVariant", "::", "current_state", "(", ")", ";", "$", "dirtyIndexes", "=", "array", "(", ")", ";", "$", "dirty", "=", "$", "this", "->", "getSource", "(", ")", ";"...
Generates the list of indexes to process for the dirty items @return array
[ "Generates", "the", "list", "of", "indexes", "to", "process", "for", "the", "dirty", "items" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Processors/SearchUpdateProcessor.php#L68-L111
silverstripe/silverstripe-fulltextsearch
src/Search/Processors/SearchUpdateProcessor.php
SearchUpdateProcessor.process
public function process() { // Generate and commit all instances $indexes = $this->prepareIndexes(); foreach ($indexes as $index) { if (!$this->commitIndex($index)) { return false; } } return true; }
php
public function process() { // Generate and commit all instances $indexes = $this->prepareIndexes(); foreach ($indexes as $index) { if (!$this->commitIndex($index)) { return false; } } return true; }
[ "public", "function", "process", "(", ")", "{", "// Generate and commit all instances", "$", "indexes", "=", "$", "this", "->", "prepareIndexes", "(", ")", ";", "foreach", "(", "$", "indexes", "as", "$", "index", ")", "{", "if", "(", "!", "$", "this", "-...
Process all indexes, returning true if successful @return bool Flag indicating success
[ "Process", "all", "indexes", "returning", "true", "if", "successful" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Processors/SearchUpdateProcessor.php#L139-L149
silverstripe/silverstripe-fulltextsearch
src/Search/Processors/SearchUpdateCommitJobProcessor.php
SearchUpdateCommitJobProcessor.queue
public static function queue($dirty = true, $startAfter = null) { $commit = Injector::inst()->create(__CLASS__); $id = singleton(QueuedJobService::class)->queueJob($commit, $startAfter); if ($dirty) { $indexes = FullTextSearch::get_indexes(); static::$dirty_indexes =...
php
public static function queue($dirty = true, $startAfter = null) { $commit = Injector::inst()->create(__CLASS__); $id = singleton(QueuedJobService::class)->queueJob($commit, $startAfter); if ($dirty) { $indexes = FullTextSearch::get_indexes(); static::$dirty_indexes =...
[ "public", "static", "function", "queue", "(", "$", "dirty", "=", "true", ",", "$", "startAfter", "=", "null", ")", "{", "$", "commit", "=", "Injector", "::", "inst", "(", ")", "->", "create", "(", "__CLASS__", ")", ";", "$", "id", "=", "singleton", ...
This method is invoked once indexes with dirty ids have been updapted and a commit is necessary @param boolean $dirty Marks all indexes as dirty by default. Set to false if there are known comitted and clean indexes @param string $startAfter Start date @return int The ID of the next queuedjob to run. This could be a n...
[ "This", "method", "is", "invoked", "once", "indexes", "with", "dirty", "ids", "have", "been", "updapted", "and", "a", "commit", "is", "necessary" ]
train
https://github.com/silverstripe/silverstripe-fulltextsearch/blob/d6a119ce202f1af0112fb0ed046d578fe878aeb4/src/Search/Processors/SearchUpdateCommitJobProcessor.php#L93-L103