Merge pull request #9598 from Sobuno/NewQueryParserV3

New Query Parser for Search Engine and Rules
This commit is contained in:
James Cole
2025-01-05 07:32:55 +01:00
committed by GitHub
21 changed files with 843 additions and 126 deletions

View File

@@ -329,7 +329,9 @@ return [
'search_query' => 'Query',
'search_found_transactions' => 'Firefly III found :count transaction in :time seconds.|Firefly III found :count transactions in :time seconds.',
'search_found_more_transactions' => 'Firefly III found more than :count transactions in :time seconds.',
'search_for_query' => 'Firefly III is searching for transactions with all of these words in them: <span class="text-info">:query</span>',
'search_for_overview' => 'Firefly III is searching for transactions that fulfill <b>all</b> of the following conditions:',
'search_for_query' => 'All of these words must be present: <span class="text-info">:query</span>',
'search_for_excluded_words' => 'None of these words may be present: <span class="text-info">:excluded_words</span>',
'invalid_operators_list' => 'These search parameters are not valid and have been ignored.',
// old
@@ -729,7 +731,6 @@ return [
// Ignore this comment
// END
'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',
'search_box_intro' => 'Welcome to the search function of Firefly III. Enter your search query in the box. Make sure you check out the help file because the search is pretty advanced.',

View File

@@ -38,11 +38,38 @@
<input type="hidden" name="rule" value="{{ ruleId }}"/>
{% endif %}
</form>
{% if '' != query %}
<p>
{{ trans('firefly.search_for_query', {query: query|escape})|raw }}
</p>
<p>
{{ trans('firefly.search_for_overview') |raw }}
</p>
<ul>
{% if words|length > 0 %}
<li>
{{- trans('firefly.search_for_query', {
query: words
|map(word => '<span class="search-word">' ~ word|escape ~ '</span>')
|join(' ')
})|raw -}}
</li>
{% endif %}
{% if excludedWords|length > 0 %}
<li>
{{- trans('firefly.search_for_excluded_words', {
excluded_words: excludedWords
|map(word => '<span class="search-word">' ~ word|escape ~ '</span>')
|join(' ')
})|raw -}}
</li>
{% endif %}
{% for operator in operators %}
{% if operator.prohibited %}
<li>{{- trans('firefly.search_modifier_not_'~operator.type, {value: operator.value}) -}}</li>
{% endif %}
{% if not operator.prohibited %}
<li>{{- trans('firefly.search_modifier_'~operator.type, {value: operator.value}) -}}</li>
{% endif %}
{% endfor %}
</ul>
{% if invalidOperators|length > 0 %}
<p>{{ trans('firefly.invalid_operators_list') }}</p>
@@ -52,25 +79,11 @@
{% endfor %}
</ul>
{% endif %}
{% if operators|length > 0 %}
<p>{{ trans('firefly.modifiers_applies_are') }}</p>
<ul>
{% for operator in operators %}
{% if operator.prohibited %}
<li>{{ trans('firefly.search_modifier_not_'~operator.type, {value: operator.value}) }}</li>
{% endif %}
{% if not operator.prohibited %}
<li>{{ trans('firefly.search_modifier_'~operator.type, {value: operator.value}) }}</li>
{% endif %}
{% endfor %}
</ul>
{% endif %}
</div>
</div>
</div>
</div>
{% if query or operators|length > 0 %}
{% if query|length > 0 or excludedWords|length > 0 or operators|length > 0 %}
<div class="row result_row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="box search_box">
@@ -125,7 +138,7 @@
</div>
</div>
{% endif %}
{% if query == "" and operators|length == 0 %}
{% if query|length == 0 and excludedWords|length == 0 and operators|length == 0 %}
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12">
<div class="box">