abahgat/redmine_didyoumean

Does not always return expected results

codemonkee opened this issue · 5 comments

Expected a single result of "Task #926 – Install PHP_Invoke through PEAR (New in Kenny)", but does not always pickup on the ticket.

Using Redmine 1.3.2.stable
abahgat-redmine_didyoumean-291e6cd

Processing SearchIssuesController#index to json (for 10.10.xxx.xxx at 2012-03-23 09:49:51) [POST]
Parameters: {"format"=>"json", "project_id"=>"3", "action"=>"index", "controller"=>"search_issues", "query"=>"PHP"}
Got request for [PHP]
14 results found, returning the first 5
Completed in 69ms (View: 19, DB: 19) | 200 OK [http://kenny/redmine/searchissues?format=json]

Processing SearchIssuesController#index to json (for 10.10.xxx.xxx at 2012-03-23 09:50:02) [POST]
Parameters: {"format"=>"json", "project_id"=>"3", "action"=>"index", "controller"=>"search_issues", "query"=>"PHP_Invoke"}
Got request for [PHP_Invoke]
1 results found, returning the first 1
Completed in 234ms (View: 8, DB: 188) | 200 OK [http://kenny/redmine/searchissues?format=json]

Processing SearchIssuesController#index to json (for 10.10.xxx.xxx at 2012-03-23 09:50:12) [POST]
Parameters: {"format"=>"json", "project_id"=>"3", "action"=>"index", "controller"=>"search_issues", "query"=>"PHP_Invoke pear"}
Got request for [PHP_Invoke pear]
1 results found, returning the first 1
Completed in 47ms (View: 5, DB: 28) | 200 OK [http://kenny/redmine/searchissues?format=json]

Processing SearchIssuesController#index to json (for 10.10.xxx.xxx at 2012-03-23 09:50:25) [POST]
Parameters: {"format"=>"json", "project_id"=>"3", "action"=>"index", "controller"=>"search_issues", "query"=>"PHP_Invoke install with pear"}
Got request for [PHP_Invoke install with pear]
0 results found, returning the first 0
Completed in 3125ms (View: 1, DB: 3116) | 200 OK [http://kenny/redmine/searchissues?format=json]

Processing SearchIssuesController#index to json (for 10.10.xxx.xxx at 2012-03-23 09:50:45) [POST]
Parameters: {"format"=>"json", "project_id"=>"3", "action"=>"index", "controller"=>"search_issues", "query"=>"PHP Invoke"}
Got request for [PHP Invoke]
1 results found, returning the first 1
Completed in 1766ms (View: 5, DB: 1743) | 200 OK [http://kenny/redmine/searchissues?format=json]

Processing SettingsController#plugin (for 10.10.xxx.xxx at 2012-03-23 09:51:31) [POST]
Parameters: {"commit"=>"Apply", "action"=>"plugin", "authenticity_token"=>"AyjIW/qYhYRRlK3J/KQzXVu/Veow6CxwuAZeKmr8VLg=", "id"=>"redmine_didyoumean", "settings"=>{"project_filter"=>"1", "show_only_open"=>"1"}, "controller"=>"settings"}
Redirected to http://kenny/redmine/settings/plugin/redmine_didyoumean
Completed in 3107ms (DB: 3077) | 302 Found [http://kenny/redmine/settings/plugin/redmine_didyoumean]

Processing SettingsController#plugin (for 10.10.xxx.xxx at 2012-03-23 09:51:34) [GET]
Parameters: {"action"=>"plugin", "id"=>"redmine_didyoumean", "controller"=>"settings"}
Settings cache cleared.
Rendering template within layouts/admin
Rendering settings/plugin
Completed in 2811ms (View: 546, DB: 2191) | 200 OK [http://kenny/redmine/settings/plugin/redmine_didyoumean]

Processing SearchIssuesController#index to json (for 10.10.xxx.xxx at 2012-03-23 10:02:43) [POST]
Parameters: {"format"=>"json", "project_id"=>"3", "action"=>"index", "controller"=>"search_issues", "query"=>"PEAR"}
Settings cache cleared.
Got request for [PEAR]
Valid status ids are NewIn ProgressFeedbackWishlist
4 results found, returning the first 4
Completed in 3108ms (View: 17, DB: 3034) | 200 OK [http://kenny/redmine/searchissues?format=json]

Processing SearchIssuesController#index to json (for 10.10.xxx.xxx at 2012-03-23 10:02:56) [POST]
Parameters: {"format"=>"json", "project_id"=>"3", "action"=>"index", "controller"=>"search_issues", "query"=>"PEAR?"}
Got request for [PEAR?]
Valid status ids are NewIn ProgressFeedbackWishlist
0 results found, returning the first 0
Completed in 853ms (View: 1, DB: 841) | 200 OK [http://kenny/redmine/searchissues?format=json]

Looks like an issue with case sensitivity and/or with the order of query tokens

When you query PHP_Invoke install with pear you get no results back because the original issue does not contain the word with. With the current implementation, we have no smart way to search for similar issue except returning either:

  • issues where the subject contains all the words in the query string
  • issues where the subject contains any the words in the query string

In order to do something smarter, we'd need full text search & indexing, or a more clever algorithm that does not require too much computing resources. Do you have any suggestion about that?

Does any of the other responses look strange to you?

Sry, push wrong button on my phone and closed the issue. I'll take a peak when I get back in the office.

mysql and postgresql differ in handling case sensitivity on LIKE query operator. Postgres has ILIKE for case insensitive results.
They also differ in regex api (mysql: REGEXP, pg: ~*)

Fulltext search is heavily involved, postgres offers tsearch for one, additionally SIMILAR TO, mysql uses fulltext indices and MATCH AGAINST syntax. All that would require migrating the database on issues and to distinguish the database layer.

A simple cross-db solution could be handling all queries case insensitive by

select subject from issues where upper(subject) LIKE upper('%foo%');

Implemented subject querying with lower(subject) like lower(?) to fix issue #20, it should cover this as well.