You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "alessandrobenedetti (via GitHub)" <gi...@apache.org> on 2023/04/17 14:56:01 UTC

[GitHub] [solr] alessandrobenedetti commented on a diff in pull request #1487: SOLR-15493: Throw an error message if the feature store doesn't exist

alessandrobenedetti commented on code in PR #1487:
URL: https://github.com/apache/solr/pull/1487#discussion_r1168810162


##########
solr/modules/ltr/src/test/org/apache/solr/ltr/feature/TestExternalFeatures.java:
##########
@@ -200,6 +200,16 @@ public void featureExtraction_valueFeatureRequired_shouldThrowException() throws
         "/error/msg=='Exception from createWeight for ValueFeature [name=popularity, params={value=${myPop}, required=true}] ValueFeatureWeight requires efi parameter that was not passed in request.'");
   }
 
+  @Test
+  public void featureExtraction_wrongFeatureStore_shouldThrowException() throws Exception {
+    final SolrQuery query = new SolrQuery();
+    query.setQuery("*:*");
+    query.add("rows", "1");
+    query.add("fl", "fvalias:[fv store=featureStoreWrong]");

Review Comment:
   should this be 'nonExistent' rather than 'wrong' ? 



##########
solr/modules/ltr/src/java/org/apache/solr/ltr/response/transform/LTRFeatureLoggerTransformerFactory.java:
##########
@@ -241,10 +242,31 @@ public void setContext(ResultContext context) {
      *
      * @param transformerFeatureStore the explicit transformer feature store
      */
-    private LoggingModel createLoggingModel(String transformerFeatureStore) {
-      final ManagedFeatureStore fr = ManagedFeatureStore.getManagedFeatureStore(req.getCore());
+    private LoggingModel createLoggingModel(
+        String transformerFeatureStore, Boolean docsWereNotReranked) {
+      final ManagedFeatureStore featureStore =
+          ManagedFeatureStore.getManagedFeatureStore(req.getCore());
+
+      // check for non-existent feature store name
+      if (transformerFeatureStore != null) {
+        if (!featureStore.getStores().containsKey(transformerFeatureStore)) {

Review Comment:
   do we need this? isn't this already in the  'final FeatureStore store = featureStore.getFeatureStore(transformerFeatureStore);' ?
   
   Do we even need 'featureStore.getStores()' ?



##########
solr/modules/ltr/src/test/org/apache/solr/ltr/feature/TestFeatureLogging.java:
##########
@@ -125,6 +126,11 @@ public void testDefaultStoreFeatureExtraction() throws Exception {
             + FeatureLoggerTestUtils.toFeatureVector("defaultf1", "1.0")
             + "'}");
 
+    // Wrong store specified, should throw exception
+    query.remove("fl");
+    query.add("fl", "fv:[fv store=storeWrong]");

Review Comment:
   should it be 'nonExistent' ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org