Skip to content

Commit

Permalink
removes IIndexOperation as its not needed, along with LazyIndexOperat…
Browse files Browse the repository at this point in the history
…ion since the enumeration is happening lazily now anyways., bumps version.
  • Loading branch information
Shazwazza committed Jul 23, 2015
1 parent 4f7984f commit 6249a40
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 67 deletions.
2 changes: 0 additions & 2 deletions Projects/Examine/Examine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@
<Compile Include="Enforcer.cs" />
<Compile Include="IIndexCriteria.cs" />
<Compile Include="IIndexField.cs" />
<Compile Include="IIndexOperation.cs" />
<Compile Include="IndexCriteria.cs" />
<Compile Include="IndexedNode.cs" />
<Compile Include="IndexedNodesEventArgs.cs" />
Expand All @@ -125,7 +124,6 @@
<Compile Include="IndexSetExtensions.cs" />
<Compile Include="INodeEventArgs.cs" />
<Compile Include="ISearchResults.cs" />
<Compile Include="LazyIndexOperation.cs" />
<Compile Include="LuceneEngine\LocalTempStorageIndexer.cs" />
<Compile Include="LuceneEngine\AllHitsCollector.cs" />
<Compile Include="LuceneEngine\Config\ExamineLuceneIndexes.cs" />
Expand Down
18 changes: 0 additions & 18 deletions Projects/Examine/IIndexOperation.cs

This file was deleted.

15 changes: 14 additions & 1 deletion Projects/Examine/IndexOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,21 @@ namespace Examine
/// <summary>
/// Represents an indexing operation (either add/remove)
/// </summary>
public class IndexOperation : IIndexOperation
public class IndexOperation
{
public IndexOperation()
{
}

/// <summary>
/// Initializes a new instance of the <see cref="T:System.Object"/> class.
/// </summary>
public IndexOperation(IndexItem item, IndexOperationType operation)
{
Item = item;
Operation = operation;
}

/// <summary>
/// Gets the Index item
/// </summary>
Expand Down
32 changes: 0 additions & 32 deletions Projects/Examine/LazyIndexOperation.cs

This file was deleted.

22 changes: 11 additions & 11 deletions Projects/Examine/LuceneEngine/Providers/LuceneIndexer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ public override void Initialize(string name, NameValueCollection config)
/// <remarks>
/// Each item in the collection is a collection itself, this allows us to have lazy access to a collection as part of the queue if added in bulk
/// </remarks>
private readonly BlockingCollection<IEnumerable<IIndexOperation>> _indexQueue = new BlockingCollection<IEnumerable<IIndexOperation>>();
private readonly BlockingCollection<IEnumerable<IndexOperation>> _indexQueue = new BlockingCollection<IEnumerable<IndexOperation>>();

/// <summary>
/// The async task that runs during an async indexing operation
Expand Down Expand Up @@ -654,7 +654,7 @@ public void EnsureIndex(bool forceOverwrite)
_cancellationTokenSource.Cancel();

//clear the queue
IEnumerable<IIndexOperation> op;
IEnumerable<IndexOperation> op;
while (_indexQueue.TryTake(out op))
{

Expand Down Expand Up @@ -790,7 +790,7 @@ public override void IndexAll(string type)
/// </remarks>
[SecuritySafeCritical]
public void OptimizeIndex()
{
{
if (_cancellationTokenSource.IsCancellationRequested)
{
OnIndexingError(new IndexingErrorEventArgs("Cannot optimize index, index cancellation has been requested", -1, null), true);
Expand Down Expand Up @@ -851,7 +851,7 @@ protected void AddNodesToIndex(IEnumerable<XElement> nodes, string type)
//enqueue the batch, this allows lazy enumeration of the items
// when the indexes starts to process
EnqueueIndexOperation(
nodes.Select(node => new LazyIndexOperation(() => new IndexItem(node, type, (string)node.Attribute("id")), IndexOperationType.Add)));
nodes.Select(node => new IndexOperation(new IndexItem(node, type, (string)node.Attribute("id")), IndexOperationType.Add)));

//run the indexer on all queued files
SafelyProcessQueueItems();
Expand Down Expand Up @@ -1391,7 +1391,7 @@ void StartIndexing()
} while (numProcessedItems > 0);

//if there are enough commits, then we'll run an optimization
if (CommitCount >= OptimizationCommitThreshold)
if (AutomaticallyOptimize && CommitCount >= OptimizationCommitThreshold)
{
OptimizeIndex();
CommitCount = 0; //reset the counter
Expand Down Expand Up @@ -1481,7 +1481,7 @@ private int ForceProcessQueueItems(bool block)
}
else
{
IEnumerable<IIndexOperation> batch;
IEnumerable<IndexOperation> batch;
//index while we're not cancelled and while there's items in there
while (!_cancellationTokenSource.IsCancellationRequested && _indexQueue.TryTake(out batch))
{
Expand Down Expand Up @@ -1519,7 +1519,7 @@ private int ForceProcessQueueItems(bool block)
}

[SecuritySafeCritical]
private void ProcessQueueItem(IIndexOperation item, ICollection<IndexedNode> indexedNodes, IndexWriter writer)
private void ProcessQueueItem(IndexOperation item, ICollection<IndexedNode> indexedNodes, IndexWriter writer)
{
switch (item.Operation)
{
Expand Down Expand Up @@ -1552,7 +1552,7 @@ private void ProcessQueueItem(IIndexOperation item, ICollection<IndexedNode> ind
/// Queues an indexing operation
/// </summary>
/// <param name="op"></param>
protected void EnqueueIndexOperation(IIndexOperation op)
protected void EnqueueIndexOperation(IndexOperation op)
{
//don't queue if there's been a cancellation requested
if (!_cancellationTokenSource.IsCancellationRequested)
Expand All @@ -1571,7 +1571,7 @@ protected void EnqueueIndexOperation(IIndexOperation op)
/// Queues an indexing operation batch
/// </summary>
/// <param name="ops"></param>
protected void EnqueueIndexOperation(IEnumerable<IIndexOperation> ops)
protected void EnqueueIndexOperation(IEnumerable<IndexOperation> ops)
{
//don't queue if there's been a cancellation requested
if (!_cancellationTokenSource.IsCancellationRequested)
Expand Down Expand Up @@ -1724,7 +1724,7 @@ private void AddSpecialFieldsToDocument(Document d, Dictionary<string, string> f
/// <param name="iw"></param>
/// <param name="performCommit"></param>
[SecuritySafeCritical]
private void ProcessDeleteQueueItem(IIndexOperation op, IndexWriter iw, bool performCommit = true)
private void ProcessDeleteQueueItem(IndexOperation op, IndexWriter iw, bool performCommit = true)
{

//if the id is empty then remove the whole type
Expand All @@ -1741,7 +1741,7 @@ private void ProcessDeleteQueueItem(IIndexOperation op, IndexWriter iw, bool per
}

[SecuritySafeCritical]
private IndexedNode ProcessIndexQueueItem(IIndexOperation op, IndexWriter writer)
private IndexedNode ProcessIndexQueueItem(IndexOperation op, IndexWriter writer)
{
//get the node id
var nodeId = int.Parse(op.Item.Id);
Expand Down
6 changes: 3 additions & 3 deletions SolutionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
[assembly: AssemblyCulture("")]


[assembly: AssemblyVersion("0.1.65.0")]
[assembly: AssemblyFileVersion("0.1.65.0")]
[assembly: AssemblyInformationalVersion("0.1.65.0")]
[assembly: AssemblyVersion("0.1.66.0")]
[assembly: AssemblyFileVersion("0.1.66.0")]
[assembly: AssemblyInformationalVersion("0.1.66.0")]

0 comments on commit 6249a40

Please sign in to comment.