@@ -62,6 +62,74 @@ func TestSearchSpecWithOptions_TreeModeReturnsLeafBeforeAncestors(t *testing.T)
6262 }
6363}
6464
65+ func TestDrillDownRouteSeedsStayAheadOfFTSLeaves (t * testing.T ) {
66+ section := func (patternID string , parentPatternID string ) drillDownSection {
67+ return drillDownSection {
68+ PatternID : patternID ,
69+ Heading : patternID ,
70+ Summary : patternID ,
71+ ParentPatternID : parentPatternID ,
72+ }
73+ }
74+
75+ branches := []drillDownBranch {
76+ {
77+ LeafPatternID : "A.6.3.CR" ,
78+ Path : []drillDownSection {
79+ section ("A.6.3.CR" , "" ),
80+ },
81+ Score : 4 ,
82+ SeedOrder : 0 ,
83+ SeedTier : SpecSearchTierPattern ,
84+ },
85+ {
86+ LeafPatternID : "E.17.EFP" ,
87+ Path : []drillDownSection {
88+ section ("E.17.EFP" , "" ),
89+ },
90+ Score : 3 ,
91+ SeedOrder : 1 ,
92+ SeedTier : SpecSearchTierPattern ,
93+ },
94+ {
95+ LeafPatternID : "A.6.3" ,
96+ Path : []drillDownSection {
97+ section ("A.6.3" , "" ),
98+ },
99+ Score : 2 ,
100+ SeedOrder : 2 ,
101+ SeedTier : SpecSearchTierPattern ,
102+ },
103+ {
104+ LeafPatternID : "A.6.3.RT" ,
105+ Path : []drillDownSection {
106+ section ("A.6.3.RT" , "" ),
107+ },
108+ Score : 1 ,
109+ SeedOrder : 3 ,
110+ SeedTier : SpecSearchTierPattern ,
111+ },
112+ {
113+ LeafPatternID : "A.6.3.CR:2" ,
114+ Path : []drillDownSection {
115+ section ("A.6.3.CR:2" , "A.6.3.CR" ),
116+ section ("A.6.3.CR" , "" ),
117+ },
118+ Score : 1000 ,
119+ SeedOrder : 4 ,
120+ SeedTier : SpecSearchTierFTS ,
121+ },
122+ }
123+
124+ sortDrillDownBranches (branches )
125+ results := buildDrillDownResults (branches , 4 )
126+ got := resultPatternIDs (results )
127+ want := []string {"A.6.3.CR" , "E.17.EFP" , "A.6.3" , "A.6.3.RT" }
128+ if ! reflect .DeepEqual (got , want ) {
129+ t .Fatalf ("drill-down results = %v, want %v" , got , want )
130+ }
131+ }
132+
65133func TestSearchSpecWithOptions_DrillDownTierFilterKeepsOnlyExperimentalHits (t * testing.T ) {
66134 chunks := []SpecChunk {
67135 {
0 commit comments