{"action":"created","comment":{"url":"https://api.github.com/repos/bloomberg/lucene-solr/pulls/comments/75214870","id":75214870,"diff_hunk":"@@ -146,14 +158,87 @@ public SolrQueryRequest getRequest() {\n   @Override\n   public ModelWeight createWeight(IndexSearcher searcher, boolean needsScores, float boost)\n       throws IOException {\n-    final FeatureWeight[] allFeatureWeights = createWeights(meta.getAllFeatures(),\n-        searcher, needsScores);\n-    final FeatureWeight[] modelFeaturesWeights = createWeights(meta.getFeatures(),\n-        searcher, needsScores);\n-\n-    return new ModelWeight(searcher, modelFeaturesWeights, allFeatureWeights);\n+    boolean newCode = true;\n+    if (!newCode){\n+      this.extractAllFeatures = true;\n+      long  start = System.currentTimeMillis();\n+      final FeatureWeight[] allFeatureWeights = createWeights(meta.getAllFeatures(),\n+          searcher, needsScores);\n+      final FeatureWeight[] modelFeaturesWeights = createWeights(meta.getFeatures(),\n+          searcher, needsScores);\n+      long  end = System.currentTimeMillis();\n+      log.info(\"In ModelQuery.java::createWeight() OLD createWeight time:{} ms\", (end-start));\n+      return new ModelWeight(searcher, modelFeaturesWeights, allFeatureWeights, null);\n+    }\n+    else{      \n+      long  start = System.currentTimeMillis();\n+      final Collection<Feature> modelFeatures = meta.getFeatures();\n+      final Collection<Feature> allFeatures = meta.getAllFeatures();\n+          \n+      int modelFeatSize = modelFeatures.size();\n+      int allFeatSize = this.extractAllFeatures ? allFeatures.size() : modelFeatSize;\n+\n+      final FeatureWeight[] extractedFeatureWeights = new FeatureWeight[allFeatSize];\n+      final FeatureWeight[] modelFeaturesWeights = new FeatureWeight[modelFeatSize];\n+      createWeightsSelectively(allFeatures,modelFeatures,searcher, needsScores, extractedFeatureWeights,modelFeaturesWeights); \n+      \n+      int modelFeatIndex = 0;\n+      Normalizer[] modelFeatureNorms = new Normalizer[modelFeatSize]; // store the featureNorms for modelFeatures to use later for normalization\n+      for (final Feature modelFeature: modelFeatures){\n+        modelFeatureNorms[modelFeatIndex++]= modelFeature.getNorm();\n+      }\n+      \n+      long  end = System.currentTimeMillis();\n+      log.info(\"In ModelQuery.java::createWeight() NEW!  createWeight time:{} ms\", (end-start));\n+      \n+      return new ModelWeight(searcher, modelFeaturesWeights, extractedFeatureWeights, modelFeatureNorms);\n+    }\n   }\n-\n+  \n+  private void createWeightsSelectively(Collection<Feature> allFeatures, \n+      Collection<Feature> modelFeatures,\n+      IndexSearcher searcher, boolean needsScores, FeatureWeight[] allFeatureWeights,\n+      FeatureWeight[] modelFeaturesWeights) throws IOException {\n+    long  start = System.currentTimeMillis();\n+    int i = 0, j = 0;\n+    final SolrQueryRequest req = getRequest();\n+    // since the feature store is a linkedhashmap order is preserved\n+    if (this.extractAllFeatures) {\n+      final HashMap<Integer, Feature> modelFeatMap = new HashMap<Integer, Feature>();","path":"solr/contrib/ltr/src/java/org/apache/solr/ltr/ranking/ModelQuery.java","position":96,"original_position":96,"commit_id":"5a1e1ccad559eac06861c4f6fad779c54ca41a55","original_commit_id":"5a1e1ccad559eac06861c4f6fad779c54ca41a55","user":{"login":"mnilsson23","id":16671874,"avatar_url":"https://avatars.githubusercontent.com/u/16671874?v=3","gravatar_id":"","url":"https://api.github.com/users/mnilsson23","html_url":"https://github.com/mnilsson23","followers_url":"https://api.github.com/users/mnilsson23/followers","following_url":"https://api.github.com/users/mnilsson23/following{/other_user}","gists_url":"https://api.github.com/users/mnilsson23/gists{/gist_id}","starred_url":"https://api.github.com/users/mnilsson23/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mnilsson23/subscriptions","organizations_url":"https://api.github.com/users/mnilsson23/orgs","repos_url":"https://api.github.com/users/mnilsson23/repos","events_url":"https://api.github.com/users/mnilsson23/events{/privacy}","received_events_url":"https://api.github.com/users/mnilsson23/received_events","type":"User","site_admin":false},"body":"init all your containers capacity if you know it","created_at":"2016-08-17T21:54:56Z","updated_at":"2016-08-17T21:54:56Z","html_url":"https://github.com/bloomberg/lucene-solr/pull/40#discussion_r75214870","pull_request_url":"https://api.github.com/repos/bloomberg/lucene-solr/pulls/40","_links":{"self":{"href":"https://api.github.com/repos/bloomberg/lucene-solr/pulls/comments/75214870"},"html":{"href":"https://github.com/bloomberg/lucene-solr/pull/40#discussion_r75214870"},"pull_request":{"href":"https://api.github.com/repos/bloomberg/lucene-solr/pulls/40"}}},"pull_request":{"url":"https://api.github.com/repos/bloomberg/lucene-solr/pulls/40","id":80862488,"html_url":"https://github.com/bloomberg/lucene-solr/pull/40","diff_url":"https://github.com/bloomberg/lucene-solr/pull/40.diff","patch_url":"https://github.com/bloomberg/lucene-solr/pull/40.patch","issue_url":"https://api.github.com/repos/bloomberg/lucene-solr/issues/40","number":40,"state":"open","locked":false,"title":"Do not merge - working version - selectively creating allFeatureWeights or modelfeat…","user":{"login":"nsanthapuri","id":20782020,"avatar_url":"https://avatars.githubusercontent.com/u/20782020?v=3","gravatar_id":"","url":"https://api.github.com/users/nsanthapuri","html_url":"https://github.com/nsanthapuri","followers_url":"https://api.github.com/users/nsanthapuri/followers","following_url":"https://api.github.com/users/nsanthapuri/following{/other_user}","gists_url":"https://api.github.com/users/nsanthapuri/gists{/gist_id}","starred_url":"https://api.github.com/users/nsanthapuri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nsanthapuri/subscriptions","organizations_url":"https://api.github.com/users/nsanthapuri/orgs","repos_url":"https://api.github.com/users/nsanthapuri/repos","events_url":"https://api.github.com/users/nsanthapuri/events{/privacy}","received_events_url":"https://api.github.com/users/nsanthapuri/received_events","type":"User","site_admin":false},"body":"…ureWeights to reduce the latency for weight creation","created_at":"2016-08-10T20:33:30Z","updated_at":"2016-08-17T21:54:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1751679006b439c78ac6ad299a7f20da6aeff894","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/bloomberg/lucene-solr/pulls/40/commits","review_comments_url":"https://api.github.com/repos/bloomberg/lucene-solr/pulls/40/comments","review_comment_url":"https://api.github.com/repos/bloomberg/lucene-solr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bloomberg/lucene-solr/issues/40/comments","statuses_url":"https://api.github.com/repos/bloomberg/lucene-solr/statuses/5a1e1ccad559eac06861c4f6fad779c54ca41a55","head":{"label":"nsanthapuri:wgtsForAllORModelFeats","ref":"wgtsForAllORModelFeats","sha":"5a1e1ccad559eac06861c4f6fad779c54ca41a55","user":{"login":"nsanthapuri","id":20782020,"avatar_url":"https://avatars.githubusercontent.com/u/20782020?v=3","gravatar_id":"","url":"https://api.github.com/users/nsanthapuri","html_url":"https://github.com/nsanthapuri","followers_url":"https://api.github.com/users/nsanthapuri/followers","following_url":"https://api.github.com/users/nsanthapuri/following{/other_user}","gists_url":"https://api.github.com/users/nsanthapuri/gists{/gist_id}","starred_url":"https://api.github.com/users/nsanthapuri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nsanthapuri/subscriptions","organizations_url":"https://api.github.com/users/nsanthapuri/orgs","repos_url":"https://api.github.com/users/nsanthapuri/repos","events_url":"https://api.github.com/users/nsanthapuri/events{/privacy}","received_events_url":"https://api.github.com/users/nsanthapuri/received_events","type":"User","site_admin":false},"repo":{"id":64705350,"name":"lucene-solr","full_name":"nsanthapuri/lucene-solr","owner":{"login":"nsanthapuri","id":20782020,"avatar_url":"https://avatars.githubusercontent.com/u/20782020?v=3","gravatar_id":"","url":"https://api.github.com/users/nsanthapuri","html_url":"https://github.com/nsanthapuri","followers_url":"https://api.github.com/users/nsanthapuri/followers","following_url":"https://api.github.com/users/nsanthapuri/following{/other_user}","gists_url":"https://api.github.com/users/nsanthapuri/gists{/gist_id}","starred_url":"https://api.github.com/users/nsanthapuri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nsanthapuri/subscriptions","organizations_url":"https://api.github.com/users/nsanthapuri/orgs","repos_url":"https://api.github.com/users/nsanthapuri/repos","events_url":"https://api.github.com/users/nsanthapuri/events{/privacy}","received_events_url":"https://api.github.com/users/nsanthapuri/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nsanthapuri/lucene-solr","description":"Mirror of Apache Lucene + Solr","fork":true,"url":"https://api.github.com/repos/nsanthapuri/lucene-solr","forks_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/forks","keys_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/teams","hooks_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/hooks","issue_events_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/issues/events{/number}","events_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/events","assignees_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/assignees{/user}","branches_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/branches{/branch}","tags_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/tags","blobs_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/git/refs{/sha}","trees_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/statuses/{sha}","languages_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/languages","stargazers_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/stargazers","contributors_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/contributors","subscribers_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/subscribers","subscription_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/subscription","commits_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/commits{/sha}","git_commits_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/git/commits{/sha}","comments_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/comments{/number}","issue_comment_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/issues/comments{/number}","contents_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/contents/{+path}","compare_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/merges","archive_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/downloads","issues_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/issues{/number}","pulls_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/pulls{/number}","milestones_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/milestones{/number}","notifications_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/labels{/name}","releases_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/releases{/id}","deployments_url":"https://api.github.com/repos/nsanthapuri/lucene-solr/deployments","created_at":"2016-08-01T22:16:33Z","updated_at":"2016-08-01T22:17:06Z","pushed_at":"2016-08-17T21:33:25Z","git_url":"git://github.com/nsanthapuri/lucene-solr.git","ssh_url":"git@github.com:nsanthapuri/lucene-solr.git","clone_url":"https://github.com/nsanthapuri/lucene-solr.git","svn_url":"https://github.com/nsanthapuri/lucene-solr","homepage":null,"size":422496,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"bloomberg:master-ltr-plugin-develop","ref":"master-ltr-plugin-develop","sha":"1a6d391dcbe20be513f01592b8935b587820211e","user":{"login":"bloomberg","id":1416818,"avatar_url":"https://avatars.githubusercontent.com/u/1416818?v=3","gravatar_id":"","url":"https://api.github.com/users/bloomberg","html_url":"https://github.com/bloomberg","followers_url":"https://api.github.com/users/bloomberg/followers","following_url":"https://api.github.com/users/bloomberg/following{/other_user}","gists_url":"https://api.github.com/users/bloomberg/gists{/gist_id}","starred_url":"https://api.github.com/users/bloomberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bloomberg/subscriptions","organizations_url":"https://api.github.com/users/bloomberg/orgs","repos_url":"https://api.github.com/users/bloomberg/repos","events_url":"https://api.github.com/users/bloomberg/events{/privacy}","received_events_url":"https://api.github.com/users/bloomberg/received_events","type":"Organization","site_admin":false},"repo":{"id":50526942,"name":"lucene-solr","full_name":"bloomberg/lucene-solr","owner":{"login":"bloomberg","id":1416818,"avatar_url":"https://avatars.githubusercontent.com/u/1416818?v=3","gravatar_id":"","url":"https://api.github.com/users/bloomberg","html_url":"https://github.com/bloomberg","followers_url":"https://api.github.com/users/bloomberg/followers","following_url":"https://api.github.com/users/bloomberg/following{/other_user}","gists_url":"https://api.github.com/users/bloomberg/gists{/gist_id}","starred_url":"https://api.github.com/users/bloomberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bloomberg/subscriptions","organizations_url":"https://api.github.com/users/bloomberg/orgs","repos_url":"https://api.github.com/users/bloomberg/repos","events_url":"https://api.github.com/users/bloomberg/events{/privacy}","received_events_url":"https://api.github.com/users/bloomberg/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/bloomberg/lucene-solr","description":"Mirror of Apache Lucene + Solr","fork":true,"url":"https://api.github.com/repos/bloomberg/lucene-solr","forks_url":"https://api.github.com/repos/bloomberg/lucene-solr/forks","keys_url":"https://api.github.com/repos/bloomberg/lucene-solr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bloomberg/lucene-solr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bloomberg/lucene-solr/teams","hooks_url":"https://api.github.com/repos/bloomberg/lucene-solr/hooks","issue_events_url":"https://api.github.com/repos/bloomberg/lucene-solr/issues/events{/number}","events_url":"https://api.github.com/repos/bloomberg/lucene-solr/events","assignees_url":"https://api.github.com/repos/bloomberg/lucene-solr/assignees{/user}","branches_url":"https://api.github.com/repos/bloomberg/lucene-solr/branches{/branch}","tags_url":"https://api.github.com/repos/bloomberg/lucene-solr/tags","blobs_url":"https://api.github.com/repos/bloomberg/lucene-solr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bloomberg/lucene-solr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bloomberg/lucene-solr/git/refs{/sha}","trees_url":"https://api.github.com/repos/bloomberg/lucene-solr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bloomberg/lucene-solr/statuses/{sha}","languages_url":"https://api.github.com/repos/bloomberg/lucene-solr/languages","stargazers_url":"https://api.github.com/repos/bloomberg/lucene-solr/stargazers","contributors_url":"https://api.github.com/repos/bloomberg/lucene-solr/contributors","subscribers_url":"https://api.github.com/repos/bloomberg/lucene-solr/subscribers","subscription_url":"https://api.github.com/repos/bloomberg/lucene-solr/subscription","commits_url":"https://api.github.com/repos/bloomberg/lucene-solr/commits{/sha}","git_commits_url":"https://api.github.com/repos/bloomberg/lucene-solr/git/commits{/sha}","comments_url":"https://api.github.com/repos/bloomberg/lucene-solr/comments{/number}","issue_comment_url":"https://api.github.com/repos/bloomberg/lucene-solr/issues/comments{/number}","contents_url":"https://api.github.com/repos/bloomberg/lucene-solr/contents/{+path}","compare_url":"https://api.github.com/repos/bloomberg/lucene-solr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bloomberg/lucene-solr/merges","archive_url":"https://api.github.com/repos/bloomberg/lucene-solr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bloomberg/lucene-solr/downloads","issues_url":"https://api.github.com/repos/bloomberg/lucene-solr/issues{/number}","pulls_url":"https://api.github.com/repos/bloomberg/lucene-solr/pulls{/number}","milestones_url":"https://api.github.com/repos/bloomberg/lucene-solr/milestones{/number}","notifications_url":"https://api.github.com/repos/bloomberg/lucene-solr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bloomberg/lucene-solr/labels{/name}","releases_url":"https://api.github.com/repos/bloomberg/lucene-solr/releases{/id}","deployments_url":"https://api.github.com/repos/bloomberg/lucene-solr/deployments","created_at":"2016-01-27T18:02:47Z","updated_at":"2016-07-29T07:53:43Z","pushed_at":"2016-08-17T21:33:25Z","git_url":"git://github.com/bloomberg/lucene-solr.git","ssh_url":"git@github.com:bloomberg/lucene-solr.git","clone_url":"https://github.com/bloomberg/lucene-solr.git","svn_url":"https://github.com/bloomberg/lucene-solr","homepage":null,"size":441783,"stargazers_count":13,"watchers_count":13,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":9,"forks":11,"open_issues":9,"watchers":13,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bloomberg/lucene-solr/pulls/40"},"html":{"href":"https://github.com/bloomberg/lucene-solr/pull/40"},"issue":{"href":"https://api.github.com/repos/bloomberg/lucene-solr/issues/40"},"comments":{"href":"https://api.github.com/repos/bloomberg/lucene-solr/issues/40/comments"},"review_comments":{"href":"https://api.github.com/repos/bloomberg/lucene-solr/pulls/40/comments"},"review_comment":{"href":"https://api.github.com/repos/bloomberg/lucene-solr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bloomberg/lucene-solr/pulls/40/commits"},"statuses":{"href":"https://api.github.com/repos/bloomberg/lucene-solr/statuses/5a1e1ccad559eac06861c4f6fad779c54ca41a55"}}}}
{"actor":{"display_login":"mnilsson23"}}