Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Set Field Weights #66

Closed
yr4ik opened this issue Nov 6, 2021 · 1 comment
Closed

Set Field Weights #66

yr4ik opened this issue Nov 6, 2021 · 1 comment

Comments

@yr4ik
Copy link

yr4ik commented Nov 6, 2021

Здравствуйте. Никак не могу разобраться как при помощи данного клиента можно задать приоритет полям


$client = new \Manticoresearch\Client( array(
	'host' => $config_db['manticore.db_server'],
	'port' => 9308) 
);

$this->manticore = new \Manticoresearch\Search($client);

$this->manticore->setIndex('index');

$this->manticore->maxMatches($config->maxResults);
$this->manticore->limit(30);

if (isset($filter['visible']))
	$this->manticore->filter('visible', 'eq', intval($filter['visible']));

// только для продуктов так как нужный индекс есть только там
if (!empty($filter['status']))
	$this->manticore->filter('status', 'in', (array) $filter['status']);


// только для продуктов так как нужный индекс есть только там
if (!empty($filter['sort_priority_stock']))
	$this->manticore->sort('status_sort', 'desc');


$result_search] = array();
$results = $this->manticore->match(['query'=>$search_query, 'operator'=>'and'])->get();

foreach($results as $hit)
{
	$result_search[] = $hit->getId();
}

@githubmanticore
Copy link

➤ Sergey Nikolaev commented:

Пока что только через метод SQL.

Обсуждалось тут #42
Закрываю это issue, как дубликат.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants