Skip to content

Firefly III: a personal finances manager

Fix search query. #2713

James Cole460906fdfebe
diff --git a/app/Support/Search/Search.php b/app/Support/Search/Search.php
index 8455c720e0..08018b28f8 100644
--- a/app/Support/Search/Search.php
+++ b/app/Support/Search/Search.php
@@ -123,10 +123,13 @@ class Search implements SearchInterface
{
$filteredQuery = app('steam')->cleanString($query);
$this->originalQuery = $filteredQuery;
- $pattern = '/[[:alpha:]_]*:"?[\p{L}_-]*"?/ui';
+ $pattern = '/[[:alpha:]_]*:"?[\P{C}_-]*"?/ui';
$matches = [];
preg_match_all($pattern, $filteredQuery, $matches);
+ var_dump($matches[0]);
+ exit;
+
foreach ($matches[0] as $match) {
$this->extractModifier($match);
$filteredQuery = str_replace($match, '', $filteredQuery);
@@ -288,12 +291,12 @@ class Search implements SearchInterface
$after = new Carbon($modifier['value']);
$collector->setAfter($after);
break;
- case 'created_at':
+ case 'created_on':
Log::debug(sprintf('Set "%s" using collector with value "%s"', $modifier['type'], $modifier['value']));
$createdAt = new Carbon($modifier['value']);
$collector->setCreatedAt($createdAt);
break;
- case 'updated_at':
+ case 'updated_on':
Log::debug(sprintf('Set "%s" using collector with value "%s"', $modifier['type'], $modifier['value']));
$updatedAt = new Carbon($modifier['value']);
$collector->setUpdatedAt($updatedAt);
diff --git a/config/firefly.php b/config/firefly.php
index 3c871e4f60..64e1b1474b 100644
--- a/config/firefly.php
+++ b/config/firefly.php
@@ -518,8 +518,8 @@ return [
'default_currency' => 'EUR',
'default_language' => 'en_US',
'search_modifiers' => ['amount_is', 'amount', 'amount_max', 'amount_min', 'amount_less', 'amount_more', 'source', 'destination', 'category',
- 'budget', 'bill', 'type', 'date', 'date_before', 'date_after', 'on', 'before', 'after', 'from', 'to', 'tag', 'created_at',
- 'updated_at'],
+ 'budget', 'bill', 'type', 'date', 'date_before', 'date_after', 'on', 'before', 'after', 'from', 'to', 'tag', 'created_on',
+ 'updated_on'],
// TODO notes has_attachments
'cer_providers' => [
diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php
index 2e978b1277..fe2c84dfc7 100644
--- a/resources/lang/en_US/firefly.php
+++ b/resources/lang/en_US/firefly.php
@@ -255,8 +255,8 @@ return [
'search_modifier_on' => 'Transaction date is :value',
'search_modifier_before' => 'Transaction date is before :value',
'search_modifier_after' => 'Transaction date is after :value',
- 'search_modifier_created_at' => 'Transaction was created on :value',
- 'search_modifier_updated_at' => 'Transaction was last updated on :value',
+ 'search_modifier_created_on' => 'Transaction was created on :value',
+ 'search_modifier_updated_on' => 'Transaction was last updated on :value',
'modifiers_applies_are' => 'The following modifiers are applied to the search as well:',
'general_search_error' => 'An error occurred while searching. Please check the log files for more information.',
'search_box' => 'Search',