Expand search and add operators.

This commit is contained in:
James Cole
2022-09-28 07:35:57 +02:00
parent 6eaed9829b
commit 9b7285ea84
7 changed files with 865 additions and 118 deletions

View File

@@ -135,6 +135,18 @@ trait MetaCollection
return $this;
}
/**
* @inheritDoc
*/
public function externalIdDoesNotContain(string $externalId): GroupCollectorInterface
{
$this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'external_id');
$this->query->where('journal_meta.data', 'NOT LIKE', sprintf('%%%s%%', $externalId));
return $this;
}
/**
* Join table to get tag information.
*/
@@ -160,6 +172,18 @@ trait MetaCollection
return $this;
}
/**
* @inheritDoc
*/
public function externalIdDoesNotEnd(string $externalId): GroupCollectorInterface
{
$this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'external_id');
$this->query->where('journal_meta.data', 'NOT LIKE', sprintf('%%%s"', $externalId));
return $this;
}
/**
* @inheritDoc
*/
@@ -172,6 +196,18 @@ trait MetaCollection
return $this;
}
/**
* @inheritDoc
*/
public function externalIdDoesNotStart(string $externalId): GroupCollectorInterface
{
$this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'external_id');
$this->query->where('journal_meta.data', 'LIKE', sprintf('"%s%%', $externalId));
return $this;
}
/**
* @param string $url
* @return GroupCollectorInterface
@@ -187,6 +223,23 @@ trait MetaCollection
return $this;
}
/**
* @param string $url
* @return GroupCollectorInterface
*/
public function externalUrlDoesNotContain(string $url): GroupCollectorInterface
{
$this->joinMetaDataTables();
$url = json_encode($url);
$url = str_replace('\\', '\\\\', trim($url, '"'));
$this->query->where('journal_meta.name', '=', 'external_url');
$this->query->where('journal_meta.data', 'NOT LIKE', sprintf('%%%s%%', $url));
return $this;
}
/**
* @param string $url
* @return GroupCollectorInterface
@@ -202,6 +255,23 @@ trait MetaCollection
return $this;
}
/**
* @param string $url
* @return GroupCollectorInterface
*/
public function externalUrlDoesNotEnd(string $url): GroupCollectorInterface
{
$this->joinMetaDataTables();
$url = json_encode($url);
$url = str_replace('\\', '\\\\', ltrim($url, '"'));
$this->query->where('journal_meta.name', '=', 'external_url');
$this->query->where('journal_meta.data', 'NOT LIKE', sprintf('%%%s', $url));
return $this;
}
/**
* @param string $url
* @return GroupCollectorInterface
@@ -219,6 +289,23 @@ trait MetaCollection
return $this;
}
/**
* @param string $url
* @return GroupCollectorInterface
*/
public function externalUrlDoesNotStart(string $url): GroupCollectorInterface
{
$this->joinMetaDataTables();
$url = json_encode($url);
$url = str_replace('\\', '\\\\', rtrim($url, '"'));
//var_dump($url);
$this->query->where('journal_meta.name', '=', 'external_url');
$this->query->where('journal_meta.data', 'NOT LIKE', sprintf('%s%%', $url));
return $this;
}
/**
* Where has no tags.
*
@@ -275,6 +362,18 @@ trait MetaCollection
return $this;
}
/**
* @inheritDoc
*/
public function internalReferenceDoesNotContain(string $externalId): GroupCollectorInterface
{
$this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'internal_reference');
$this->query->where('journal_meta.data', 'NOT LIKE', sprintf('%%%s%%', $externalId));
return $this;
}
/**
* @inheritDoc
*/
@@ -287,6 +386,18 @@ trait MetaCollection
return $this;
}
/**
* @inheritDoc
*/
public function internalReferenceDoesNotEnd(string $externalId): GroupCollectorInterface
{
$this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'internal_reference');
$this->query->where('journal_meta.data', 'NOT LIKE', sprintf('%%%s"', $externalId));
return $this;
}
/**
* @inheritDoc
*/
@@ -299,6 +410,18 @@ trait MetaCollection
return $this;
}
/**
* @inheritDoc
*/
public function internalReferenceDoesNotStart(string $externalId): GroupCollectorInterface
{
$this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'internal_reference');
$this->query->where('journal_meta.data', 'LIKE', sprintf('"%s%%', $externalId));
return $this;
}
/**
* @param string $value
*
@@ -605,6 +728,19 @@ trait MetaCollection
return $this;
}
/**
* @inheritDoc
*/
public function excludeExternalId(string $externalId): GroupCollectorInterface
{
$this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'external_id');
$this->query->where('journal_meta.data', '!=', sprintf('%s', json_encode($externalId)));
return $this;
}
/**
* @inheritDoc
*/
@@ -617,6 +753,18 @@ trait MetaCollection
return $this;
}
/**
* @inheritDoc
*/
public function excludeExternalUrl(string $url): GroupCollectorInterface
{
$this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'external_url');
$this->query->where('journal_meta.data', '!=', json_encode($url));
return $this;
}
/**
* @inheritDoc
*/
@@ -630,6 +778,19 @@ trait MetaCollection
return $this;
}
/**
* @inheritDoc
*/
public function excludeInternalReference(string $internalReference): GroupCollectorInterface
{
$this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'internal_reference');
$this->query->where('journal_meta.data', 'NOT LIKE', sprintf('%%%s%%', $internalReference));
return $this;
}
/**
* @inheritDoc
*/
@@ -642,6 +803,18 @@ trait MetaCollection
return $this;
}
/**
* @inheritDoc
*/
public function excludeRecurrenceId(string $recurringId): GroupCollectorInterface
{
$this->joinMetaDataTables();
$this->query->where('journal_meta.name', '=', 'recurrence_id');
$this->query->where('journal_meta.data', '!=', sprintf('%s', json_encode($recurringId)));
return $this;
}
/**
* Limit results to a specific tag.
*