MantisBT

View Issue Details Jump to Notes ] Wiki ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007183mantisbtfilterspublic2006-06-08 04:382012-11-02 10:20
Reportermbernigaud 
Assigned Todaryn 
PrioritynormalSeverityfeatureReproducibilityN/A
StatusacknowledgedResolutionopen 
PlatformOSOS Version
Product Version1.0.3 
Target VersionFixed in Version 
Summary0007183: new search function on field and custom field
DescriptionI made a new search function. It enables the users to choose on which field they want to search.
Users can choose a field : any/id/summary/ ...and then /customField1/customField2/...

The search is more accurate with this function.
Additional InformationI'd like some people try it and check/improve it and tell me whether they like it or not.
TagsNo tags attached.
Attached Fileszip file icon replace files.zip [^] (26,674 bytes) 2006-06-08 04:38
zip file icon advanced_search_function_v1.0.zip [^] (26,665 bytes) 2006-08-04 04:20
jpg file icon advanced_search_function_v1.0.jpg [^] (79,301 bytes) 2006-08-04 04:32


patch file icon mantis-1.2.3-patch-filter-including-custom-fields.patch [^] (796 bytes) 2010-11-26 05:02 [Show Content]
patch file icon mantis-1.2.4-search_on_custom_fields_too.patch [^] (1,508 bytes) 2011-02-11 09:02 [Show Content]

- Relationships
has duplicate 0012643closedatrol How to add custom fileds in search? 
related to 0009868closedrombert Added ability to search custom fields in version 1.1.4 
related to 0006325assignedgrangeway Added DATETIME data type, added Simple Text Search on custom fields 

-  Notes
User avatar (0013191)
mbernigaud (reporter)
2006-08-04 04:20
edited on: 2006-08-04 04:33

The search function is now tested, few bugs have been found and fixed
=>v1.0

User avatar (0013192)
mbernigaud (reporter)
2006-08-04 04:33

The pictured I uploaded shows the search function and how it works
User avatar (0013300)
atomoid (reporter)
2006-08-18 21:52
edited on: 2006-08-19 18:47

Thanks for posting this. Its quite helpful..
Its working great so far on Mantis 1.0.1, i'll drop you a note if i find any problems.
Now, if i could only find a hack for using multiple keywords (AND/OR) in the search field...

I noticed that your screenshot above says "Mantis 1.0.5" and the bug is written against 1.0.3, and when i merged the code, i noticed that it looks like it probably is the result of a merged into a 1.0.3 base, since the filter_api.php file this filter feature is merged into is not the 1.0.5 version, but is an older version (probably 1.0.3):
1.122.2.2.2.3.2.5.2.3 2006/01/29)

as a result, its missing a few tweaks that appear in the 1.0.5 version:
1.222.2.2.2.3.2.5.2.3.2.1 2006/05/06)

Not that it matters in my particular case since im using 1.0.1 as the base to merge into, and i noticed and figured out the disparity right away anyway while merging, since i checked against 1.0.5 code as well, since im also in the process right now of merging in 1.0.5, but nonetheless, heres a caveat to other testers to be careful in merging, as i havent tried it with 1.0.5 yet.

User avatar (0013301)
atomoid (reporter)
2006-08-19 19:23

Here's a possible problem (or feature request):

When the 'Project' setting is "All Projects", then the search filter "Field" listing only inherits ID/Summary/Description, ignoring all custom fields.

This is the oppsite of the general Mantis behavior where all custom fields are listed in the filter settings table in "All Projects" and are reduced only when you select a project that dosnt include the particular custom fields.
User avatar (0013302)
atomoid (reporter)
2006-08-19 19:43

On another note, after entering a two word search term "preview dimensions" i encountered an "APPLICATION ERROR 0000401". (Mac Firefox)
Since the search string is stored in a cookie and autoloaded upon calling up the "view_all_bug_page.php" page, i had to delete my Mantis cookies to recover from the error.

I tried it again and didnt have any problems on Win or Mac clients, this problem has never occurred before and might have been random and not related to your code. but if it occurs again i'll see if i can get a reproducible case for you.
User avatar (0013305)
atomoid (reporter)
2006-08-20 19:47
edited on: 2006-08-20 21:04

A bug (maybe not yours):

