Closed fabiob closed 11 years ago
This feature would be very useful. Are there any plans to implement this in the near future?
I agree with this feature too. Would be a perfect addition, wonder how difficult it would be.
There is an issue at the moment with registering plugins for Redmine integrated search if the plugin doesn't have a project dependency. Until that is resolved, we cannot really do anything ... at least not without hacks and workarounds ;)
This is a real shame as we are seriously considering using this plugin to handle knowledge management throughout our organisation of 50 people.
From my point of the view the only thing stopping us is the inability to access the information through the standard Redmine search facility.
Is there a way this could be resolved, albeit temporarily, to get this working?
How about if, through a simple plugin config screen, the user to could select a project to assign the knowledgebase to? For example we have a specific 'generic' project which we use as a site-wide wiki (using the following hack: http://www.redmine.org/boards/1/topics/18791) and could use this as the project 'home' for knowledgebase.
I appreciate this isn't ideal, but unless there is some kind of search functionality to retrieve the information stored in the articles, then I don't see this plugin being widely adopted. Apart from this, I am very happy with the plugin and think it will be a great tool for our organisation.
Chris
On 08/04/11 21:03, alexbevi wrote:
There is an issue at the moment with registering plugins for Redmine integrated search if the plugin doesn't have a project dependency. Until that is resolved, we cannot really do anything ... at least not without hacks and workarounds ;)
Shouldn't this issue remain open until it has been resolved? I think marking it as closed may be slightly misleading.
Chris, I'm totally with you on this one. We too are kind of holding back, because the knowledge management needs to be searchable for obvious reasons. I like the concept of a plugin knowledgebase that can "belong" to selectively. Otherwise, you're always tied to a static project. I feel this plugin has huge potential. I'm loving it. Would like to extend it further.
I've put in a request to the Redmine devs to consider this at http://www.redmine.org/issues/8215. I'd love to have searching working without the need for convoluted hacks ;)
Very glad to see the new request Alex. In the mean time, does anyone have a good hack? I kinda see where Chris is going with his hack, but I'd like to know if anyone has been successful in searching KBs?
I've managed to get searching working by simply assigning a value to the project_id field in the kb_articles table. It now works fine.
See here for more conversation on the topic: http://www.redmine.org/boards/3/topics/11643?r=23597
why doesn't github have a 'watch' ability! Anyway, just wanted to get e-mail notifications on this. Also because you added a period the issue link is invalid :P correct link is: http://www.redmine.org/issues/8215
Look this http://www.redmine.org/boards/3/topics/23591?r=23740#message-23740, and works well
The search is still not working.
I have no clue how to debug it. :(
kb_article.rb looks fine to me. acts as searchable is defined well. However the "def project" method returns nil". Maybe this is an issue?
I use redmine 1-3
Following observations:
How could i debug it? Maybe the reason is the xapian plugin?
Thans alot!
honestly, no real work has gone into search (on my part at least). Since a project dependency is a REQUIREMENT for redmine search, unless i discard the "global" aspect in favour of "scoped-to-project" knowledgebases, it's unlikely search will ever work without needing a bunch of hacks :(
I'm open to suggestions, and have kept this issue open as I WANT searching to be an option, but I'm reticent to override the internal Redmine query methods as this would open up a whole new can of worms (from a support and maintenance standpoint).
Any ideas are welcome ... patches more so :P
Would it be reasonable to implement a knowledgebase-only search for the time being? For example, a search box could appear above the category or commands at the right side of knowledgebase pages. I believe that this would be better than not having one at all. Especially for those that have built up a large amount of articles. Just wanted to throw the idea out there while I was thinking about it. I'm a new Redmine user and so far the knowledgebase is my favorite plugin. I'm glad to see that it is under continual development and can't wait to see what's to come in the future! Thanks for all your hard work!
That or to affect automatically all articles to a project seen by everyone. I'd like to have a try with that because we absolutely need a solution to be able to search that knowledge. I'll try to see what could be done when I've time, within 3 months.
Sounds good. I'm not a coder, but I'd be happy to test anything if needed or help any other way. The knowledgebase is one of the most essential features for me and I would love to see search added to it.
For the record, here's what I did to have KB-articles in the global search like the OP requested; I took the same approach martin-denizet suggested.
Depending of the version of this plugin, you should now be set. If you use an older version of this plugin Open redmine_knowledgebase/config/routes.rb and add the code below if it isn't already present:
map.connect "/knowledgebase/articles/:article_id", :controller => "articles", :action => "show", :conditions => { :method => [:get, :post] }
Please, can anybody help me to make searching work? I set project_id in table kb_articles as suggested by jniggemann. I tried changing redmine_knowledgebase/config/routes.rb. I use redmine 2.x so it's written in new form. I tried several changes but no luck. What should be the content of that file? Or should I hack some other files (that's no problem for our instalation). Thanx
Search seems to be broken again with 2.x I've folled jniggemann's instructions - without modifying routes.rb I get a database error when searching, when adding above line I get a Ruby error. Migrating the database also produces said error:
An error occurred while loading the routes definition of redmine_knowledgebase plugin (/opt/redmine-2.0.3/plugins/redmine_knowledgebase/config/routes.rb): undefined local variable or method `map' for #ActionDispatch::Routing::Mapper:0x2b00597caa40.
Another attempt was adding this line to routes.rb:
match '/articles/show', :to => 'articles#show', :via => [:get, :post]
This does resturn search results but the links is still wrong - instead of linking to knowledgebase/articles/1 it links to articles/show?article_id=1
Any idea how to fix this?
Yet another update. I found out that the map.connect directive only works with Rails 2.x whereas Redmine 2.0 already uses Rails 3.x. Converting the above statement to an identical match statement would look like this:
match '/knowledgebase/articles/:article_id', :to => 'articles#show', :via => [:get, :post]
This does work in that it returns search results with correct links but the links themselves have stopped working: I can't open a single KB article anymore - all of them return Error 500.
Reading this http://markconnell.co.uk/posts/2010/02/rails-3-routing-examples and not having any more knowledge I'd say that the Rails 2 route
map.connect "/knowledgebase/articles/:article_id", :controller => "articles", :action => "show"
would be the following in Rails 3
match '/knowledgebase/articles/:article_id' => 'articles#show'
I'm not sure about the "conditions-get-post" part though...
Thanks, but like I've said in my second update I've already tried this and the result is mixed. Search works, the links are correct but I cannot open a single kb article because I'm getting a Redmine 500 error when trying to do so.
Can you post the full backtrace?
On Thu, Aug 9, 2012 at 7:43 AM, mj00 notifications@github.com wrote:
Thanks, but like I've said in my second update I've already tried this and the result is mixed. Search works, the links are correct but I cannot open a single kb article because I'm getting a Redmine 500 error when trying to do so.
— Reply to this email directly or view it on GitHubhttps://github.com/alexbevi/redmine_knowledgebase/issues/11#issuecomment-7611867.
I'd love to if you could tell me what log file to look into ;)
@mj00 /path/to/redmine/log/production.log
Thanks, just found that myself too :)
Without above line in routes.rb (aka can open articles, but search links are broken):
Started GET "/knowledgebase/articles/13" for 192.168.3.115 at Thu Aug 09 13:46:40 +0200 2012 Processing by ArticlesController#show as HTML Parameters: {"id"=>"13"} DEPRECATION WARNING: :confirm option is deprecated and will be removed from Rails 4.0. Use ':data => { :confirm => 'Text' }' instead. (called from link_to_if_authorized_globally at /opt/redmine-2.0.3/plugins/redmine_knowledgebase/app/helpers/knowledgebase_helper.rb:6) Rendered plugins/redmine_knowledgebase/app/views/articles/_rating.html.erb (8.9ms) Rendered plugins/redmine_knowledgebase/app/views/articles/show.html.erb within layouts/base (181.6ms) Completed 200 OK in 229ms (Views: 100.3ms | ActiveRecord: 118.3ms)
With above line in routes.rb (aka search works and returns correct links but cannot open a single article):
Connecting to database specified by database.yml OpenIdAuthentication.store is nil. Using in-memory store. Creating scope :active. Overwriting existing method User.active. Creating scope :open. Overwriting existing method Version.open. DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in CollectiveIdea::Acts::NestedSet::Model instead. (called from include at /opt/redmine-2.0.3/lib/plugins/awesome_nested_set/lib/awesome_nested_set/awesome_nested_set.rb:58) DEPRECATION WARNING: The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically. Please define instance methods directly in CollectiveIdea::Acts::NestedSet::Model instead. (called from include at /opt/redmine-2.0.3/lib/plugins/awesome_nested_set/lib/awesome_nested_set/awesome_nested_set.rb:58) Creating scope :open. Overwriting existing method Issue.open.
Started GET "/knowledgebase/articles/13" for 192.168.3.115 at Thu Aug 09 13:47:21 +0200 2012 Processing by ArticlesController#show as HTML Parameters: {"article_id"=>"13"} Completed 500 Internal Server Error in 335ms
NoMethodError (undefined method
view' for nil:NilClass): plugins/redmine_knowledgebase/app/controllers/articles_controller.rb:38:in
show' actionpack (3.2.6) lib/action_controller/metal/implicit_render.rb:4:insend_action' actionpack (3.2.6) lib/action_controller/metal/implicit_render.rb:4:in
send_action' actionpack (3.2.6) lib/abstract_controller/base.rb:167:inprocess_action' actionpack (3.2.6) lib/action_controller/metal/rendering.rb:10:in
process_action' actionpack (3.2.6) lib/abstract_controller/callbacks.rb:18:inprocess_action' activesupport (3.2.6) lib/active_support/callbacks.rb:469:in
_run1246313170process_action453433196callbacks' activesupport (3.2.6) lib/active_support/callbacks.rb:405:insend' activesupport (3.2.6) lib/active_support/callbacks.rb:405:in
run_callback' activesupport (3.2.6) lib/active_support/callbacks.rb:385:in_run_process_action_callbacks' activesupport (3.2.6) lib/active_support/callbacks.rb:81:in
send' activesupport (3.2.6) lib/active_support/callbacks.rb:81:inrun_callbacks' actionpack (3.2.6) lib/abstract_controller/callbacks.rb:17:in
process_action' actionpack (3.2.6) lib/action_controller/metal/rescue.rb:29:inprocess_action' actionpack (3.2.6) lib/action_controller/metal/instrumentation.rb:30:in
process_action' activesupport (3.2.6) lib/active_support/notifications.rb:123:ininstrument' activesupport (3.2.6) lib/active_support/notifications/instrumenter.rb:20:in
instrument' activesupport (3.2.6) lib/active_support/notifications.rb:123:ininstrument' actionpack (3.2.6) lib/action_controller/metal/instrumentation.rb:29:in
process_action' actionpack (3.2.6) lib/action_controller/metal/params_wrapper.rb:206:inprocess_action' activerecord (3.2.6) lib/active_record/railties/controller_runtime.rb:18:in
process_action' actionpack (3.2.6) lib/abstract_controller/base.rb:121:inprocess' actionpack (3.2.6) lib/abstract_controller/rendering.rb:45:in
process' actionpack (3.2.6) lib/action_controller/metal.rb:203:indispatch' actionpack (3.2.6) lib/action_controller/metal/rack_delegation.rb:14:in
dispatch' actionpack (3.2.6) lib/action_controller/metal.rb:246:inaction' actionpack (3.2.6) lib/action_dispatch/routing/route_set.rb:73:in
call' actionpack (3.2.6) lib/action_dispatch/routing/route_set.rb:73:indispatch' actionpack (3.2.6) lib/action_dispatch/routing/route_set.rb:36:in
call' journey (1.0.4) lib/journey/router.rb:68:incall' journey (1.0.4) lib/journey/router.rb:56:in
each' journey (1.0.4) lib/journey/router.rb:56:incall' actionpack (3.2.6) lib/action_dispatch/routing/route_set.rb:600:in
call' rack-openid (1.3.1) lib/rack/openid.rb:98:incall' actionpack (3.2.6) lib/action_dispatch/middleware/best_standards_support.rb:17:in
call' rack (1.4.1) lib/rack/etag.rb:23:incall' rack (1.4.1) lib/rack/conditionalget.rb:25:in
call' actionpack (3.2.6) lib/action_dispatch/middleware/head.rb:14:incall' actionpack (3.2.6) lib/action_dispatch/middleware/params_parser.rb:21:in
call' actionpack (3.2.6) lib/action_dispatch/middleware/flash.rb:242:incall' rack (1.4.1) lib/rack/session/abstract/id.rb:205:in
context' rack (1.4.1) lib/rack/session/abstract/id.rb:200:incall' actionpack (3.2.6) lib/action_dispatch/middleware/cookies.rb:338:in
call' activerecord (3.2.6) lib/active_record/query_cache.rb:64:incall' activerecord (3.2.6) lib/active_record/connection_adapters/abstract/connection_pool.rb:473:in
call' actionpack (3.2.6) lib/action_dispatch/middleware/callbacks.rb:28:incall' activesupport (3.2.6) lib/active_support/callbacks.rb:405:in
_run397314981call4callbacks' activesupport (3.2.6) lib/active_support/callbacks.rb:405:insend' activesupport (3.2.6) lib/active_support/callbacks.rb:405:in
run_callback' activesupport (3.2.6) lib/active_support/callbacks.rb:385:in_run_call_callbacks' activesupport (3.2.6) lib/active_support/callbacks.rb:81:in
send' activesupport (3.2.6) lib/active_support/callbacks.rb:81:inrun_callbacks' actionpack (3.2.6) lib/action_dispatch/middleware/callbacks.rb:27:in
call' actionpack (3.2.6) lib/action_dispatch/middleware/remote_ip.rb:31:incall' actionpack (3.2.6) lib/action_dispatch/middleware/debug_exceptions.rb:16:in
call' actionpack (3.2.6) lib/action_dispatch/middleware/show_exceptions.rb:56:incall' railties (3.2.6) lib/rails/rack/logger.rb:26:in
call_app' railties (3.2.6) lib/rails/rack/logger.rb:16:incall' actionpack (3.2.6) lib/action_dispatch/middleware/request_id.rb:22:in
call' rack (1.4.1) lib/rack/methodoverride.rb:21:incall' rack (1.4.1) lib/rack/runtime.rb:17:in
call' activesupport (3.2.6) lib/active_support/cache/strategy/local_cache.rb:72:incall' rack (1.4.1) lib/rack/lock.rb:15:in
call' actionpack (3.2.6) lib/action_dispatch/middleware/static.rb:62:incall' rack-cache (1.2) lib/rack/cache/context.rb:136:in
forward' rack-cache (1.2) lib/rack/cache/context.rb:245:infetch' rack-cache (1.2) lib/rack/cache/context.rb:185:in
lookup' rack-cache (1.2) lib/rack/cache/context.rb:66:incall!' rack-cache (1.2) lib/rack/cache/context.rb:51:in
call' railties (3.2.6) lib/rails/engine.rb:479:incall' railties (3.2.6) lib/rails/application.rb:220:in
call' railties (3.2.6) lib/rails/railtie/configurable.rb:30:insend' railties (3.2.6) lib/rails/railtie/configurable.rb:30:in
method_missing' passenger (3.0.11) lib/phusion_passenger/rack/request_handler.rb:96:inprocess_request' passenger (3.0.11) lib/phusion_passenger/abstract_request_handler.rb:513:in
accept_and_process_next_request' passenger (3.0.11) lib/phusion_passenger/abstract_request_handler.rb:274:inmain_loop' passenger (3.0.11) lib/phusion_passenger/rack/application_spawner.rb:206:in
start_request_handler' passenger (3.0.11) lib/phusion_passenger/rack/application_spawner.rb:171:insend' passenger (3.0.11) lib/phusion_passenger/rack/application_spawner.rb:171:in
handle_spawn_application' passenger (3.0.11) lib/phusion_passenger/utils.rb:479:insafe_fork' passenger (3.0.11) lib/phusion_passenger/rack/application_spawner.rb:166:in
handle_spawn_application' passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:357:in__send__' passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:357:in
server_main_loop' passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:206:instart_synchronously' passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:180:in
start' passenger (3.0.11) lib/phusion_passenger/rack/application_spawner.rb:129:instart' passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:253:in
spawn_rack_application' passenger (3.0.11) lib/phusion_passenger/abstract_server_collection.rb:132:inlookup_or_add' passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:246:in
spawn_rack_application' passenger (3.0.11) lib/phusion_passenger/abstract_server_collection.rb:82:insynchronize' passenger (3.0.11) lib/phusion_passenger/abstract_server_collection.rb:79:in
synchronize' passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:244:inspawn_rack_application' passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:137:in
spawn_application' passenger (3.0.11) lib/phusion_passenger/spawn_manager.rb:275:inhandle_spawn_application' passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:357:in
send' passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:357:inserver_main_loop' passenger (3.0.11) lib/phusion_passenger/abstract_server.rb:206:in
start_synchronously' passenger (3.0.11) helper-scripts/passenger-spawn-server:99
I think I just found the diff:
Without the match directive:
Started GET "/knowledgebase/articles/13" for 192.168.3.115 at Thu Aug 09 13:46:40 +0200 2012 Processing by ArticlesController#show as HTML Parameters: {"id"=>"13"}
With the match directive:
Started GET "/knowledgebase/articles/13" for 192.168.3.115 at Thu Aug 09 13:47:21 +0200 2012 Processing by ArticlesController#show as HTML Parameters: {"article_id"=>"13"}
@mj00 try changing the following in ArticlesController:
def get_article @article = KbArticle.where(:id => params[:id]) @article = @article.first if @article.is_a?(ActiveRecord::Relation) end
to
def get_article @article = KbArticle.where(:id => params[:id] || params[:article_id]) @article = @article.first if @article.is_a?(ActiveRecord::Relation) end
@mjoo, you wrote match bla bla , :to => bla bla in your route, what is that for, the page I linked to does not do that...
alexbevi: Genius! That fixed it, thanks a lot.
jniggemann: that's what I found as example for RoR3 matches. Apparantly both seem to be working.
Update: scratch that, the :to => doesn't seem to be working properly. It works for some articles but not all of them. Yours however does the trick.
I just pushed a quick update as well.
I'm afraid that was too soon... while it fixed search it broke creating and editing articles.
Creating a new article:
Started GET "/knowledgebase/articles/new?category_id=26" for 192.168.3.115 at Thu Aug 09 14:44:49 +0200 2012 Processing by ArticlesController#show as HTML Parameters: {"category_id"=>"26", "article_id"=>"new"} Completed 500 Internal Server Error in 9ms
Editing an existing article:
Started GET "/knowledgebase/articles/11/edit" for 192.168.3.115 at Thu Aug 09 14:44:03 +0200 2012 Processing by ArticlesController#edit as HTML Parameters: {"id"=>"11"} Rendered plugins/redmine_knowledgebase/app/views/articles/_form.html.erb (287.2ms) Rendered plugins/redmine_knowledgebase/app/views/articles/edit.html.erb within layouts/base (288.8ms) Completed 500 Internal Server Error in 301ms
By the way: is it correct that the edit definition in routes.rb is completely empty?
ok, reverted. It's dangerous how tempting it is to edit files using github (without testing anything) ...
Since this whole global search thing has been nothing but a series of hacks (and I don't personally use it), I'm going to leave this alone and wait for a properly tested patch :)
Do you have any idea what exactly could be causing the errors when creating / editing articles? A working search is the last thing that keeps me from deploying your plugin on our production system, we've been testing it for a while and it's an amazing way to organize knowledge.
@mj00 it shouldn't be too difficult to fix, but I'm at work right now and can't really look into it too closely. If no one gets around to this, I'll have a closer look when I have a bit of free time.
just asking... any progress?
I was hoping for a patch from someone who actually uses the functionality. I haven't ever used the searching hacks, and the quick fixes I did borked other functionality, so I'm waiting as well ;)
We consider searching through KB very important (it's a wiki-style habit). I'd be glad to help... only if I know to code in Rails... All my amateur attempts left me with above-mentioned two consequences: Err 500 or can't create/edit articles...
Sent a patch to @alexbevi . Hopefully it gets commited... :)
Hi, is patch available somewhere? Thanx
https://gist.github.com/3773063
I actually just started reviewing it today, but the more the merrier ;)
Hi, if I click http://localhost:3000/knowledgebase
Internal error...
I patched KB and in log was this :
SyntaxError (/usr/share/redmine-2.1/plugins/redmine_knowledgebase/app/models/kb_article.rb:24: syntax error, unexpected tSYMBEG, expecting kDO or '{' or '(' acts_as_event :title => Proc.new { |o| "#{l(:...
@dodoslav I haven't actually tested the patches, I was just going to review them. It looks like you didn't successfully patch the plugin though.
Post your app/models/kb_article.rb to a gist so we can have a quick look
The patches are for 2.x tested with Redmine 2.0.3 and 2.0.4
Here is my kb_article.rb https://gist.github.com/3786218
ruby 1.8.7 Rails 3.2.8 redmine 2.1.1
@dodoslav there is a trailing comma on line 21 that you need to remove:
:date_column => "kb_articles.created_at", <-------
Yeah, there was mistake, thx. So, searching was working after this mistake but when I clicked on found link - Internal error appeared. I looked at logs and found that link_to_remote method is missing, so I rewrote each to : link_to .. {... , :remote => true } ... and works perfectly!!!
But is it possible to port this patch to redmine version 1.3.2 ?
Without doing some serious patching of the redmine core, it doesn't look like searching will ever work "properly" for the 1.x or 2.x branches of this plugin.
With 3.x, we're moving to a traditional, project-based approach (as all other plugins do) in order to allow us to take advantage of the types of features Redmine core offers (like searching).
Closing for now.
Just wanted to add that this was a good discussion and all feedback was/is appreciated :)
Make KB articles appear on Redmine's global search, using the search box at the top.