Skip to content

Commit

Permalink
Look ma! I'm writing docs!
Browse files Browse the repository at this point in the history
  • Loading branch information
Firesphere committed Sep 9, 2019
1 parent b42d070 commit 69471d3
Show file tree
Hide file tree
Showing 14 changed files with 197 additions and 19 deletions.
9 changes: 9 additions & 0 deletions src/Factories/QueryComponentFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,25 @@ class QueryComponentFactory
'Spellcheck',
];
/**
* BaseQuery that needs to be executed
* @var BaseQuery
*/
protected $query;
/**
* Helper to escape the query terms properly
*
* @var Helper
*/
protected $helper;
/**
* Resulting querie parts as an array
*
* @var array
*/
protected $queryArray = [];
/**
* Index to query
*
* @var BaseIndex
*/
protected $index;
Expand Down Expand Up @@ -156,6 +163,8 @@ public function getClientQuery(): Query
}

/**
* Set a custom Client Query object
*
* @param Query $clientQuery
* @return self
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Helpers/DataResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function __construct($component, $columns = [])
*/
public static function identify($obj, $columns = [])
{
/** @var @see {self::$objTypes} $type */
/** @var {@link self::$objTypes} $type */
foreach (self::$objTypes as $type => $method) {
if ($obj instanceof $type) {
$method = 'resolve' . $method;
Expand Down
5 changes: 4 additions & 1 deletion src/Helpers/SolrLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
*
* Log information from Solr to the CMS for reference
*
* @todo implement {@link LoggerInterface}
* @package Firesphere\SolrSearch\Helpers
*/
class SolrLogger
{
/**
* Guzzle base client to communicate with Solr
*
* @var Client
*/
protected $client;
Expand Down Expand Up @@ -54,7 +57,7 @@ public function __construct($handler = null)
* @throws GuzzleException
* @throws ValidationException
*/
public static function logMessage($type, $message, $index)
public static function logMessage($type, $message, $index): void
{
$solrLogger = new self();
$solrLogger->saveSolrLog($type);
Expand Down
20 changes: 19 additions & 1 deletion src/Indexes/BaseIndex.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,20 @@ abstract class BaseIndex
'StoredFields',
];
/**
* @var \Solarium\Core\Query\Result\Result
* The raw query result
*
* @var Result
*/
protected $rawQuery;
/**
* {@link SchemaService}
*
* @var SchemaService
*/
protected $schemaService;
/**
* {@link QueryComponentFactory}
*
* @var QueryComponentFactory
*/
protected $queryFactory;
Expand All @@ -87,6 +93,8 @@ abstract class BaseIndex
*/
protected $queryTerms = [];
/**
* Should a retry occur if nothing was found and there are suggestions to follow
*
* @var bool
*/
private $retry = false;
Expand Down Expand Up @@ -224,6 +232,8 @@ public function doSearch(BaseQuery $query)
}

/**
* From the given BaseQuery, generate a Solarium ClientQuery object
*
* @param BaseQuery $query
* @return Query
*/
Expand All @@ -242,6 +252,8 @@ public function buildSolrQuery(BaseQuery $query): Query
}

/**
* Build a factory to use in the SolrQuery building. {@link static::buildSolrQuery()}
*
* @param BaseQuery $query
* @param Query $clientQuery
* @return QueryComponentFactory|mixed
Expand Down Expand Up @@ -304,6 +316,8 @@ protected function spellcheckRetry(BaseQuery $query, SearchResult $searchResult)
}

/**
* Get all fields that are required for indexing in a unique way
*
* @return array
*/
public function getFieldsForIndexing(): array
Expand Down Expand Up @@ -381,6 +395,8 @@ public function getSynonyms($defaults = true): string
}

/**
* Get the final, generated terms
*
* @return array
*/
public function getQueryTerms(): array
Expand All @@ -389,6 +405,8 @@ public function getQueryTerms(): array
}

/**
* Get the QueryComponentFactory. {@link QueryComponentFactory}
*
* @return QueryComponentFactory
*/
public function getQueryFactory(): QueryComponentFactory
Expand Down
4 changes: 3 additions & 1 deletion src/Jobs/SolrConfigureJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class SolrConfigureJob extends AbstractQueuedJob
{

/**
* My name
*
* @return string
*/
public function getTitle(): string
Expand All @@ -28,7 +30,7 @@ public function getTitle(): string
}

/**
* Do some processing yourself!
* Process the queue for indexes that need to be indexed properly
*
* @return void
* @throws ReflectionException
Expand Down
20 changes: 18 additions & 2 deletions src/Jobs/SolrIndexJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
use Symbiote\QueuedJobs\Services\QueuedJobService;

/**
* Class SolrIndexJob
* Class SolrIndexJob is a queued job to index all existing indexes and their classes.
*
* It always runs on all indexes, to make sure all indexes are up to date.
*
* @package Firesphere\SolrSearch\Jobs
*/
Expand All @@ -42,6 +44,8 @@ class SolrIndexJob extends AbstractQueuedJob
protected $indexes;

/**
* My name
*
* @return string
*/
public function getTitle()
Expand All @@ -50,7 +54,7 @@ public function getTitle()
}

/**
* Do some processing yourself!
* Process this job
*
* @return self
* @throws Exception
Expand Down Expand Up @@ -89,6 +93,8 @@ public function process()
}

/**
* Configure the run for the valid indexes
*
* @param stdClass|null $data
* @throws ReflectionException
*/
Expand Down Expand Up @@ -130,6 +136,8 @@ public function afterComplete()
}

/**
* Get the next step to execute
*
* @return array
*/
protected function getNextSteps(): array
Expand All @@ -155,6 +163,8 @@ protected function getNextSteps(): array
}

/**
* Which Indexes should I index
*
* @return array
*/
public function getClassToIndex(): array
Expand All @@ -163,6 +173,8 @@ public function getClassToIndex(): array
}

/**
* Which classes should I index
*
* @param array $classToIndex
* @return SolrIndexJob
*/
Expand All @@ -174,6 +186,8 @@ public function setClassToIndex($classToIndex)
}

/**
* Get the indexes
*
* @return array
*/
public function getIndexes(): array
Expand All @@ -182,6 +196,8 @@ public function getIndexes(): array
}

/**
* Set the indexes if needed
*
* @param array $indexes
* @return SolrIndexJob
*/
Expand Down
Loading

0 comments on commit 69471d3

Please sign in to comment.