1. Go to this page and download the library: Download sammaye/yii2-solr library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sammaye / yii2-solr example snippets
$query = Yii::$app->solr->createSelect();
$query->setQuery('edismax&qf=title^20.0 OR description^0.3');
$result = Yii::$app->solr->select($query);
var_dump($result->getNumFound());
$query = Yii::$app->solr->createSelect();
$query->setQuery('(alt_subject_mpath:' . $model->path . ' OR alt_subject_mpath:' . $model->path . '.*) AND live:1');
new SolrDataProvider([
'query' => $query,
// an example class which assigns variables to the model(s)
// and returns the model(s)
'modelClass' => 'SolrResult',
'sort' => [
'attributes' => [
'title',
'sales',
'score'
]
]
]);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.