Loading Rakefile +6 −0 Original line number Diff line number Diff line Loading @@ -159,6 +159,11 @@ class JsDuckRunner add_options("--comments-domain", db_name+"/"+version) end def add_search(product, version) add_options("--search-url", "http://support-test.sencha.com:8080/docsearch/search") add_options("--search-domain", product+"/"+version) end def add_ext4 @options += [ "--title", "Sencha Docs - Ext JS 4.0", Loading Loading @@ -261,6 +266,7 @@ task :sdk => :sass do ) runner.add_debug runner.add_comments('ext-js', '4') runner.add_search('Ext JS', '4.2.0') runner.run system("ln -s #{EXT_BUILD} #{OUT_DIR}/extjs-build") Loading lib/jsduck/app_data.rb +2 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,8 @@ module JsDuck :guides => @assets.guides.to_array, :videos => @assets.videos.to_array, :examples => @assets.examples.to_array, :search => SearchData.new.create(@relations.classes, @assets), :search => SearchData.new.create(@relations.classes, @assets, @opts), :guideSearch => @opts.search, :tests => @opts.tests, :signatures => MetaTagRegistry.instance.signatures, :localStorageDb => @opts.local_storage_db, Loading lib/jsduck/options.rb +31 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ module JsDuck attr_accessor :tests attr_accessor :comments_url attr_accessor :comments_domain attr_accessor :search attr_accessor :ignore_html # Debugging Loading Loading @@ -120,6 +121,7 @@ module JsDuck @tests = false @comments_url = nil @comments_domain = nil @search = {} @ignore_html = {} # Debugging Loading Loading @@ -434,6 +436,35 @@ module JsDuck @comments_domain = domain end opts.on('--search-url=URL', "Address of guides search server server.", "", "When supplied, the search for guides is performed through this", "external service and the results merged together with API search.", "The search server must respond to JSONP requests.", "", "For example: http://sencha.com/docsearch", "", "Must be used together with --search-domain option.", "", "This option is EXPERIMENTAL.") do |url| @search[:url] = url end opts.on('--search-domain=STRING', "A string consisting of <name>/<version>.", "", "Tells the search engine which product and version", "to include into search.", "", "For example: Ext JS/4.2.0", "", "Must be used together with --search-url option.", "", "This option is EXPERIMENTAL.") do |domain| @search[:product], @search[:version] = domain.slice(/\//) end opts.separator "" opts.separator "Tweaking:" opts.separator "" Loading lib/jsduck/search_data.rb +3 −2 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ module JsDuck class SearchData # Given list of classes and other assets, returns an array of # hashes describing the search data. def create(classes, assets) def create(classes, assets, opts) list = [] classes.each do |cls| Loading @@ -30,7 +30,8 @@ module JsDuck end end assets.guides.each_item {|g| list << guide_node(g) } # Don't include guides data when separate guides search engine is provided assets.guides.each_item {|g| list << guide_node(g) } unless opts.search[:url] assets.videos.each_item {|v| list << video_node(v) } Loading template/app/ClassRegistry.js +20 −1 Original line number Diff line number Diff line Loading @@ -66,10 +66,12 @@ Ext.define("Docs.ClassRegistry", { * 59 middle removed guide * * @param {String} text The query string to search for * @param {Object[]} [guides] Results of guides search, to be * combined with the results of API search. * @return {Object[]} array of the matching items from Docs.search.data * ordered by best matches first. */ search: function(text) { search: function(text, guides) { // Each record has 1 of 5 possible sorting orders, var nSort = 5; // which is *4 by it being public/deprecated/private/removed, Loading @@ -93,6 +95,23 @@ Ext.define("Docs.ClassRegistry", { var adjPri = nSort * 2; var adjRem = nSort * 3; // When guides given, populate the result fields with them if (guides) { var guidePos = 4; for (var i=0; i<guides.length; i++) { var g = guides[i]; if (g.score > 5) { results[guidePos + adjPub + adjFul].push(g); } else if (g.score > 1) { results[guidePos + adjPub + adjBeg].push(g); } else { results[guidePos + adjPub + adjMid].push(g); } } } var searchFull = /[.:]/.test(text); var safeText = Ext.escapeRe(text); var reFull = new RegExp("^" + safeText + "$", "i"); Loading Loading
Rakefile +6 −0 Original line number Diff line number Diff line Loading @@ -159,6 +159,11 @@ class JsDuckRunner add_options("--comments-domain", db_name+"/"+version) end def add_search(product, version) add_options("--search-url", "http://support-test.sencha.com:8080/docsearch/search") add_options("--search-domain", product+"/"+version) end def add_ext4 @options += [ "--title", "Sencha Docs - Ext JS 4.0", Loading Loading @@ -261,6 +266,7 @@ task :sdk => :sass do ) runner.add_debug runner.add_comments('ext-js', '4') runner.add_search('Ext JS', '4.2.0') runner.run system("ln -s #{EXT_BUILD} #{OUT_DIR}/extjs-build") Loading
lib/jsduck/app_data.rb +2 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,8 @@ module JsDuck :guides => @assets.guides.to_array, :videos => @assets.videos.to_array, :examples => @assets.examples.to_array, :search => SearchData.new.create(@relations.classes, @assets), :search => SearchData.new.create(@relations.classes, @assets, @opts), :guideSearch => @opts.search, :tests => @opts.tests, :signatures => MetaTagRegistry.instance.signatures, :localStorageDb => @opts.local_storage_db, Loading
lib/jsduck/options.rb +31 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ module JsDuck attr_accessor :tests attr_accessor :comments_url attr_accessor :comments_domain attr_accessor :search attr_accessor :ignore_html # Debugging Loading Loading @@ -120,6 +121,7 @@ module JsDuck @tests = false @comments_url = nil @comments_domain = nil @search = {} @ignore_html = {} # Debugging Loading Loading @@ -434,6 +436,35 @@ module JsDuck @comments_domain = domain end opts.on('--search-url=URL', "Address of guides search server server.", "", "When supplied, the search for guides is performed through this", "external service and the results merged together with API search.", "The search server must respond to JSONP requests.", "", "For example: http://sencha.com/docsearch", "", "Must be used together with --search-domain option.", "", "This option is EXPERIMENTAL.") do |url| @search[:url] = url end opts.on('--search-domain=STRING', "A string consisting of <name>/<version>.", "", "Tells the search engine which product and version", "to include into search.", "", "For example: Ext JS/4.2.0", "", "Must be used together with --search-url option.", "", "This option is EXPERIMENTAL.") do |domain| @search[:product], @search[:version] = domain.slice(/\//) end opts.separator "" opts.separator "Tweaking:" opts.separator "" Loading
lib/jsduck/search_data.rb +3 −2 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ module JsDuck class SearchData # Given list of classes and other assets, returns an array of # hashes describing the search data. def create(classes, assets) def create(classes, assets, opts) list = [] classes.each do |cls| Loading @@ -30,7 +30,8 @@ module JsDuck end end assets.guides.each_item {|g| list << guide_node(g) } # Don't include guides data when separate guides search engine is provided assets.guides.each_item {|g| list << guide_node(g) } unless opts.search[:url] assets.videos.each_item {|v| list << video_node(v) } Loading
template/app/ClassRegistry.js +20 −1 Original line number Diff line number Diff line Loading @@ -66,10 +66,12 @@ Ext.define("Docs.ClassRegistry", { * 59 middle removed guide * * @param {String} text The query string to search for * @param {Object[]} [guides] Results of guides search, to be * combined with the results of API search. * @return {Object[]} array of the matching items from Docs.search.data * ordered by best matches first. */ search: function(text) { search: function(text, guides) { // Each record has 1 of 5 possible sorting orders, var nSort = 5; // which is *4 by it being public/deprecated/private/removed, Loading @@ -93,6 +95,23 @@ Ext.define("Docs.ClassRegistry", { var adjPri = nSort * 2; var adjRem = nSort * 3; // When guides given, populate the result fields with them if (guides) { var guidePos = 4; for (var i=0; i<guides.length; i++) { var g = guides[i]; if (g.score > 5) { results[guidePos + adjPub + adjFul].push(g); } else if (g.score > 1) { results[guidePos + adjPub + adjBeg].push(g); } else { results[guidePos + adjPub + adjMid].push(g); } } } var searchFull = /[.:]/.test(text); var safeText = Ext.escapeRe(text); var reFull = new RegExp("^" + safeText + "$", "i"); Loading