view · edit · sidebar · attach · print · history

20130930-nil-in-searchQuery

<< | Index | >>


Summary

  • Compare prices query shows nil when not comparable product found. E.g Amavita Cetirizin
  • After adding a new registration when parsing the AipsDownload we must be able to find it by name

Commits

Index


After adding a new registration when parsing the AipsDownload we must be able to find it by name

We have to answer the question because after running the monthly import of the Packungen.xls (via src/plugin/text_info.rb) the new registrations can be found by name whereas after add them via import_daily (src/plugin/text_info.rb) they cannot be found.

I think I must set the export_flag to false instead of nil, when creating the registration. Re-Importing Xeljanz after calling delete_registration('62630') in bin/admin.

This did not fix my problem. But I found in the output of bin/oddbd the following note: NOTICE: text-search query contains only stop words or doesn't contain lexemes, ignored.

After adding a package, searching for newly imported iksnr did not return nothing anymore. But got the error

NoMethodError
undefined method `to_csv' for nil:NilClass
/var/www/oddb.org/src/view/additional_information.rb:115:in `compositions'
/usr/local/lib64/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:68:in `create'
/usr/local/lib64/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:286:in `compose_component'
/usr/local/lib64/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:211:in `block in compose'
/usr/local/lib64/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:205:in `each'

Okay. Error stems from the fact that src/view/additional_information.rb tries to convert model.pointer.to_csv from the compositions. Avoiding this error by returning a link only if model.pointer is not nil. Now a newly generated registration can be found by name. See for 63030 "Desloratadin"

Pushed commit After add a registration, it can be found by name

Compare prices query shows nil when not comparable product found

An example is Amavita Cetirizin. First suspicion is that this could happen, because we search a string with a space in it. No this is not the case. We get also the following error message when just calling "Cetirizin".

NoMethodError
undefined method `new' for nil:NilClass

We seem to have test cases under test/test_state/drugs/compare.rb. Trying to add a test case for this kind of failure. Did not find a solution in the first 10 minutes.

Running oddbd in a separate screen allows me to catch the following stacktrace:

/usr/local/lib64/ruby/gems/1.9.1/gems/sbsm-1.2.3/lib/sbsm/session.rb:171:in `drb_process'
/usr/lib64/ruby/1.9.1/drb/drb.rb:1548:in `perform_without_block'
/usr/lib64/ruby/1.9.1/drb/drb.rb:1508:in `perform'
/usr/lib64/ruby/1.9.1/drb/drb.rb:1586:in `block (2 levels) in main_loop'
/usr/lib64/ruby/1.9.1/drb/drb.rb:1582:in `loop'
/usr/lib64/ruby/1.9.1/drb/drb.rb:1582:in `block in main_loop'
ODDB::View::Drugs::RootResultList::COMPONENTS[[5, 0]] in create(patinfo)
ODDB::View::Drugs::ResultComposite::COMPONENTS[[0, 2]] in create(ODDB::View::Drugs::RootResultList)
ODDB::View::Drugs::Result::COMPONENTS[[0, 2]] in create(content)
error in SBSM::Session#http_headers: /de/gcc/search/zone/drugs/search_query/Cetirizin/search_type/st_oddb
NoMethodError
undefined method `new' for nil:NilClass
/var/www/oddb.org/src/view/additional_information.rb:397:in `patinfo'
/usr/local/lib64/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:68:in `create'
/usr/local/lib64/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:286:in `compose_component'
/usr/local/lib64/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:211:in `block in compose'
/usr/local/lib64/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:205:in `each'

After applying the following patch, I don't get this error anymore:

diff --git a/src/view/additional_information.rb b/src/view/additional_information.rb
index 5151a97..5509803 100644
--- a/src/view/additional_information.rb
+++ b/src/view/additional_information.rb
@@ -394,6 +394,8 @@ module ODDB
             old_link_format = {'pointer' => patinfo.pointer}
             href = @lookandfeel._event_url(:resolve, old_link_format)
           end
+          return nil unless model
+          return nil unless klass
           link = klass.new(:square_patinfo, model, @session, self)
           link.href = href
           link.set_attribute('title', @lookandfeel.lookup(:patinfo))

I am however puzzled why ean13/7680589410013 "Cetirizin Q-generics" appears in the search list, as has neither PI nor FI. It can be found as IKSNR 58941 at swissmedic. Manually importing this number. After the import the links to PI and FI are present. The link to the FI works fine, whereas the link to the PI returned "information not found", till I restarted bin/oddbd.

Pushed commit Avoid nil access

view · edit · sidebar · attach · print · history
Page last modified on September 30, 2013, at 09:15 PM