Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Files" entry type causing error #87

Closed
tiurlumbangaol opened this issue Dec 6, 2017 · 10 comments
Closed

"Files" entry type causing error #87

tiurlumbangaol opened this issue Dec 6, 2017 · 10 comments
Assignees
Labels

Comments

@tiurlumbangaol
Copy link

tiurlumbangaol commented Dec 6, 2017

Hi,
There is a bug, on the Global search scope, if "files" entry selected.

The behavior for example :
If i search keyword "this", and "this" keyword is there on repository files, and i check the "files entry", like this screenshot :
image

then the search result will gave error like this :
image

but if i uncheck the "files" option, the behavior will be normal :
image

If i search keyword "xyz", and "xyz" keyword is NOT there on repository files, and i check the "files entry", like this screenshot :

image

the behavior will be normal, there is no error.

so the conclusion is, error will happen if search keyword that getting indexed with xapian, and i select the "files" entry option. this bug behavior appears both on : "project scope search" and "global scope search"

@picman picman added the Bug label Dec 6, 2017
@picman picman self-assigned this Jan 5, 2018
@picman
Copy link
Collaborator

picman commented Jan 5, 2018

I'm afraid that I'm not able to reproduce the error. It works fine for me:

screenshot-2018-1-5 search - kdp 3 7 webrick

Please post Redmine and the plugin versions you are using + production.log.

@picman picman added Invalid and removed Bug labels Jan 25, 2018
@picman
Copy link
Collaborator

picman commented Jan 25, 2018

No feedback => closing.

@picman picman closed this as completed Jan 25, 2018
@tiurlumbangaol
Copy link
Author

hi,
sorry for the late reply. i was trying to setup new instance, but the error still happened. the log saying :
`Started GET "/search?utf8=%E2%9C%93&scope=&q=alfresco" for 36.71.134.49 at 2018-04-02 17:00:39 +0000
Processing by SearchController#index as HTML
Parameters: {"utf8"=>"✓", "scope"=>"", "q"=>"alfresco"}
Current user: tiur (id=3)
Completed 500 Internal Server Error in 660ms (ActiveRecord: 52.8ms)

NameError (uninitialized constant Article):
app/models/attachment.rb:171:in project' plugins/redmine_xapian/lib/redmine_xapian/search_strategies/xapian_search.rb:120:in process_attachment'
plugins/redmine_xapian/lib/redmine_xapian/search_strategies/xapian_search.rb:102:in block in xapian_search' plugins/redmine_xapian/lib/redmine_xapian/search_strategies/xapian_search.rb:88:in each'
plugins/redmine_xapian/lib/redmine_xapian/search_strategies/xapian_search.rb:88:in xapian_search' plugins/redmine_xapian/lib/redmine_xapian/search_strategies/xapian_search_service.rb:30:in search'
plugins/redmine_xapian/lib/redmine_xapian/attachment_patch.rb:78:in search' plugins/redmine_xapian/lib/redmine_xapian/attachment_patch.rb:44:in search_result_ranks_and_ids_with_search_result_ranks_and_ids_ext'
lib/redmine/search.rb:127:in block in load_result_ids' lib/redmine/search.rb:125:in each'
lib/redmine/search.rb:125:in load_result_ids' lib/redmine/search.rb:115:in block in load_result_ids_from_cache'
lib/redmine/search.rb:114:in load_result_ids_from_cache' lib/redmine/search.rb:99:in result_ids'
lib/redmine/search.rb:70:in result_count' plugins/redmine_xapian/lib/redmine_xapian/search_controller_patch.rb:135:in index_with_xapian'
lib/redmine/sudo_mode.rb:63:in `sudo_mode'

`

please help

@picman picman added Bug and removed Invalid labels Apr 3, 2018
@picman picman added this to the 1.6.8 milestone Apr 3, 2018
@picman
Copy link
Collaborator

picman commented Apr 3, 2018

Hm, that's strange. The problem is reported from here:

NameError (uninitialized constant Article):
app/models/attachment.rb:171:in project' plugins/redmine_xapian/lib/redmine_xapian/search_strategies/xapian_search.rb:120:inprocess_attachment'

There is called a Redmine method Attachment.project which internally calls container.try(:project). In your case container is probably Article. Article very probably comes from a plugin, doesn't it?
I've no clue why it fails here, I'm afraid.
Maybe post the plugin's link and I will try it locally.

@picman picman reopened this Apr 3, 2018
picman added a commit that referenced this issue Apr 3, 2018
@picman
Copy link
Collaborator

picman commented Apr 4, 2018

'Article' seems to come from Knowledgebase plugin. So I've tested searching with this plugin installed and everything seems to be Okay.

@tiurlumbangaol
Copy link
Author

hi, yes, i also tested it using redmine knowledge base plugin. but it is succesfull. i think because of my previous database.

somehow previous database structure causing error. let me go through it again, and will update it here.

@picman picman removed this from the 1.6.8 milestone Apr 6, 2018
@tiurlumbangaol
Copy link
Author

hi, did you solve it on version 1.6.8?

@picman
Copy link
Collaborator

picman commented Apr 7, 2018

I haven't solved it. I've just removed the milestone.

@tiurlumbangaol
Copy link
Author

tiurlumbangaol commented Apr 22, 2018

hi @picman

i have trace it, and i know what the cause is.

i have record in "attachments" table that has "container_type source" is Article, and Contacts.

While i already uninstall the article and contacts plugin.

My steps to solve this :

  1. get all the "disk_filename" of all attachments, for example i use this query for the contacts attachments :
    select * from attachments as a, notes as n where a.container_type='Note' and a.container_id =n.id and a.disk_filenameand n.source_type='Contact'

  2. put that full path of query result into a text file, for example : list-of-error-files.txt

  3. then i delete all documents that listed on "list-of-error-files.txt" by using this command on linux :
    xargs rm -r < list-of-error-files.txt

Can you put handling exception for this case? so if that case happened, it will not cause error on redmine_xapian

btw, this is a really really cool plugin. thanks for creating it :)

@picman
Copy link
Collaborator

picman commented Apr 23, 2018

I've already fixed it in this commit: 8dd19b5.

@picman picman closed this as completed Apr 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants