Permalink
Browse files

Move files to correct namespace except where this would cause a break…

…ing change

Minor refactoring (change fields to readonly/static etc)

SVN: branches/1.2.x@3131
  • Loading branch information...
phatcher committed Nov 22, 2007
1 parent 698c93a commit 8d5984be32f89147bb327b8d82a0b9e02af5a975
Showing with 1,254 additions and 1,204 deletions.
  1. +2 −0 src/NHibernate.Search.Tests/Bridge/TruncateFieldBridge.cs
  2. +23 −0 src/NHibernate.Search/Attributes/AnalyzerAttribute.cs
  3. +4 −2 src/NHibernate.Search/Attributes/BoostAttribute.cs
  4. +14 −0 src/NHibernate.Search/Attributes/IndexedEmbedded.cs
  5. +13 −14 src/NHibernate.Search/Backend/AddLuceneWork.cs
  6. +7 −10 src/NHibernate.Search/Backend/DeleteLuceneWork.cs
  7. +16 −16 src/NHibernate.Search/Backend/IBackendQueueProcessorFactory.cs
  8. +19 −20 src/NHibernate.Search/Backend/IQueueingProcessor.cs
  9. +60 −56 src/NHibernate.Search/Backend/Impl/BatchedQueueingProcessor.cs
  10. +68 −0 src/NHibernate.Search/Backend/Impl/Lucene/LuceneBackendQueueProcessor.cs
  11. +21 −0 src/NHibernate.Search/Backend/Impl/Lucene/LuceneBackendQueueProcessorFactory.cs
  12. +114 −0 src/NHibernate.Search/Backend/Impl/Lucene/LuceneWorker.cs
  13. +19 −23 src/NHibernate.Search/Backend/LuceneWork.cs
  14. +46 −47 src/NHibernate.Search/Backend/Work.cs
  15. +7 −7 src/NHibernate.Search/Backend/WorkType.cs
  16. +143 −142 src/NHibernate.Search/Bridge/BridgeFactory.cs
  17. +74 −75 src/NHibernate.Search/Bridge/Builtin/DateBridge.cs
  18. +13 −13 src/NHibernate.Search/Bridge/Builtin/EnumBridge.cs
  19. +11 −11 src/NHibernate.Search/Bridge/Builtin/SimpleBridge.cs
  20. +8 −12 src/NHibernate.Search/Bridge/Builtin/StringBridge.cs
  21. +15 −14 src/NHibernate.Search/Bridge/Builtin/ValueTypeBridge.cs
  22. +8 −8 src/NHibernate.Search/Bridge/IFieldBridge.cs
  23. +5 −7 src/NHibernate.Search/Bridge/IParameterizedBridge.cs
  24. +12 −12 src/NHibernate.Search/Bridge/IStringBridge.cs
  25. +7 −6 src/NHibernate.Search/Bridge/ITwoWayFieldBridge.cs
  26. +9 −8 src/NHibernate.Search/Bridge/ITwoWayStringBridge.cs
  27. +22 −21 src/NHibernate.Search/Bridge/String2FieldBridgeAdaptor.cs
  28. +20 −21 src/NHibernate.Search/Bridge/TwoWayString2FieldBridgeAdaptor.cs
  29. +352 −349 src/NHibernate.Search/Engine/DocumentBuilder.cs
  30. +8 −6 src/NHibernate.Search/Engine/SearchFactory.cs
  31. 0 src/NHibernate.Search/{Impl → }/Environment.cs
  32. +0 −72 src/NHibernate.Search/Impl/LuceneBackendQueueProcessor.cs
  33. +0 −19 src/NHibernate.Search/Impl/LuceneBackendQueueProcessorFactory.cs
  34. +0 −107 src/NHibernate.Search/Impl/LuceneWorker.cs
  35. +1 −0 src/NHibernate.Search/Impl/LuceneWorkspace.cs
  36. +95 −91 src/NHibernate.Search/Impl/SearchInterceptor.cs
  37. 0 src/NHibernate.Search/{Impl → }/Index.cs
  38. +1 −0 src/NHibernate.Search/LuceneQueryExpression.cs
  39. +14 −14 src/NHibernate.Search/NHibernate.Search.csproj
  40. +1 −0 src/NHibernate.Search/Query/FullTextQueryImpl.cs
  41. +1 −1 src/NHibernate.Search/Query/FullTextSearchHelper.cs
  42. +1 −0 src/NHibernate.Search/Query/FullTextSessionImpl.cs
  43. 0 src/NHibernate.Search/{Impl → }/SearchException.cs
  44. 0 src/NHibernate.Search/{Impl → }/Store.cs
