プロジェクト

全般

プロフィール

Vote #81603

完了

Multiple search terms in the "contains" operator of text filters

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Filters_59
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
59
version_id:
155
issue_org_id:
35764
author_id:
332
assigned_to_id:
107353
comments:
6
status_id:
5
tracker_id:
2
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

I extracted the attached patch from #35073#note-4. The patch posted by "Jens Krämer":https://www.redmine.org/users/40856 from Planio allows you to use multiple search terms in "contains" operator of text filters.

The alternative I am experimenting with right now is breaking up the user's query string into tokens like the global search does, and use these to build a query with multiple LIKE clauses that are combined with AND. I'm attaching a preliminary patch that implements this for the Issue.like scope (used by the autocompleter) and the Query#sql_contains method (which should cover all query filters). Do you think that's a viable approach?

It seems that the patch has already been deployed to the production environment of Planio. See "Planio filters just got more powerful - Planio Support (english) - Planio Support":https://support.plan.io/news/200


journals

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Patch committed with tests, thanks for this nice improvement.

The patch introduces the following offense:

<pre>
Lint/IneffectiveAccessModifier: private (on line 1074) does not make singleton methods private. Use private_class_method or private inside a class << self block instead.
def self.tokenized_like_conditions(db_field, value, **options)
</pre>
--------------------------------------------------------------------------------
I've disabled for now the rubocop offense for Lint/IneffectiveAccessModifier. Jens, the method @self.tokenized_like_conditions@ should not be public instead of private?

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------


related_issues

blocks,Closed,35073,Escape values in LIKE statements to prevent injection of placeholders (_ or %)

Admin Redmine さんが3年以上前に更新

  • カテゴリFilters_59 にセット
  • 対象バージョン5.0.0_155 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0