view · edit · sidebar · attach · print · history

20120801-create-instant-search-for-rezept

<< | Index | >>


Summary

  • Created Instant-Search new API for Prescription.
  • Stopped Random-Updater in main process.

Commits

Index


Create Ajax API for Instant Search in Rezept Form

Ajax API by index (Instant Serach in Toppage)

/de/gcc/ajax_matches/index_name/oddb_package_name_with_size

In Rezept-Form reeds ean13 codes also.(like oddb_package_name_with_size_and_ean13)

Index definition

tried rebuild_index in oddbapp.rb with /etc/index_definitions.yaml

ch.oddb> rebuild_indices 'atc_index'
-> 

dropping: atc_index
creating: atc_index
filling: atc_index
@atc_classes.values
source.size: 7430
finished in 1.62489233965 min

created index_definition.

src/model/package.rb
    def name_with_size_and_ean13
      [name_with_size, barcode].join(', ')
    end
--- !ruby/object:ODBA::IndexDefinition 
index_name: 'oddb_package_name_with_size_and_ean13'
origin_klass: 'ODDB::Package'
target_klass: 'ODDB::Package'
resolve_search_term: 'name_with_size_and_ean13'
resolve_target: ''
resolve_origin: ''
init_source: 'self.packages'
fulltext: false
ch.oddb> rebuild_indices 'oddb_package_name_with_size_and_ean13'

dropping: oddb_package_name_with_size_and_ean13
ERROR:  table "oddb_package_name_with_size_and_ean13" does not exist
creating: oddb_package_name_with_size_and_ean13
filling: oddb_package_name_with_size_and_ean13
self.packages
source.size: 23768
finished in 10.894559743933334 min
all Indices Created in total: 0.18157658948972225 h

Note

odba/lib/odba/index.rb

   def fill(targets)
      @proc_origin = nil 
      rows = []
      targets.flatten.each { |target|
        target_id = target.odba_id
        origins = proc_instance_origin.call(target)
        origins.each { |origin|
          search_terms(origin).each { |term|
            do_update_index( origin.odba_id, term, target_id)
          }   
        }   
      }   
    end

Refs


Create add-drug api

/de/gcc/ajax_add_drug/state_id/51689280/ean13/7680586370044

Updated api response.

[

  {
    "drug":"indamid sr, 28 tablette(n)", # => label
    "search_query":"7680584630058"       # => name
  },{
     "drug":"indamid sr, 30 tablette(n)",
     "search_query":"7680584630065"
  },{
   ...

Refs


Moved text_info updater

Stoped Random Updater in oddbapp.rb
moved text_info_news updater into import_daily job.

in src/util/oddbapp.rb
  RUN_UPDATER = false
commit
view · edit · sidebar · attach · print · history
Page last modified on August 01, 2012, at 01:41 PM