Skip to content

Commit 0f216eb

Browse files
committed
Merge branch 'develop'
2 parents 4c4fb06 + 0fe8b6c commit 0f216eb

12 files changed

+46
-172
lines changed

src/Our.Umbraco.Look/Facet.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
public class Facet
44
{
55
/// <summary>
6-
/// The tags that would be added into the TagQuery.All clause
6+
/// The tags that would be added into the TagQuery.HasAll clause
77
/// </summary>
88
public LookTag[] Tags { get; internal set; }
99

src/Our.Umbraco.Look/LookIndexer.cs

+24-154
Original file line numberDiff line numberDiff line change
@@ -60,148 +60,6 @@ protected override void PerformIndexAll(string type)
6060
{
6161
}
6262

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-
20563
/// <summary>
20664
/// index all supplied nodes (and their detached content)
20765
/// </summary>
@@ -231,30 +89,42 @@ internal void Index(IEnumerable<IPublishedContent> nodes)
23189
indexWriter.AddDocument(document);
23290
}
23391

234-
foreach (var detachedNode in node.GetDetachedDescendants())
92+
try // SEOChecker prior to 2.2 doesn't handle IPublishedContent without an ID
23593
{
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);
240100

241-
document = new Document();
101+
document = new Document();
242102

243-
LookService.Index(indexingContext, document);
103+
LookService.Index(indexingContext, document);
244104

245-
if (!indexingContext.Cancelled)
246-
{
247-
counter++;
105+
if (!indexingContext.Cancelled)
106+
{
107+
counter++;
248108

249-
indexWriter.AddDocument(document); // index each detached item
109+
indexWriter.AddDocument(document); // index each detached item
110+
}
250111
}
251112
}
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+
}
252118
}
253119

254120
indexWriter.Commit();
255121

256122
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+
}
258128
}
259129
}
260130
}

src/Our.Umbraco.Look/Services/LookService_Index.cs

+5-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ internal static void Index(IndexingContext indexingContext, Document document)
4848
}
4949

5050
stopwatch.Stop();
51-
LogHelper.Debug(typeof(LookService), $"Building Lucene Document For '{ indexingContext.Item.GetGuidKey() }' Took { stopwatch.ElapsedMilliseconds }ms");
51+
52+
if (!indexingContext.Cancelled)
53+
{
54+
LogHelper.Debug(typeof(LookService), $"Building Lucene Document For '{ indexingContext.Item.GetGuidKey() }' Took { stopwatch.ElapsedMilliseconds }ms");
55+
}
5256
}
5357
}
5458
}

src/Our.Umbraco.Look/Services/LookService_ParseDateQuery.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ internal partial class LookService
1414
/// </summary>
1515
/// <param name="lookQuery">The query to parse</param>
1616
/// <param name="parsingContext"></param>
17-
private static void ParseDateQuery(LookQuery lookQuery, ParsingContext parsingContext)
17+
private static void ParseDateQuery(ParsingContext parsingContext, LookQuery lookQuery)
1818
{
1919
// handle sorting first, as date query clause not required for a date sort
2020
switch (lookQuery.SortOn)

src/Our.Umbraco.Look/Services/LookService_ParseExamineQuery.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ internal partial class LookService
1111
/// </summary>
1212
/// <param name="lookQuery">The query to parse</param>
1313
/// <param name="parsingContext"></param>
14-
private static void ParseExamineQuery(LookQuery lookQuery, ParsingContext parsingContext)
14+
private static void ParseExamineQuery(ParsingContext parsingContext, LookQuery lookQuery)
1515
{
1616
if (lookQuery.ExamineQuery == null) return;
1717

src/Our.Umbraco.Look/Services/LookService_ParseLocationQuery.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ internal partial class LookService
1414
/// </summary>
1515
/// <param name="lookQuery">The query to parse</param>
1616
/// <param name="parsingContext"></param>
17-
private static void ParseLocationQuery(LookQuery lookQuery, ParsingContext parsingContext)
17+
private static void ParseLocationQuery(ParsingContext parsingContext, LookQuery lookQuery)
1818
{
1919
if (lookQuery.LocationQuery == null) return;
2020

src/Our.Umbraco.Look/Services/LookService_ParseNameQuery.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ internal partial class LookService
1313
/// </summary>
1414
/// <param name="lookQuery">The query to parse</param>
1515
/// <param name="parsingContext"></param>
16-
private static void ParseNameQuery(LookQuery lookQuery, ParsingContext parsingContext)
16+
private static void ParseNameQuery(ParsingContext parsingContext, LookQuery lookQuery)
1717
{
1818
// handle sorting first, as name query clause not required for a name sort
1919
if (lookQuery.SortOn == SortOn.Name) // a -> z

src/Our.Umbraco.Look/Services/LookService_ParseNodeQuery.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ internal partial class LookService
1414
/// </summary>
1515
/// <param name="lookQuery">The query to parse</param>
1616
/// <param name="parsingContext"></param>
17-
private static void ParseNodeQuery(LookQuery lookQuery, ParsingContext parsingContext)
17+
private static void ParseNodeQuery(ParsingContext parsingContext, LookQuery lookQuery)
1818
{
1919
if (lookQuery.NodeQuery == null) return;
2020

src/Our.Umbraco.Look/Services/LookService_ParseRawQuery.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ internal partial class LookService
1111
/// </summary>
1212
/// <param name="lookQuery">The query to parse</param>
1313
/// <param name="parsingContext"></param>
14-
private static void ParseRawQuery(LookQuery lookQuery, ParsingContext parsingContext)
14+
private static void ParseRawQuery(ParsingContext parsingContext, LookQuery lookQuery)
1515
{
1616
if (string.IsNullOrWhiteSpace(lookQuery.RawQuery)) return;
1717

src/Our.Umbraco.Look/Services/LookService_ParseTagQuery.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ internal partial class LookService
1212
/// </summary>
1313
/// <param name="lookQuery">The query to parse</param>
1414
/// <param name="parsingContext"></param>
15-
private static void ParseTagQuery(LookQuery lookQuery, ParsingContext parsingContext)
15+
private static void ParseTagQuery(ParsingContext parsingContext, LookQuery lookQuery)
1616
{
1717
if (lookQuery.TagQuery == null) return;
1818

src/Our.Umbraco.Look/Services/LookService_ParseTextQuery.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ internal partial class LookService
1616
/// </summary>
1717
/// <param name="lookQuery">The query to parse</param>
1818
/// <param name="parsingContext"></param>
19-
private static void ParseTextQuery(LookQuery lookQuery, ParsingContext parsingContext)
19+
private static void ParseTextQuery(ParsingContext parsingContext, LookQuery lookQuery)
2020
{
2121
if (lookQuery.TextQuery == null) return;
2222

src/Our.Umbraco.Look/Services/LookService_Search.cs

+8-8
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,21 @@ internal static LookResult Search(LookQuery lookQuery)
3838

3939
try
4040
{
41-
LookService.ParseRawQuery(lookQuery, parsingContext);
41+
LookService.ParseRawQuery(parsingContext, lookQuery);
4242

43-
LookService.ParseExamineQuery(lookQuery, parsingContext);
43+
LookService.ParseExamineQuery(parsingContext, lookQuery);
4444

45-
LookService.ParseNodeQuery(lookQuery, parsingContext);
45+
LookService.ParseNodeQuery(parsingContext, lookQuery);
4646

47-
LookService.ParseNameQuery(lookQuery, parsingContext);
47+
LookService.ParseNameQuery(parsingContext, lookQuery);
4848

49-
LookService.ParseDateQuery(lookQuery, parsingContext);
49+
LookService.ParseDateQuery(parsingContext, lookQuery);
5050

51-
LookService.ParseTextQuery(lookQuery, parsingContext);
51+
LookService.ParseTextQuery(parsingContext, lookQuery);
5252

53-
LookService.ParseTagQuery(lookQuery, parsingContext);
53+
LookService.ParseTagQuery(parsingContext, lookQuery);
5454

55-
LookService.ParseLocationQuery(lookQuery, parsingContext);
55+
LookService.ParseLocationQuery(parsingContext, lookQuery);
5656
}
5757
catch (ParsingException parsingException)
5858
{

0 commit comments

Comments
 (0)