Commit 6ff8800
authored
BREAKING: Remove covariance and LINQ use from Grouping, apache#1059 (apache#1066)
* Break GroupingSearch into subclasses, apache#1059
This still needs XML doc comments, but this breaks the GroupingSearch
"god class" into three subclasses that implement a common abstract
class. This should allow us to not need covariant interfaces for the
return types.
In order to randomly switch between these classes with incompatible
generic type arguments, the test shows how you can use a delegate to
work around this limitation.
* Fix failing tests
* Fix more failing unit tests; refactor out common AbstractFieldOrFunctionGroupingSearch<T> class
* Remove IAbstractAllGroupsCollector<T> interface
* Make AbstractAllGroupsCollector.Groups be ICollection, remove some LINQ use
* Remove ITopGroups and IAbstractSecondPassGroupingCollector interfaces
* Remove IGroupDocs interface
* Remove IAbstractFirstPassGroupingCollector and ISearchGroup interfaces, one failing test
* Remove IAbstractDistinctValuesCollector interface
* Remove IGroupCount interface
* Remove IGroupCountCollector interface
* Remove IEnumerable/LINQ use in Grouping
* Remove some O(n) extra list creation
* Remove some more IEnumerable spots
* Refactor to remove wrapping types and add back non-generic interfaces for collectors
* Return null if TopGroups returns null
* Add some XML doc comments
* Add back removed XML comments during refactoring
* Add XML doc comments to GroupingSearch
* Add IAbstractGroupingSearch interface for symmetry with the other types
* Add .idea/ folder to .gitignore
* Remove unnecessary cast
* Remove unnecessary non-generic overload of GetTopGroups
* Use CastingEnumeratorAdapter in CastingListAdapter; optimize as readonly struct to reduce allocations
* Remove UTF-8 BOMs
* Fix fluent API break due to base class; update docs and add tests
* Make ByDocBlock/DocBlockGroupingSearch non-generic to match Java's wildcard generic erasure for null
* Exclude Lucene3x codec from random grouping tests
* Remove setter for ISearchGroup.GroupValue
* Cast each element of CastingSetAdapter instead of casting the whole enumerable
* Remove BOM
* Rename abstract classes and refactor into a template method pattern1 parent 22247b0 commit 6ff8800
34 files changed
Lines changed: 1861 additions & 866 deletions
File tree
- src
- Lucene.Net.Grouping
- Function
- Term
- Lucene.Net.Join
- Support
- Lucene.Net.Tests.Grouping
- Lucene.Net.Tests.Join
- Support
- Lucene.Net/Support
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | | - | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
91 | 100 | | |
92 | 101 | | |
93 | 102 | | |
94 | | - | |
| 103 | + | |
| 104 | + | |
95 | 105 | | |
96 | | - | |
97 | | - | |
| 106 | + | |
98 | 107 | | |
99 | 108 | | |
100 | 109 | | |
101 | | - | |
102 | 110 | | |
103 | | - | |
104 | 111 | | |
105 | 112 | | |
106 | 113 | | |
107 | 114 | | |
108 | | - | |
| 115 | + | |
109 | 116 | | |
110 | 117 | | |
111 | | - | |
112 | 118 | | |
113 | | - | |
114 | | - | |
| 119 | + | |
115 | 120 | | |
116 | 121 | | |
Lines changed: 65 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | | - | |
30 | | - | |
31 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
32 | 55 | | |
33 | 56 | | |
34 | 57 | | |
35 | 58 | | |
36 | 59 | | |
37 | | - | |
| 60 | + | |
38 | 61 | | |
39 | 62 | | |
40 | 63 | | |
| |||
69 | 92 | | |
70 | 93 | | |
71 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
72 | 105 | | |
73 | 106 | | |
74 | 107 | | |
| |||
80 | 113 | | |
81 | 114 | | |
82 | 115 | | |
83 | | - | |
| 116 | + | |
84 | 117 | | |
85 | 118 | | |
86 | 119 | | |
87 | 120 | | |
88 | 121 | | |
89 | | - | |
90 | | - | |
| 122 | + | |
91 | 123 | | |
92 | | - | |
| 124 | + | |
93 | 125 | | |
94 | 126 | | |
95 | | - | |
| 127 | + | |
96 | 128 | | |
97 | 129 | | |
98 | 130 | | |
99 | 131 | | |
100 | 132 | | |
101 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
102 | 148 | | |
103 | 149 | | |
104 | 150 | | |
105 | | - | |
| 151 | + | |
| 152 | + | |
106 | 153 | | |
107 | | - | |
108 | | - | |
| 154 | + | |
109 | 155 | | |
110 | | - | |
111 | | - | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
112 | 159 | | |
113 | 160 | | |
114 | 161 | | |
115 | 162 | | |
116 | | - | |
| 163 | + | |
| 164 | + | |
117 | 165 | | |
118 | | - | |
119 | | - | |
| 166 | + | |
120 | 167 | | |
121 | 168 | | |
122 | 169 | | |
123 | 170 | | |
124 | | - | |
125 | | - | |
| 171 | + | |
126 | 172 | | |
127 | 173 | | |
Lines changed: 26 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | | - | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
| 109 | + | |
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
| 129 | + | |
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| |||
421 | 421 | | |
422 | 422 | | |
423 | 423 | | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
424 | 441 | | |
425 | 442 | | |
426 | 443 | | |
427 | | - | |
428 | | - | |
| 444 | + | |
| 445 | + | |
429 | 446 | | |
430 | | - | |
431 | | - | |
| 447 | + | |
432 | 448 | | |
433 | 449 | | |
434 | 450 | | |
435 | 451 | | |
436 | 452 | | |
437 | 453 | | |
438 | 454 | | |
439 | | - | |
| 455 | + | |
440 | 456 | | |
441 | | - | |
442 | | - | |
443 | | - | |
444 | | - | |
445 | | - | |
| 457 | + | |
446 | 458 | | |
447 | 459 | | |
0 commit comments