Feature #4138

Add spent time comments in search

Added by Spyros Oikonomopoulos almost 12 years ago. Updated about 1 month ago.

Status:Needs feedbackStart date:2009-10-29
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Search engine
Target version:Candidate for next major release
Resolution:

Description

Hello,

we are using the "log time" function extensively for reporting activities related to long running issues. However "spent time" comments are not included in searches. Can they be added?

Thanks in advance

Related issues: #3082 #3936

rm4138-make_time_entries_searchable-trunk_12160.diff Magnifier (1.42 KB) Mischa The Evil, 2013-09-24 22:55

rm4138-make_time_entries_and_their_custom_fields_searchable-trunk_r12406.diff Magnifier (7.26 KB) Mischa The Evil, 2013-12-16 11:48

0001-Make-time-entries-searchable-by-their-comments-hours.patch Magnifier - Patch against trunk @ r21200. (5.89 KB) Mischa The Evil, 2021-08-26 10:32

0002-Make-time-entries-searchable-by-their-custom-field-v.patch Magnifier - Patch against trunk @ r21200. (3.17 KB) Mischa The Evil, 2021-08-26 10:33


Related issues

Related to Redmine - Feature #992: Option to search open issues only Closed 2008-04-04
Related to Redmine - Feature #3082: Repository Search New 2009-03-31
Duplicated by Redmine - Feature #9063: Searchable comments from "Log time" Closed 2011-08-16
Duplicated by Redmine - Feature #13693: Possibility to search in time log comments Closed

History

#1 Updated by Jean-Philippe Lang almost 12 years ago

  • Category set to Search engine

#2 Updated by snow windwaves over 10 years ago

+1. I log all my time for invoicing and have lots comments to back up my bills. it would be great to be able to search them

#3 Updated by Jamie Gruener over 10 years ago

+1

We use Redmine time entry comments for invoices, too, and being able to search comments would be a real help.

#4 Updated by Alexander Bagiev over 8 years ago

+1
Since spent hours are associated with comments, we fill this field instead of notes, but cannot search.

#5 Updated by Mischa The Evil about 8 years ago

  • Duplicated by Feature #9063: Searchable comments from "Log time" added

#6 Updated by Mischa The Evil about 8 years ago

I have created a rough patch, against Redmine trunk at r12160, that should provide this feature.

Known issues:
  • shown search results display created_on date of time entry comments instead of date from :date
  • time entry comments should be ordered by :date instead of :created_on (but can not because it is a date column)
  • no tests added yet

#7 Updated by Karl Fenech about 8 years ago

Hi,
im new to this, can anyone let me know how patch can be installed?

Thanks in advance

#8 Updated by Karl Fenech about 8 years ago

Managed to run the patch but am getting the following:

bitnami@linux:/opt/bitnami/apps/redmine$ patch p0 < rm4138.diff
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
-------------------------
|Index: lib/redmine.rb |=================================================================== |--- lib/redmine.rb (revision 12160) |+++ lib/redmine.rb (working copy)
--------------------------
File to patch:

Am i running the patch in the correct folder? How should i proceed?

#9 Updated by Mischa The Evil about 8 years ago

Karl Fenech wrote:

bitnami@linux:/opt/bitnami/apps/redmine$ patch p0 < rm4138.diff
...
Am i running the patch in the correct folder? How should i proceed?

No, that is not the correct directory. It should be the top directory where Redmine source files are stored (a.k.a. the RAILS_ROOT or REDMINE_ROOT). It is {BITNAMI_DIR}/apps/redmine/htdocs for BitNami Redmine deployments1.

1 according to http://bitnami.com/stack/redmine/README.txt

#10 Updated by Karl Fenech about 8 years ago

Thanks, update worked.
I can now search for comments from the overall time spent under a project and is working fine. only thing that did not work is that comments cannot be searched using the search button top right, is this expected?

#11 Updated by Toshi MARUYAMA about 8 years ago

  • Related to Feature #992: Option to search open issues only added

#12 Updated by Toshi MARUYAMA about 8 years ago

#13 Updated by Mischa The Evil about 8 years ago

  • Assignee set to Mischa The Evil
  • Target version set to Unplanned backlogs

I'll schedule some time to work on this issue to come up with a usable and tested (!) patch.

Karl Fenech wrote:

Thanks, update worked.
I can now search for comments from the overall time spent under a project and is working fine. only thing that did not work is that comments cannot be searched using the search button top right, is this expected?

No, it is not. I think the behavior you are experiencing is caused by other search variables. Though, I haven't tested the patch I posted well enough yet to be certain of that. To be continued...

Mischa The Evil wrote:

  • shown search results display created_on date of time entry comments instead of date from :date
  • time entry comments should be ordered by :date instead of :created_on (but can not because it is a date column)

