Skip to content

Commit

Permalink
Update arSolrExistsQuery and add functionality
Browse files Browse the repository at this point in the history
Add lucene based existence query for arSolrExistsQuery
  • Loading branch information
anvit committed Jul 10, 2024
1 parent 3e485ae commit bbafb78
Showing 1 changed file with 59 additions and 1 deletion.
60 changes: 59 additions & 1 deletion plugins/arSolrPlugin/lib/query/arSolrExistsQuery.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,63 @@

class arSolrExistsQuery extends arSolrAbstractQuery
{
// TODO
/**
* Query Params.
*
* @var mixed
*/
protected $query;

/**
* Field to be queried.
*
* @var string
*/
protected $field;

/**
* Constructor.
*
* @param string $field
*/
public function __construct($field)
{
$this->setField($field);
$this->generateQueryParams();
}

public function setField($field)
{
$this->field = $field;
}

public function getField()
{
return $this->field;
}

public function getQueryParams()
{
$this->generateQueryParams();

return $this->query;
}

public function generateQueryParams()
{
$this->query = [
'query' => [
'lucene' => [
'query' => "{$this->field}:*",
],
],
'offset' => $this->offset,
'limit' => $this->size,
];
}

public function setType($type)
{
$this->setField("{$type}.{$this->field}");
}
}

0 comments on commit bbafb78

Please sign in to comment.