@@ -60,148 +60,6 @@ protected override void PerformIndexAll(string type)
60
60
{
61
61
}
62
62
63
- //protected override void AddDocument(Dictionary<string, string> fields, IndexWriter writer, int nodeId, string type)
64
- //{
65
- // base.AddDocument(fields, writer, nodeId, type);
66
- //}
67
-
68
- //protected override void AddSingleNodeToIndex(XElement node, string type)
69
- //{
70
- // base.AddSingleNodeToIndex(node, type);
71
- //}
72
-
73
- //protected override IndexWriter CreateIndexWriter()
74
- //{
75
- // var debug = base.CreateIndexWriter();
76
- // return debug;
77
- //}
78
-
79
- //public override void DeleteFromIndex(string nodeId)
80
- //{
81
- // base.DeleteFromIndex(nodeId);
82
- //}
83
-
84
- //protected override Dictionary<string, string> GetDataToIndex(XElement node, string type)
85
- //{
86
- // var debug = base.GetDataToIndex(node, type);
87
- // return debug;
88
- //}
89
-
90
- //protected override IIndexCriteria GetIndexerData(IndexSet indexSet)
91
- //{
92
- // var debug = base.GetIndexerData(indexSet);
93
- // return debug;
94
- //}
95
-
96
- //public override Directory GetLuceneDirectory()
97
- //{
98
- // var debug = base.GetLuceneDirectory();
99
- // return debug;
100
- //}
101
-
102
- //protected override FieldIndexTypes GetPolicy(string fieldName)
103
- //{
104
- // var debug = base.GetPolicy(fieldName);
105
- // return debug;
106
- //}
107
-
108
- //protected override Dictionary<string, string> GetSpecialFieldsToIndex(Dictionary<string, string> allValuesForIndexing)
109
- //{
110
- // var debug = base.GetSpecialFieldsToIndex(allValuesForIndexing);
111
- // return debug;
112
- //}
113
-
114
- //public override void IndexAll(string type)
115
- //{
116
- // base.IndexAll(type);
117
- //}
118
-
119
- //public override bool IndexExists()
120
- //{
121
- // var debug = base.IndexExists();
122
- // return debug;
123
- //}
124
-
125
- //protected override void OnDocumentWriting(DocumentWritingEventArgs docArgs)
126
- //{
127
- // base.OnDocumentWriting(docArgs);
128
- //}
129
-
130
- //protected override void OnDuplicateFieldWarning(int nodeId, string indexSetName, string fieldName)
131
- //{
132
- // base.OnDuplicateFieldWarning(nodeId, indexSetName, fieldName);
133
- //}
134
-
135
- //protected override void OnGatheringFieldData(IndexingFieldDataEventArgs e)
136
- //{
137
- // base.OnGatheringFieldData(e);
138
- //}
139
-
140
- //protected override void OnGatheringNodeData(IndexingNodeDataEventArgs e)
141
- //{
142
- // base.OnGatheringNodeData(e);
143
- //}
144
-
145
- //protected override void OnIgnoringNode(IndexingNodeDataEventArgs e)
146
- //{
147
- // base.OnIgnoringNode(e);
148
- //}
149
-
150
- //protected override void OnIndexDeleted(DeleteIndexEventArgs e)
151
- //{
152
- // base.OnIndexDeleted(e);
153
- //}
154
-
155
- //protected override void OnIndexingError(IndexingErrorEventArgs e)
156
- //{
157
- // base.OnIndexingError(e);
158
- //}
159
-
160
- //protected override void OnIndexOperationComplete(EventArgs e)
161
- //{
162
- // base.OnIndexOperationComplete(e);
163
- //}
164
-
165
- //protected override void OnIndexOptimized(EventArgs e)
166
- //{
167
- // base.OnIndexOptimized(e);
168
- //}
169
-
170
- //protected override void OnIndexOptimizing(EventArgs e)
171
- //{
172
- // base.OnIndexOptimizing(e);
173
- //}
174
-
175
- //protected override void OnNodeIndexed(IndexedNodeEventArgs e)
176
- //{
177
- // base.OnNodeIndexed(e);
178
- //}
179
-
180
- //protected override void OnNodeIndexing(IndexingNodeEventArgs e)
181
- //{
182
- // base.OnNodeIndexing(e);
183
- //}
184
-
185
- //protected override void OnNodesIndexed(IndexedNodesEventArgs e)
186
- //{
187
- // base.OnNodesIndexed(e);
188
- //}
189
-
190
- //protected override void OnNodesIndexing(IndexingNodesEventArgs e)
191
- //{
192
- // base.OnNodesIndexing(e);
193
- //}
194
-
195
- //public override void ReIndexNode(XElement node, string type)
196
- //{
197
- // base.ReIndexNode(node, type);
198
- //}
199
-
200
- //protected override bool ValidateDocument(XElement node)
201
- //{
202
- // return base.ValidateDocument(node);
203
- //}
204
-
205
63
/// <summary>
206
64
/// index all supplied nodes (and their detached content)
207
65
/// </summary>
@@ -231,30 +89,42 @@ internal void Index(IEnumerable<IPublishedContent> nodes)
231
89
indexWriter . AddDocument ( document ) ;
232
90
}
233
91
234
- foreach ( var detachedNode in node . GetDetachedDescendants ( ) )
92
+ try // SEOChecker prior to 2.2 doesn't handle IPublishedContent without an ID
235
93
{
236
- indexingContext = new IndexingContext (
237
- hostNode : node ,
238
- node : detachedNode ,
239
- indexerName : this . Name ) ;
94
+ foreach ( var detachedNode in node . GetDetachedDescendants ( ) )
95
+ {
96
+ indexingContext = new IndexingContext (
97
+ hostNode : node ,
98
+ node : detachedNode ,
99
+ indexerName : this . Name ) ;
240
100
241
- document = new Document ( ) ;
101
+ document = new Document ( ) ;
242
102
243
- LookService . Index ( indexingContext , document ) ;
103
+ LookService . Index ( indexingContext , document ) ;
244
104
245
- if ( ! indexingContext . Cancelled )
246
- {
247
- counter ++ ;
105
+ if ( ! indexingContext . Cancelled )
106
+ {
107
+ counter ++ ;
248
108
249
- indexWriter . AddDocument ( document ) ; // index each detached item
109
+ indexWriter . AddDocument ( document ) ; // index each detached item
110
+ }
250
111
}
251
112
}
113
+ catch ( Exception exception )
114
+ {
115
+ //LogHelper.WarnWithException(typeof(LookIndexer), "Error handling Detached items", exception);
116
+ LogHelper . Debug ( typeof ( LookIndexer ) , "Error handling detached items" ) ;
117
+ }
252
118
}
253
119
254
120
indexWriter . Commit ( ) ;
255
121
256
122
stopwatch . Stop ( ) ;
257
- LogHelper . Debug ( typeof ( LookService ) , $ "Indexing { counter } Item(s) Took { stopwatch . ElapsedMilliseconds } ms") ;
123
+
124
+ if ( counter > 0 )
125
+ {
126
+ LogHelper . Debug ( typeof ( LookIndexer ) , $ "Indexing { counter } Item(s) Took { stopwatch . ElapsedMilliseconds } ms") ;
127
+ }
258
128
}
259
129
}
260
130
}
0 commit comments