Knowledgebase Plugin
Added by Alex Bevilacqua over 14 years ago
Please don't report issues here; use https://github.com/alexbevi/redmine_knowledgebase¶
Where I work, there has been a need for a knowledgebase solution that was (a) robust, (b) integrated with our project management solution, and (c) ... free.
Since we use Redmine internally, it made sense to build this functionality on top of the existing platform. Most of what you can accomplish through a knowledgebase, you can accomplish through a wiki, but our users were looking for a hierarchical system that would track page views, rankings and be fully searchable.
The system I've written isn't really there yet, but it's a work in progress I'd like to present to the community on the off chance that someone else finds it useful.
There's still quite a bit to do, but open source development is more fun when done in the open :)
Replies (123)
RE: Knowledgebase Plugin
-
Added by Joshua Villagomez over 13 years ago
Hi Alex or anyone,
I really think you have something great going here. I'd like to install it on my redmine server, but it doesn't have Internet access. How can I install this manually?
RE: Knowledgebase Plugin
-
Added by Joshua Villagomez over 13 years ago
Looks like we're still waiting for some key features to make this KB plugin. I'm mainly interested in searching KBs right now. Since the KB's are not part of any project, has anyone figured out a way around this temporarily?
RE: Knowledgebase Plugin
-
Added by Joshua Villagomez over 13 years ago
Joshua Villagomez wrote:
Looks like we're still waiting for some key features to make this KB plugin more robust. I'm mainly interested in searching KBs right now. Since the KB's are not part of any project, has anyone figured out a way around this temporarily?
RE: Knowledgebase Plugin
-
Added by Alex Bevilacqua over 13 years ago
Joshua Villagomez wrote:
Looks like we're still waiting for some key features to make this KB plugin. I'm mainly interested in searching KBs right now. Since the KB's are not part of any project, has anyone figured out a way around this temporarily?
The major roadblock for searching is (as you indicated), the lack of search provider support for non-project based plugins. I've added a feature request (http://www.redmine.org/issues/8215) for this, but we'll have to wait to see if it gets any traction.
For the moment, if you add a belongs_to :project
to the Articles model, then ensure that you have a project that the logged in user belongs to, you should be able to search articles. This is the hack that others have been using. It's not ideal, but it gets the job done ;)
RE: Knowledgebase Plugin
-
Added by Joshua Villagomez over 13 years ago
Hi Alex,
Thanks for your help here. So, I checked the article.rb model, and line 7 already has this:
belongs_to :project # XXX association added to allow searching to work
Is that correct? I made sure my test user account was a member of a test project with the kb articles. I gave him full permissions to the project. However, it's not returning any article results. What specific permissions or roles does it mean to "belong to"?
RE: Knowledgebase Plugin
-
Added by Joshua Villagomez over 13 years ago
Still no go. I checked the log, and I'm getting this:SyntaxError (/home/redmine/redmine-1.1.2/vendor/plugins/redmine_knowledgebase/app/models/article.rb:7: syntax error, unexpected tCONSTANT, expecting kEND):
Where does the articles constant get declared? I think we're close...
RE: Knowledgebase Plugin
-
Added by Chris Darts over 13 years ago
I've just managed to get searching working for knowledgebase articles. All I did was update the project_id field in the table kb_articles and made sure the user had correct permissions for that project. This is a big step forward and willl probably be enough for us to adopt this plugin into our production system very shortly.
Is there a way to set the default value for the project_id field so when a new article is added it is automictally assigned to the same project? I've tried altering the database table but it didn't seem to have any effect:
ALTER TABLE `redmine`.`kb_articles` MODIFY COLUMN `project_id` INTEGER DEFAULT 31;
Any ideas?
RE: Knowledgebase Plugin
-
Added by Alex Bevilacqua over 13 years ago
Chris Darts wrote:
I've just managed to get searching working for knowledgebase articles. All I did was update the project_id field in the table kb_articles and made sure the user had correct permissions for that project. This is a big step forward and willl probably be enough for us to adopt this plugin into our production system very shortly.
Is there a way to set the default value for the project_id field so when a new article is added it is automictally assigned to the same project? I've tried altering the database table but it didn't seem to have any effect:
[...]
Any ideas?
Chris,
Under app/controllers/articles_controller.rb
, you could do something like this:
--- a/app/controllers/articles_controller.rb
+++ b/app/controllers/articles_controller.rb
@@ -21,6 +21,7 @@ class ArticlesController < KnowledgebaseController
@article = Article.new(params[:article])
@article.category_id = params[:category_id]
@article.author_id = User.current.id
+ @article.project_id = 31
if @article.save
attachments = attach(@article, params[:attachments])
# XXX Commented this out for now as it's not available in the
That would hard-code a project_id
to your articles ever time you create a new one.
I still hate this approach, but until the search provider code is made to be more flexible, these types of hacks will continue to be needed.
RE: Knowledgebase Plugin
-
Added by Chris Darts over 13 years ago
Alex Bevilacqua wrote:
Chris,
Under
app/controllers/articles_controller.rb
, you could do something like this:[...]
That would hard-code a
project_id
to your articles ever time you create a new one.I still hate this approach, but until the search provider code is made to be more flexible, these types of hacks will continue to be needed.
That worked perfectly, thanks for your quick response.
I'll keep an eye out to see if anything happens with #8215, but this work around is fine for the moment.
RE: Knowledgebase Plugin
-
Added by Alex Bevilacqua over 13 years ago
Chris Darts wrote:
Alex Bevilacqua wrote:
Chris,
Under
app/controllers/articles_controller.rb
, you could do something like this:[...]
That would hard-code a
project_id
to your articles ever time you create a new one.I still hate this approach, but until the search provider code is made to be more flexible, these types of hacks will continue to be needed.
That worked perfectly, thanks for your quick response.
I'll keep an eye out to see if anything happens with #8215, but this work around is fine for the moment.
I would recommend leaving some comments on issue #8215 as well. Hopefully that will get some attention from the devs, but they've made it quite clear in the past that "popularity" of an issue doesn't mean squat when it comes to prioritization of effort :P
RE: Knowledgebase Plugin
-
Added by Joshua Villagomez over 13 years ago
Alex/Chris, that did it for us too! We were trying to get this to work yesterday. We realized it had to do with the project_id, when we saw they were all 0's! Now, we're able to search any existing or new article. Thank you!
The icing on the cake for us, would be for redmine_xapian plugin to search attachments in Knowledgebase. By default, xapian can't find the attachements in knowledgebase plugin. I've put a post on their Github, but we'll see. Maybe we can try figuring this one out.
RE: Knowledgebase Plugin
-
Added by Joshua Villagomez over 13 years ago
Worked on the Spanish translation for redmine/vendor/plugins/redmine_knowledgebase/config/locales/es.yml
RE: Knowledgebase Plugin
-
Added by Terence Mill over 13 years ago
If thos pdf export is working for textile pages, same s redmine wiki pages they realy should migrate thie export method to standard redmine wiki functionality.
See Issue #1468
RE: Knowledgebase Plugin
-
Added by Terence Mill over 13 years ago
RE: Knowledgebase Plugin
-
Added by Luis Serrano Aranda over 13 years ago
It is possible to add Atom and pdf export ?
Thanks
RE: Knowledgebase Plugin
-
Added by Alex Bevilacqua over 13 years ago
Luis Serrano Aranda wrote:
It is possible to add Atom and pdf export ?
Thanks
Anything's possible ... it's just a matter of having the time to implement the features ;)
RE: Knowledgebase Plugin
-
Added by Ricardo S over 13 years ago
Chris,
With redmine's trunk version, it was giving the following error doing a search:
A ActiveRecord::StatementInvalid occurred in search#index: Mysql::Error: Unknown column 'articles.created_on' in 'where clause': SELECT `kb_articles`.`id` AS t0_r0, `kb_articles`.`cate...
It got solved with the following change:
--- a/app/models/article.rb
+++ b/app/models/article.rb
@@ -16,7 +21,8 @@ class Article < ActiveRecord::Base
acts_as_searchable :columns => [ "kb_articles.title", "kb_articles.content"],
:include => [ :project ],
:order_column => "kb_articles.id",
- :permission => nil
+ :permission => nil,
+ :date_column => "#{table_name}.created_at"
acts_as_event :title => Proc.new { |o| "#{l(:label_title_articles)} ##{o.id}: #{o.title}" },
RE: Knowledgebase Plugin
-
Added by Luis Serrano Aranda over 13 years ago
@article.project_id = 31
Should be number 31 or may be either (a project does not exist) I say that I have a project with that ID number
RE: Knowledgebase Plugin
-
Added by Luis Serrano Aranda over 13 years ago
Redmine returns this error:
Mysql::Error: Unknown column 'articles.project_id' in 'where clause': SELECT count(DISTINCT `kb_articles`.id) AS count_all FROM `kb_articles` LEFT OUTER JOIN `projects` ON `projects`.id = `kb_articles`.project_id WHERE ((projects.status=1 AND articles.project_id IN (120,50,174,434,330,3,441,432,371)) AND (((LOWER LIKE '%prueba%')) AND ((LOWER LIKE '%resumen%'))))
RE: Knowledgebase Plugin
-
Added by T Leung over 13 years ago
I experienced the same problem too.
When I did a
select * from kb_articles; <pre> on MySQL, it showed that the columns are created_at rather than created_on What is defining the created_on? is the redmine acts_as_searchable.rb file. In the module *ClassMethods*, it has the following statement: <pre> searchable_options[:project_key] ||= "#{table_name}.project_id" searchable_options[:date_column] ||= "#{table_name}.created_on" </pre> If I type: <pre> Rails.logger.info "kb_articles tablename #{Articles.table_name}" </pre> the return is *kb_articles* but what is telling it to use *articles* as the name, that may be the key. In the init.rd file under /plugins/redmine_knowledgebase, the available search types are defined here: <pre> Redmine::Search.available_search_types << 'articles' </pre> but if that is changed to *kb_articles* it does not help. Any ideas?
RE: Knowledgebase Plugin
-
Added by T Leung over 13 years ago
I'm tempted to add the following in my acts_as_searchable to make it just work:
if searchable_options[:date_column] == 'articles.created_on' limit_options[:conditions] = "(kb_articles.created_at " + (options[:before] ? ',' : '>' ... else limit_options[:conditions] = "(#{searchable_options[:date_column]} ... end
but I think the best way it to address the issue of what is telling it to use 'articles', if we do figure it out, we will still need to tweak to accommodate created_at
RE: Knowledgebase Plugin
-
Added by Ricardo S over 13 years ago
T Leung, it should be enough to call set_table_name on the beginning of the article.rb.
class Article < ActiveRecord::Base
unloadable
set_table_name "kb_articles" # changes the default table name
validates_presence_of :title
validates_presence_of :category_id
... and delete:
def self.table_name() "kb_articles" end*
Also make sure you do the change I mentioned on my previous post.
RE: Knowledgebase Plugin
-
Added by Luis Serrano Aranda over 13 years ago
Thanks Ricardo Santos
Only with your patch works !!