@@ -1,5 +1,7 @@
using System;
using Lucene.Net.Documents;
+using NHibernate.Search.Bridge;
+using NHibernate.Search.Bridge.Builtin;
using NHibernate.Util;
namespace NHibernate.Search.Tests.Bridge
@@ -0,0 +1,23 @@
+using System;
+
+namespace NHibernate.Search.Attributes
+{
+ /// <summary>
+ /// Defines an analyzer for a given entity, method or field
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
+ public class AnalyzerAttribute : Attribute
+ {
+ private readonly System.Type type;
+
+ public AnalyzerAttribute(System.Type value)
+ {
+ type = value;
+ }
+
+ public System.Type Type
+ {
+ get { return type; }
+ }
+ }
+}
@@ -2,17 +2,19 @@
namespace NHibernate.Search.Attributes
{
+ /// <summary>
+ /// Applies a boost factor on a field or whole entity
+ /// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
public class BoostAttribute : Attribute
{
- private float value;
+ private readonly float value;
public BoostAttribute(float value)
{
this.value = value;
}
-
public float Value
{
get { return value; }
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace NHibernate.Search.Attributes
+{
+ /// <summary>
+ /// Specifies that an association is to be indexed in the root entity index
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
+ public class IndexedEmbeddedAttribute : Attribute
+ {
+ }
+}
@@ -1,20 +1,19 @@
using Lucene.Net.Documents;
-namespace NHibernate.Search.Impl
+namespace NHibernate.Search.Backend
{
- public class AddLuceneWork : LuceneWork
- {
- private readonly Document document;
+ public class AddLuceneWork : LuceneWork
+ {
+ private readonly Document document;
- public AddLuceneWork(object id, System.Type entityClass, Document document) : base(id, entityClass)
- {
- this.document = document;
- }
+ public AddLuceneWork(object id, System.Type entityClass, Document document) : base(id, entityClass)
+ {
+ this.document = document;
+ }
-
- public Document Document
- {
- get { return document; }
- }
- }
+ public Document Document
+ {
+ get { return document; }
+ }
+ }
}
@@ -1,12 +1,9 @@
-using System;
-using System.Collections.Generic;
-
-namespace NHibernate.Search.Impl
+namespace NHibernate.Search.Backend
{
- public class DeleteLuceneWork : LuceneWork
- {
- public DeleteLuceneWork(object id, System.Type entityClass) : base(id, entityClass)
- {
- }
- }
+ public class DeleteLuceneWork : LuceneWork
+ {
+ public DeleteLuceneWork(object id, System.Type entityClass) : base(id, entityClass)
+ {
+ }
+ }
}
@@ -2,22 +2,22 @@
using System.Collections.Generic;
using System.Threading;
-namespace NHibernate.Search.Impl
+namespace NHibernate.Search.Backend
{
- /// <summary>
- /// Build stateful backend processor
- /// Must have a no arg constructor
- /// The factory typically prepare or pool the resources needed by the queue processor
- /// </summary>
- public interface IBackendQueueProcessorFactory
- {
- void Initialize(IDictionary props, SearchFactory searchFactory);
+ /// <summary>
+ /// Build stateful backend processor
+ /// Must have a no arg constructor
+ /// The factory typically prepare or pool the resources needed by the queue processor
+ /// </summary>
+ public interface IBackendQueueProcessorFactory
+ {
+ void Initialize(IDictionary props, SearchFactory searchFactory);
- /// <summary>
- /// Return a runnable implementation responsible for processing the queue to a given backend
- /// </summary>
- /// <param name="queue"></param>
- /// <returns></returns>
- WaitCallback GetProcessor(List<LuceneWork> queue);
- }
+ /// <summary>
+ /// Return a runnable implementation responsible for processing the queue to a given backend
+ /// </summary>
+ /// <param name="queue"></param>
+ /// <returns></returns>
+ WaitCallback GetProcessor(List<LuceneWork> queue);
+ }
}
@@ -1,25 +1,24 @@
-using System;
using System.Collections.Generic;
-namespace NHibernate.Search.Impl
+namespace NHibernate.Search.Backend
{
- /// <summary>
- /// Pile work operations
- /// No thread safety has to be implemented, the queue being scoped already
- /// The implementation must be "stateless" wrt the queue through (ie not store the queue state)
- /// </summary>
- public interface IQueueingProcessor
- {
- /// <summary>
- /// Performs all the work in the queue
- /// </summary>
- /// <param name="queue">The queue.</param>
- void PerformWork(List<LuceneWork> queue);
+ /// <summary>
+ /// Pile work operations
+ /// No thread safety has to be implemented, the queue being scoped already
+ /// The implementation must be "stateless" wrt the queue through (ie not store the queue state)
+ /// </summary>
+ public interface IQueueingProcessor
+ {
+ /// <summary>
+ /// Performs all the work in the queue
+ /// </summary>
+ /// <param name="queue">The queue.</param>
+ void PerformWork(List<LuceneWork> queue);
- /// <summary>
- /// Rollback
- /// </summary>
- /// <param name="queue"></param>
- void CancelWork(List<LuceneWork> queue);
- }
+ /// <summary>
+ /// Rollback
+ /// </summary>
+ /// <param name="queue"></param>
+ void CancelWork(List<LuceneWork> queue);
+ }
}
@@ -1,68 +1,72 @@
using System;
+using System.Collections;
using System.Collections.Generic;
-using System.Reflection;
using System.Threading;
-using System.Collections;
+using NHibernate.Search.Backend.Impl.Lucene;
+using NHibernate.Search.Impl;
using NHibernate.Util;
-namespace NHibernate.Search.Impl
+namespace NHibernate.Search.Backend.Impl
{
- /// <summary>
- /// Batch work until #ExecuteQueue is called.
- /// The work is then executed synchronously or asynchronously
- /// </summary>
- public class BatchedQueueingProcessor : IQueueingProcessor
- {
- private bool sync;
- private IBackendQueueProcessorFactory backendQueueProcessorFactory;
- private SearchFactory searchFactory;
+ /// <summary>
+ /// Batch work until #ExecuteQueue is called.
+ /// The work is then executed synchronously or asynchronously
+ /// </summary>
+ public class BatchedQueueingProcessor : IQueueingProcessor
+ {
+ private readonly IBackendQueueProcessorFactory backendQueueProcessorFactory;
+ private readonly bool sync;
+ private SearchFactory searchFactory;
- public BatchedQueueingProcessor(SearchFactory searchFactory,
- IDictionary properties)
- {
- this.searchFactory = searchFactory;
- //default to sync if none defined
- this.sync = !"async".Equals((string)properties[Environment.WorkerExecution], StringComparison.InvariantCultureIgnoreCase);
+ public BatchedQueueingProcessor(SearchFactory searchFactory,
+ IDictionary properties)
+ {
+ this.searchFactory = searchFactory;
+ //default to sync if none defined
+ sync =
+ !"async".Equals((string) properties[Environment.WorkerExecution],
+ StringComparison.InvariantCultureIgnoreCase);
- String backend = (string)properties[Environment.WorkerBackend];
- if (StringHelper.IsEmpty(backend) || "lucene".Equals(backend, StringComparison.InvariantCultureIgnoreCase))
- {
- backendQueueProcessorFactory = new LuceneBackendQueueProcessorFactory();
- }
- else
- {
- try
- {
- System.Type processorFactoryClass = ReflectHelper.ClassForName(backend);
- backendQueueProcessorFactory = (IBackendQueueProcessorFactory)Activator.CreateInstance(processorFactoryClass);
- }
- catch (Exception e)
- {
- throw new SearchException("Unable to find/create processor class: " + backend, e);
- }
- }
- backendQueueProcessorFactory.Initialize(properties, searchFactory);
- searchFactory.SetbackendQueueProcessorFactory(backendQueueProcessorFactory);
- }
+ String backend = (string) properties[Environment.WorkerBackend];
+ if (StringHelper.IsEmpty(backend) || "lucene".Equals(backend, StringComparison.InvariantCultureIgnoreCase))
+ {
+ backendQueueProcessorFactory = new LuceneBackendQueueProcessorFactory();
+ }
+ else
+ {
+ try
+ {
+ System.Type processorFactoryClass = ReflectHelper.ClassForName(backend);
+ backendQueueProcessorFactory =
+ (IBackendQueueProcessorFactory) Activator.CreateInstance(processorFactoryClass);
+ }
+ catch (Exception e)
+ {
+ throw new SearchException("Unable to find/create processor class: " + backend, e);
+ }
+ }
+ backendQueueProcessorFactory.Initialize(properties, searchFactory);
+ searchFactory.SetbackendQueueProcessorFactory(backendQueueProcessorFactory);
+ }
- //TODO implements parallel batchWorkers (one per Directory)
- public void PerformWork(List<LuceneWork> luceneQueue)
- {
- WaitCallback processor = backendQueueProcessorFactory.GetProcessor(luceneQueue);
- if (sync)
- {
- processor(null);
- }
- else
- {
- ThreadPool.QueueUserWorkItem(processor);
- }
- }
+ //TODO implements parallel batchWorkers (one per Directory)
+ public void PerformWork(List<LuceneWork> luceneQueue)
+ {
+ WaitCallback processor = backendQueueProcessorFactory.GetProcessor(luceneQueue);
+ if (sync)
+ {
+ processor(null);
+ }
+ else
+ {
+ ThreadPool.QueueUserWorkItem(processor);
+ }
+ }
- public void CancelWork(List<LuceneWork> queue)
- {
- queue.Clear();
- }
- }
+ public void CancelWork(List<LuceneWork> queue)
+ {
+ queue.Clear();
+ }
+ }
}
Oops, something went wrong.

0 comments on commit 8d5984b

Please sign in to comment.