A second look at the core code has left me in doubt if these two issues really are issues because the same created_on is already used/displayed in the activity view (r2877). Any suggestions on this are welcome...

#14 Updated by Mischa The Evil almost 8 years ago

  • Duplicated by Feature #13693: Possibility to search in time log comments added

#15 Updated by Mischa The Evil almost 8 years ago

I continued working on this issue and have come up with a new, extended and thoroughly tested patch against Redmine trunk at r12406. It turns out that the patch I posted earlier in note-6 was already fully functional and bug-free. The changes between that patch and the new patch I'll upload here are:
  1. added three tests to search_controller_test1 (including pulling-in the required time_entries fixtures) and one to timelog_controller_test2 to make sure the new TimeEntry comments searching functionality works correctly in all the cases
  2. fixed two assertions in SearchControllerTest#test_search_all_projects that broke due to the fact that issue 2 has now been pushed to the second page of the search results
  3. added additional functionality to also search TimeEntry custom field values (this seems a logic next step now that TimeEntry comments can be searched)
  4. added yet another test (with accompanying custom field and custom value fixtures) to search_controller_test3 to make sure that TimeEntry custom field value searching is working correctly

I tried to separate the patch into two dedicated patches, but this wasn't possible because of the test changes that are in the same file.

Please let me know if something else is needed to get these features integrated. Regarding the "issues" with the dates that are used to sort and display the search results that I mentioned earlier in note-6 and note-13: I stick to my previous conclusion that it is not a real issue. Though, it might be something that could be improved in the future (maybe we can change the event title to also include the date of the time entry?), but I don't think that something like that should block the possible integration of these features.

Disclaimer: the patch currently breaks an existing unit test (ProjectTest#test_destroying_root_projects_should_clear_data), but this is caused by a defect in the Redmine core instead of a bug in the functionality provided by the patch. See #15709.

1 SearchControllerTest#test_search_time_entries_on_project, SearchControllerTest#test_search_time_entries_on_project_with_subprojects_scope and SearchControllerTest#test_search_time_entries_on_all_projects.

2 TimelogControllerTest#test_default_search_scope

3 SearchControllerTest#test_search_time_entries_with_searchable_custom_fields

#16 Updated by Marius BALTEANU over 3 years ago

+1

Having the possibility to search in spent time comments will be very useful.
@Mischa, do you have the time to update your patch in order to apply cleanly on the current trunk? If not, I can take a look in the next period.

#17 Updated by Mischa The Evil over 3 years ago

Marius BALTEANU wrote:

@Mischa, do you have the time to update your patch in order to apply cleanly on the current trunk? If not, I can take a look in the next period.

I'll see what I can do. Though, feel free to 'take over'. It doesn't seem too much of a work. It is mostly the tests that needs some rewrites (remove the use of assigns and, whenever possible, the fixture additions).

#18 Updated by Mischa The Evil 2 months ago

Here's an updated patchset against source:/trunk@21200 as a continuation of the patches provided in note#6 and note#15.

Changes compared to the patch provided in note#15:
  • Patch: split-up the patch into atomic commits.
  • Feature: added additional support for searching time entries by their 'hours' and 'spent_on' attributes (along with their 'comments' attribute and their custom field values).
  • Implementation: added association preloading.
  • Implementation: rewritten test coverage using assert_select and added new tests for the added features.
Some notes about the patch transported from note#15:
  • It was needed to fix some assertions in SearchControllerTest#test_search_all_projects that broke due to the fact that issue 'Feature #2' has now been pushed to the second page of the search results.
  • The date that is used to sort and display the search results is the 'created_on' date and not the 'date' date.
  • It adds new custom_fields and custom_values test fixtures for a searchable time entry custom field.

Please review, especially the code implementing the querying of the DB, thoroughly.

#19 Updated by Mischa The Evil about 1 month ago

  • Status changed from New to Needs feedback

#20 Updated by Marius BALTEANU about 1 month ago

  • Target version changed from Candidate for next minor release to Candidate for next major release

Thanks Misha for working on this.

Mischa The Evil wrote:

  • Feature: added additional support for searching time entries by their 'hours' and 'spent_on' attributes (along with their 'comments' attribute and their custom field values).

Searching in 'comments' and 'custom field value' is useful, for sure, but I'm not sure what to say about 'hours' and 'spent_on' because I don't see a real use case. 'spent_on' could be quite confusing because it accepts only the database format (yyyy-mm-dd) and some users are used to use the localization format (for ex: dd-mm-yyyy). I'm in favour of extracting the 'hours' and 'spent_on' to another ticket to get more feedback.

Also, I think it's important to check the impact on the application performance because on some instances, the time entries table can be bigger than the issue table (an issue tends to have more time entries).

Also available in: Atom PDF