The filter code prevents the Advanced filter list from showing the actual multiple filter selctions but only in this case: when selecting a stored filter that was created with an earlier version of Mantis (probably pre-Mantis 1.0.1). The result is that instead of showing all the multiple selctions in all the filter boxes, it only shows the filter table is in its unpopulated default state.

For some reason, this only occurs for older pre-existing filters, because if i make a new filter regardless of whether your filter code is merged or not, it all works fine with your code both merged and unmerged.

If i revert to the old code, then my old filters work just fine and dont have this problem.

So the problem is, on some level, related to your code but is also dependent upon the filters having been created by an older Mantis version so it could be faulty Mantis filters and your code is immaculate (or maybe it is also dependent upon updating to newer PHP/SQL versions) its a mystery but there it is, easy repeatable case.

The filter still calls up the right bugs, it just doesnt display the filter settings.

The (currently non-)workaround:
1) Un-merge the filter code (or just use your previous php bakup files)
2) Re-create all the filters from scratch by doing the following (you cannot merely open the filter, then save or re-select the fields then reapply the filter and save it, somehow this doesnt work, i cant figure why it shouldn't, but it doesnt)
- Each file of the filter has to be different by some measure, select an additional value, anything that will make the filter different that it was before (this is how it works, believe it or not, i even tried using the filter on another computer to get rid of any browser query caching issues and it still occurs). I also tried deleting the filter that has the same query and then making a new one from scratch, but that still doesnt work and the fields dont populate, ...which basically means you cant recreate your filters from scratch.

User avatar (0013306)
atomoid (reporter)
2006-08-20 21:08

This search function code breaks the "Resolution" field in the filter grid so you cant filter by it.. The "Resolution" field is not listed, it merely is blank, with the value "any" listed under it.
User avatar (0013309)
Sire (reporter)
2006-08-21 02:49

Also see 0003858.
User avatar (0014939)
grangeway (developer)
2007-07-11 18:55

mbernigaud,

Can you upload a current/old patch/zip again of your work so we can see it?

Paul
User avatar (0015579)
xphilippe (reporter)
2007-09-06 05:56

Same remarque that grangeway, why the patch has been deleted? I'm interesting in this functionnality.
Does somebody know how to combinate multiple key words? For instance, I search the bug containing "search" and "button" but not "filter"
==> Search +button -filter <== ... it doesn't work
thanks
xavier
User avatar (0015802)
TerryRankine (reporter)
2007-10-03 21:19

Was this ever released into the trunk?
User avatar (0024162)
Marnix (reporter)
2010-01-15 09:54

Anyone who knows how to make this work in version 1.1.8?

Thx.
User avatar (0024164)
Marnix (reporter)
2010-01-15 12:06

Found an easy solution so that custom fields are included in the search.
Find similar text in file filter_api.php and replace with underneath.
Notice: Search result will take a bit longer!

# Simple Text Search - Thanks to Alan Knowles
        if ( !is_blank( $t_filter['search'] ) ) {
            $c_search = db_prepare_string( $t_filter['search'] );
            $c_search_int = db_prepare_int( $t_filter['search'] );
            $custom_query = " $t_bug_table.id IN ( SELECT DISTINCT bug_id from mantis_custom_field_string_table where value LIKE '%$c_search%')";
            $t_textsearch_where_clause = '(' . db_helper_like( 'summary', "%$c_search%" ) .
                             ' OR ' . db_helper_like( "$t_bug_text_table.description", "%$c_search%" ) .
                             ' OR ' . db_helper_like( "$t_bug_text_table.steps_to_reproduce", "%$c_search%" ) .
                             ' OR ' . db_helper_like( "$t_bug_text_table.additional_information", "%$c_search%" ) .
                             " OR ( $t_bug_table.id = '$c_search_int' ) OR ( $custom_query ) )";

            $t_textsearch_wherejoin_clause = '(' . db_helper_like( 'summary', "%$c_search%" ) .
                             ' OR ' . db_helper_like( "$t_bug_text_table.description", "%$c_search%" ) .
                             ' OR ' . db_helper_like( "$t_bug_text_table.steps_to_reproduce", "%$c_search%" ) .
                             ' OR ' . db_helper_like( "$t_bug_text_table.additional_information", "%$c_search%" ) .
                             ' OR ' . db_helper_like( "$t_bug_table.id", "%$c_search%" ) .
                             ' OR ' . db_helper_like( "$t_bugnote_text_table.note", "%$c_search%" ) .
                             " OR ( $custom_query ) )";
User avatar (0024253)
mravcek (reporter)
2010-01-26 05:53

Thank you very much Marnix. That is exactly what I was looking for. Now I can use search :)
User avatar (0024593)
aleman (reporter)
2010-03-02 09:50

@Marnix: Did you change the original filter_api.php or that one from the new search function in this id?

Because i made an Diff of the files and since 2006 the filter_api.php is lot more complex than the changed version of the enhanced search. But when i add your code to the version of 1.1.7 it is not working.
User avatar (0027493)
jmonin (reporter)
2010-11-26 05:01

You'll find attached a patch for Marnix's evolution against Mantis 1.2.3.
User avatar (0027802)
jamesbond2011 (reporter)
2011-01-05 01:29

Hi jmonin,

I tried your patch "mantis-1.2.3-patch-filter-including-custom-fields.patch"
on MantisBT 1.2.4
But it wont worked for me.

If you have any patch/file/info to enable searching on custom fields for MantisBT 1.2.4 then please provide me..


Thanks in advance
User avatar (0027804)
jmonin (reporter)
2011-01-05 02:54

Hi jamesbond2011, that patch works fine on a clean mantis 1.2.4 on my side...
Did you set your directoy to the root mantis directory, and apply "patch -p1 < <patch file>" ?
User avatar (0027808)
jamesbond2011 (reporter)
2011-01-05 07:23
edited on: 2011-01-05 07:39

Hi jmonin,

I reconfigured my MantisBT & applied your patch
It worked for me

Thanks a lot

User avatar (0028205)
moudsen (reporter)
2011-02-11 09:02

Hi, I can confirm the 1.2.3 patch provided does not function against an in use 1.2.4 installation.

I've attached a new patch file that can be applied to 1.2.4 with "patch <patch file>" at the root of the mantis directory.

I just curious if this patch can be applied permanently in the next release?
User avatar (0028206)
moudsen (reporter)
2011-02-11 09:06

I am still interested in the proposed functionality of adding the ability to choose a field to search on. Any chance that becomes available in a near future edition, be it enabled/disabled through a config var?
User avatar (0030726)
slopin (reporter)
2011-12-29 06:18

Hi,

New to Mantisbt, it's exactly what I need. filter_api.php between 1.2.4 and 1.2.8 looks quite different and actually I don't manage to make work the existing patch (1.2.4) (i'm not a PHP killer!).

Is there an existing or planned patch for 1.2.8 version, it would be wonderful!

Thank you in advance.
User avatar (0033387)
s.panico (reporter)
2012-10-31 09:25
edited on: 2012-10-31 09:26

Hi,
anyone know if there is a plugin to add this feature on Mantis 1.2.11?

Or someone could share the filter_api.php and view_all_set.php for the latest version of mantisbt?

I've tried to compare the attached files (in advanced_search_function_v1.0.zip) with the same in the my Mantis installation (1.2.11) but they are compeltely different and is quite difficult to me to understand the changes in the mbernigaud files to apply them in my files.... :(

Thanks a lot

User avatar (0033413)
s.panico (reporter)
2012-11-02 10:20

Hi all,
just to know that the moudsen patch for Mantis 1.2.4 (see attached file) can be applied to version 1.2.11 doing the following:

  In the file core/filter_api.php search for:

    $t_textsearch_where_clause .= '( ' . db_helper_like( 'summary' ) .
      ' OR ' . db_helper_like( "$t_bug_text_table.description" ) .
      ' OR ' . db_helper_like( "$t_bug_text_table.steps_to_reproduce" ) .
      ' OR ' . db_helper_like( "$t_bug_text_table.additional_information" ) .
      ' OR ' . db_helper_like( "$t_bugnote_text_table.note" );

  and change it with:

    $t_textsearch_where_clause .= '( ' . db_helper_like( 'summary' ) .
      ' OR ' . db_helper_like( "$t_bug_text_table.description" ) .
      ' OR ' . db_helper_like( "$t_bug_text_table.steps_to_reproduce" ) .
      ' OR ' . db_helper_like( "$t_bug_text_table.additional_information" ) .
      ' OR ' . db_helper_like( "$t_bugnote_text_table.note" )
      .' OR ' . "($t_bug_table.id IN ( SELECT DISTINCT bug_id from " . db_get_table( 'mantis_custom_field_string_table' ) . " where value LIKE '%$c_search%'))";

HTH

- Issue History
Date Modified Username Field Change
2006-06-08 04:38 mbernigaud New Issue
2006-06-08 04:38 mbernigaud File Added: replace files.zip
2006-06-08 04:42 mbernigaud Sponsorship Added mbernigaud: US$ 10
2006-06-08 04:42 mbernigaud Sponsorship Total 0 => 10
2006-06-08 04:42 mbernigaud Sponsorship Deleted mbernigaud: US$ 10
2006-06-08 04:42 mbernigaud Sponsorship Total 10 => 0
2006-08-04 04:20 mbernigaud Note Added: 0013191
2006-08-04 04:20 mbernigaud File Added: advanced_search_function_v1.0.zip
2006-08-04 04:32 mbernigaud File Added: advanced_search_function_v1.0.jpg
2006-08-04 04:33 mbernigaud Note Added: 0013192
2006-08-04 04:33 mbernigaud Note Edited: 0013191
2006-08-18 21:52 atomoid Note Added: 0013300
2006-08-19 17:47 atomoid Note Edited: 0013300
2006-08-19 17:56 atomoid Note Edited: 0013300
2006-08-19 17:56 atomoid Note Edited: 0013300
2006-08-19 18:00 atomoid Note Edited: 0013300
2006-08-19 18:01 atomoid Note Edited: 0013300
2006-08-19 18:47 atomoid Note Edited: 0013300
2006-08-19 19:23 atomoid Note Added: 0013301
2006-08-19 19:43 atomoid Note Added: 0013302
2006-08-20 19:47 atomoid Note Added: 0013305
2006-08-20 19:49 atomoid Note Edited: 0013305
2006-08-20 21:04 atomoid Note Edited: 0013305
2006-08-20 21:08 atomoid Note Added: 0013306
2006-08-21 02:49 Sire Note Added: 0013309
2007-07-11 18:55 grangeway Note Added: 0014939
2007-09-06 05:56 xphilippe Note Added: 0015579
2007-10-03 21:19 TerryRankine Note Added: 0015802
2008-05-30 11:21 daryn Category feature => filters
2008-08-05 21:04 daryn Assigned To => daryn
2008-08-05 21:04 daryn Status new => acknowledged
2010-01-15 09:54 Marnix Note Added: 0024162
2010-01-15 12:06 Marnix Note Added: 0024164
2010-01-26 05:53 mravcek Note Added: 0024253
2010-03-02 09:50 aleman Note Added: 0024593
2010-11-26 05:01 jmonin Note Added: 0027493
2010-11-26 05:02 jmonin File Added: mantis-1.2.3-patch-filter-including-custom-fields.patch
2011-01-01 08:54 atrol Relationship added has duplicate 0012643
2011-01-01 08:54 atrol Relationship added related to 0009868
2011-01-01 08:55 atrol Relationship added related to 0006325
2011-01-05 01:29 jamesbond2011 Note Added: 0027802
2011-01-05 02:54 jmonin Note Added: 0027804
2011-01-05 07:23 jamesbond2011 Note Added: 0027808
2011-01-05 07:24 jamesbond2011 Note Edited: 0027808 View Revisions
2011-01-05 07:39 jamesbond2011 Note Edited: 0027808 View Revisions
2011-02-11 09:02 moudsen Note Added: 0028205
2011-02-11 09:02 moudsen File Added: mantis-1.2.4-search_on_custom_fields_too.patch
2011-02-11 09:06 moudsen Note Added: 0028206
2011-12-14 04:02 rombert Severity minor => feature
2011-12-29 06:18 slopin Note Added: 0030726
2012-10-31 09:25 s.panico Note Added: 0033387
2012-10-31 09:26 s.panico Note Edited: 0033387 View Revisions
2012-11-02 10:20 s.panico Note Added: 0033413


MantisBT 1.2.16dev master-1.2.x-8c2bd07 [^]
Copyright © 2000 - 2013 MantisBT Team
Time: 0.1719 seconds.
memory usage: 3,039 KB
Powered by Mantis Bugtracker