Repository: vespa-engine/vespa
Issue: bm25 does not give any relevance score for fields defined outside the document

/search/?yql=select%20*%20from%20sources%20*%20where%20titlebest%20contains%20"best"%3B&ranking=titlebest 
=>
`"relevance": 0,`

/search/?yql=select%20*%20from%20sources%20*%20where%20title%20contains%20"best"%3B&ranking=title
=>
`"relevance": 0.31872690041420326,`


Schema:
```
schema music {
    document music {
    field title type string {
      indexing: summary | index
      index: enable-bm25
    }
  }    
 field titlebest type string {
    stemming: best
    indexing: input title | summary | index
    index: enable-bm25
  }
  rank-profile title {
    first-phase {
      expression: bm25(title)
    }
  }
  rank-profile titlebest {`
    first-phase {
      expression: bm25(titlebest)
    }
  }
}
```

Changed files:
config-model/src/main/java/com/yahoo/searchdefinition/Search.java, config-model/src/test/java/com/yahoo/searchdefinition/IndexSettingsTestCase.java

diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/Search.java b/config-model/src/main/java/com/yahoo/searchdefinition/Search.java
index 0ab8a2308a4..3a60a75f75f 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/Search.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/Search.java
@@ -394,6 +394,9 @@ public class Search implements ImmutableSearch {
             if (current.isPrefix()) {
                 consolidated.setPrefix(true);
             }
+            if (current.useInterleavedFeatures()) {
+                consolidated.setInterleavedFeatures(true);
+            }
 
             if (consolidated.getRankType() == null) {
                 consolidated.setRankType(current.getRankType());
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/IndexSettingsTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/IndexSettingsTestCase.java
index f992d5ee0ba..1734c58ddc9 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/IndexSettingsTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/IndexSettingsTestCase.java
@@ -8,7 +8,9 @@ import org.junit.Test;
 
 import java.io.IOException;
 
+import static com.yahoo.config.model.test.TestUtil.joinLines;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 /**
  * Rank settings
@@ -34,4 +36,27 @@ public class IndexSettingsTestCase extends SchemaTestCase {
         assertEquals(Stemming.MULTIPLE, multiStemmed.getStemming(search));
     }
 
+    @Test
+    public void requireThatInterlavedFeaturesAreSetOnExtraField() throws ParseException {
+        SearchBuilder builder = SearchBuilder.createFromString(joinLines(
+                "search test {",
+                "  document test {",
+                "    field content type string {",
+                "      indexing: index | summary",
+                "      index: enable-bm25",
+                "    }",
+                "  }",
+                "  field extra type string {",
+                "    indexing: input content | index | summary",
+                "    index: enable-bm25",
+                "  }",
+                "}"
+        ));
+        Search search = builder.getSearch();
+        Index contentIndex = search.getIndex("content");
+        assertTrue(contentIndex.useInterleavedFeatures());
+        Index extraIndex = search.getIndex("extra");
+        assertTrue(extraIndex.useInterleavedFeatures());
+    }
+
 }