{"issue":{"state":"open","pull_request":{"diff_url":null,"html_url":null,"patch_url":null},"user":{"avatar_url":"https://secure.gravatar.com/avatar/8d1b2a491e3579f5775fd730b8063451?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"8d1b2a491e3579f5775fd730b8063451","url":"https://api.github.com/users/picman","login":"picman","id":779003},"milestone":null,"labels":[],"assignee":null,"updated_at":"2011-10-27T10:09:36Z","closed_at":null,"comments":6,"url":"https://api.github.com/repos/xelkano/redmine_xapian/issues/14","body":"If I put XLS file containing '(NTC1 )' text in a cell and then after indexing try to search 'NTC1' text, Xapian crashes.\r\n\r\nI've tried to find out where is the problem, but no success. Finally I've made a hotfix in attachment_patch.rb:\r\n\r\n```ruby\r\ndef container_type\r\n        if container.is_a?(Issue)\r\n          container_type = \"Issue\"\r\n        elsif container.is_a?(WikiPage)\r\n          container_type = \"WikiPage\"\r\n        elsif container.is_a?(Document)\r\n          container_type = \"Document\"\r\n        elsif container.is_a?(Message)\r\n          container_type = \"Message\"\r\n        #elsif container.is_a?(Article)\r\n        #  container_type = \"Article\"\r\n        end\r\n        container_type\r\n    end\r\n```\r\n\r\nIt's strange but it seems to me that  calling container.is_a?(Article) causes the problem.\r\n\r\nHere's the log:\r\n\r\nProcessing SearchController#index (for 192.168.251.254 at 2011-06-30 10:51:03) [GET]\r\n  Parameters: {\"scope\"=>\"all\", \"dmsf_files\"=>\"1\", \"messages\"=>\"1\", \"all_words\"=>\"1\", \"submit\"=>\"Submit\", \"wiki_pages\"=>\"1\", \"action\"=>\"index\", \"documents\"=>\"1\", \"projects\"=>\"1\", \"changesets\"=>\"1\", \"q\"=>\"NTC1\", \"issues\"=>\"1\", \"controller\"=>\"search\", \"news\"=>\"1\", \"attachments\"=>\"1\"}\r\nRendering template within layouts/base\r\nRendering search/index\r\n\r\n```\r\nActionView::TemplateError (uninitialized constant AttachmentPatch::InstanceMethods::Article) on line #41 of vendor/plugins/redmine_xapian/app/views/search/index.rhtml:\r\n38: <% logger.info(e.event_type) %>\r\n39: <% logger.info(e.event_title) %>\r\n40:\r\n41: <%  if e.container_type == \"Document\" %>\r\n42: <%=         link_to truncate( l(:label_document)+e.container_name, :length => 255), e.container_url %>\r\n43: <%  elsif e.container_type == \"Message\" %>\r\n44: <%=         link_to truncate( l(:label_message)+e.container_name, :length => 255), e.container_url %>\r\n```","html_url":"https://github.com/xelkano/redmine_xapian/issues/14","number":14,"title":"Searching in Files module","id":1143063,"created_at":"2011-06-30T09:26:42Z"},"action":"created","comment":{"user":{"avatar_url":"https://secure.gravatar.com/avatar/cc4af1023908bc57b6e7efe11f026acf?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"cc4af1023908bc57b6e7efe11f026acf","url":"https://api.github.com/users/xelkano","login":"xelkano","id":249555},"updated_at":"2011-10-27T10:09:36Z","url":"https://api.github.com/repos/xelkano/redmine_xapian/issues/comments/2541747","body":"\r\nI've added an additional check in rev1.2.2 to see if Article class is really defined.\r\n\r\n```ruby\r\nelsif ( defined?(Article) == 'constant' )\r\n\t  if container.is_a?(Article)\r\n             container_type = \"Article\"\r\n\t  end\r\nend\r\n```\r\n\r\n","id":2541747,"created_at":"2011-10-27T10:09:36Z"}}