Return-Path: X-Original-To: apmail-lucenenet-commits-archive@www.apache.org Delivered-To: apmail-lucenenet-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3B42AF0A1 for ; Wed, 3 Apr 2013 17:40:20 +0000 (UTC) Received: (qmail 22445 invoked by uid 500); 3 Apr 2013 17:40:12 -0000 Delivered-To: apmail-lucenenet-commits-archive@lucenenet.apache.org Received: (qmail 21850 invoked by uid 500); 3 Apr 2013 17:40:02 -0000 Mailing-List: contact commits-help@lucenenet.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: lucene-net-dev@lucenenet.apache.org Delivered-To: mailing list commits@lucenenet.apache.org Received: (qmail 19592 invoked by uid 99); 3 Apr 2013 17:39:46 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Apr 2013 17:39:46 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id D5E09836F22; Wed, 3 Apr 2013 17:39:45 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: ccurrens@apache.org To: commits@lucenenet.apache.org Date: Wed, 03 Apr 2013 17:40:31 -0000 Message-Id: <830f143b32b444fb825b509a01d07e0c@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [48/51] [partial] Mass convert mixed tabs to spaces http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/DistributedSearch/Distributed/Indexing/IndexSets.cs ---------------------------------------------------------------------- diff --git a/src/contrib/DistributedSearch/Distributed/Indexing/IndexSets.cs b/src/contrib/DistributedSearch/Distributed/Indexing/IndexSets.cs index bf56282..e0403d8 100644 --- a/src/contrib/DistributedSearch/Distributed/Indexing/IndexSets.cs +++ b/src/contrib/DistributedSearch/Distributed/Indexing/IndexSets.cs @@ -48,26 +48,26 @@ namespace Lucene.Net.Distributed.Indexing /// /// public class IndexSets - { - private bool _bCompoundFile; - private string _strDeltaDirectory; - private IndexSet[] _arIndexSet; + { + private bool _bCompoundFile; + private string _strDeltaDirectory; + private IndexSet[] _arIndexSet; /// /// Accessor method for the configurable master indexes. /// public static IndexSets GetConfig - { + { get { return (IndexSets)ConfigurationManager.GetSection("IndexSets"); } - } + } /// /// Strongly-typed array of IndexSet objects as defined in a configuration section. /// /// XmlNode definition for a given IndexSet public void LoadIndexSetArray(XmlNode node) - { - XmlAttributeCollection attributeCollection = node.Attributes; + { + XmlAttributeCollection attributeCollection = node.Attributes; try { @@ -91,66 +91,66 @@ namespace Lucene.Net.Distributed.Indexing throw new ConfigurationErrorsException("No indexset definitions found " + Environment.NewLine + node.OuterXml); this._arIndexSet = new IndexSet[node.ChildNodes.Count]; - int x=0; - foreach (XmlNode c in node.ChildNodes) - { - if (c.Name.ToLower()=="IndexSet") - { - IndexSet idxSet = new IndexSet(c); - this._arIndexSet[x] = idxSet; - x++; - } + int x=0; + foreach (XmlNode c in node.ChildNodes) + { + if (c.Name.ToLower()=="IndexSet") + { + IndexSet idxSet = new IndexSet(c); + this._arIndexSet[x] = idxSet; + x++; + } - } - } + } + } /// /// Public constructor for IndexSets. An IndexSet is defined in XML configuration /// and is loaded via a custom configuration handler. /// public IndexSets() - { - } + { + } /// /// Indicates if the indexes under configuration should be built in the Compound format. /// - public bool CompoundFile - { - get {return this._bCompoundFile;} - } + public bool CompoundFile + { + get {return this._bCompoundFile;} + } /// /// Filesystem location of where pending update IndexDocuments are retrieved. /// - public string DeltaDirectory - { - get {return this._strDeltaDirectory;} - } + public string DeltaDirectory + { + get {return this._strDeltaDirectory;} + } /// /// Strongly-typed array of IndexSet objects as defined in a configuration section. /// public IndexSet[] IndexSetArray - { - get {return this._arIndexSet;} - } + { + get {return this._arIndexSet;} + } /// /// Returns an IndexSet object for a given IndexDocument id value /// /// Id value of the IndexDocument /// The IndexSet containing the referenced IndexDocument - public IndexSet GetIndexSet(int deleteId) - { - IndexSet getSet=null; - foreach(IndexSet idxSet in this._arIndexSet) - { - if ((deleteId>=idxSet.BottomId)&&(deleteId<=idxSet.TopId)) - getSet=idxSet; - } - return getSet; - } + public IndexSet GetIndexSet(int deleteId) + { + IndexSet getSet=null; + foreach(IndexSet idxSet in this._arIndexSet) + { + if ((deleteId>=idxSet.BottomId)&&(deleteId<=idxSet.TopId)) + getSet=idxSet; + } + return getSet; + } /// /// Queries the DeltaDirectory to access any IndexDocument files. All IndexDocuments @@ -159,112 +159,112 @@ namespace Lucene.Net.Distributed.Indexing /// IndexSet. /// /// Filesystem path to the DeltaDirectory - public void LoadIndexDocuments(string sourceDir) - { - DirectoryInfo oDirectoryInfo = new DirectoryInfo(sourceDir); - FileInfo[] arFiles = oDirectoryInfo.GetFiles("*.bin"); - Array.Sort(arFiles, new FileNameComparer()); - IndexSet idxSet; + public void LoadIndexDocuments(string sourceDir) + { + DirectoryInfo oDirectoryInfo = new DirectoryInfo(sourceDir); + FileInfo[] arFiles = oDirectoryInfo.GetFiles("*.bin"); + Array.Sort(arFiles, new FileNameComparer()); + IndexSet idxSet; - foreach (FileInfo fi in arFiles) - { - FileStream fs = new FileStream(fi.FullName, FileMode.Open); - IndexDocument iDoc = (IndexDocument)IndexDocument.Formatter.Deserialize(fs); + foreach (FileInfo fi in arFiles) + { + FileStream fs = new FileStream(fi.FullName, FileMode.Open); + IndexDocument iDoc = (IndexDocument)IndexDocument.Formatter.Deserialize(fs); - idxSet = this.GetIndexSet(iDoc.RecordId); - if (idxSet != null) - { - idxSet.FileSystemDocuments.Add(fi.FullName); - if (idxSet.IndexDocuments.ContainsKey(iDoc.RecordId)) - { - IndexDocument curDoc = (IndexDocument)idxSet.IndexDocuments[iDoc.RecordId]; - idxSet.IndexDocuments.Add(iDoc.RecordId, iDoc); - } - else - idxSet.IndexDocuments.Add(iDoc.RecordId, iDoc); - } - else - { - //Handling exceptions -- write file out somewhere else? - if (ConfigurationManager.AppSettings["ExceptionsBasePath"] != null) - iDoc.Save(ConfigurationManager.AppSettings["ExceptionsBasePath"]); - } - fs.Close(); - } - oDirectoryInfo=null; - arFiles=null; - } + idxSet = this.GetIndexSet(iDoc.RecordId); + if (idxSet != null) + { + idxSet.FileSystemDocuments.Add(fi.FullName); + if (idxSet.IndexDocuments.ContainsKey(iDoc.RecordId)) + { + IndexDocument curDoc = (IndexDocument)idxSet.IndexDocuments[iDoc.RecordId]; + idxSet.IndexDocuments.Add(iDoc.RecordId, iDoc); + } + else + idxSet.IndexDocuments.Add(iDoc.RecordId, iDoc); + } + else + { + //Handling exceptions -- write file out somewhere else? + if (ConfigurationManager.AppSettings["ExceptionsBasePath"] != null) + iDoc.Save(ConfigurationManager.AppSettings["ExceptionsBasePath"]); + } + fs.Close(); + } + oDirectoryInfo=null; + arFiles=null; + } /// /// Method to apply pending updates (additions & deletions) for all configured IndexSet objects. /// - public void ProcessIndexDocuments() - { - foreach(IndexSet idxSet in this._arIndexSet) - { - if (idxSet.IndexDocuments.Count>0) - { - idxSet.CurrentIndex.ProcessLocalIndexDeletes(idxSet.GetDeletionCollection()); - idxSet.CurrentIndex.ProcessLocalIndexAdditions(idxSet.Analzyer, idxSet.Documents, this.CompoundFile); - } - } - } + public void ProcessIndexDocuments() + { + foreach(IndexSet idxSet in this._arIndexSet) + { + if (idxSet.IndexDocuments.Count>0) + { + idxSet.CurrentIndex.ProcessLocalIndexDeletes(idxSet.GetDeletionCollection()); + idxSet.CurrentIndex.ProcessLocalIndexAdditions(idxSet.Analzyer, idxSet.Documents, this.CompoundFile); + } + } + } /// /// Method to apply updated index files from master index to slave indexes /// - public void CopyUpdatedFiles() - { - Hashtable htUpdates = new Hashtable(); - bool bCopy=false; + public void CopyUpdatedFiles() + { + Hashtable htUpdates = new Hashtable(); + bool bCopy=false; foreach (IndexSet idxSet in this._arIndexSet) - { - bCopy=false; - if (idxSet.CurrentIndex!=null && idxSet.CurrentIndex.CanCopy) - bCopy=idxSet.CurrentIndex.CopyIncremental(); - if (bCopy && !htUpdates.ContainsKey(idxSet.CurrentIndex.StatusDirectory)) - htUpdates.Add(idxSet.CurrentIndex.StatusDirectory, idxSet.CurrentIndex); - } + { + bCopy=false; + if (idxSet.CurrentIndex!=null && idxSet.CurrentIndex.CanCopy) + bCopy=idxSet.CurrentIndex.CopyIncremental(); + if (bCopy && !htUpdates.ContainsKey(idxSet.CurrentIndex.StatusDirectory)) + htUpdates.Add(idxSet.CurrentIndex.StatusDirectory, idxSet.CurrentIndex); + } - foreach(DictionaryEntry de in htUpdates) - { - string sTargetDir = de.Key.ToString(); - CurrentIndex ci = (CurrentIndex)de.Value; - ci.UpdateRefresh(); - } - } + foreach(DictionaryEntry de in htUpdates) + { + string sTargetDir = de.Key.ToString(); + CurrentIndex ci = (CurrentIndex)de.Value; + ci.UpdateRefresh(); + } + } /// /// Method to apply updated index files from master index to slave indexes /// /// Hashtable of updated indexes - public Hashtable CopyAllFiles() - { - Hashtable htUpdates = new Hashtable(); - bool bCopy = false; + public Hashtable CopyAllFiles() + { + Hashtable htUpdates = new Hashtable(); + bool bCopy = false; foreach (IndexSet idxSet in this._arIndexSet) - { - bCopy = false; - if (idxSet.CurrentIndex != null && idxSet.CurrentIndex.CanCopy) - bCopy = idxSet.CurrentIndex.Copy(); - if (bCopy && !htUpdates.ContainsKey(idxSet.CurrentIndex.StatusDirectory)) - htUpdates.Add(idxSet.CurrentIndex.StatusDirectory, idxSet.CurrentIndex); - } + { + bCopy = false; + if (idxSet.CurrentIndex != null && idxSet.CurrentIndex.CanCopy) + bCopy = idxSet.CurrentIndex.Copy(); + if (bCopy && !htUpdates.ContainsKey(idxSet.CurrentIndex.StatusDirectory)) + htUpdates.Add(idxSet.CurrentIndex.StatusDirectory, idxSet.CurrentIndex); + } - foreach (DictionaryEntry de in htUpdates) - { - string sTargetDir = de.Key.ToString(); - CurrentIndex ci = (CurrentIndex)de.Value; - ci.UpdateRefresh(); - } + foreach (DictionaryEntry de in htUpdates) + { + string sTargetDir = de.Key.ToString(); + CurrentIndex ci = (CurrentIndex)de.Value; + ci.UpdateRefresh(); + } - return htUpdates; - } + return htUpdates; + } /// /// Method to execute an index optimization for each configured IndexSet object /// - public void OptimizeIndexes() + public void OptimizeIndexes() { foreach (IndexSet idxSet in this._arIndexSet) idxSet.Optimize(); @@ -274,20 +274,20 @@ namespace Lucene.Net.Distributed.Indexing /// Method to finalize update process for each IndexSet object /// public void CompleteUpdate() - { + { foreach (IndexSet idxSet in this._arIndexSet) - { - if (idxSet.FileSystemDocuments.Count>0) - { - foreach(string s in idxSet.FileSystemDocuments) - { - FileInfo fi = new FileInfo(s); - fi.Delete(); - } - idxSet.Reset(); - } - } - } + { + if (idxSet.FileSystemDocuments.Count>0) + { + foreach(string s in idxSet.FileSystemDocuments) + { + FileInfo fi = new FileInfo(s); + fi.Delete(); + } + idxSet.Reset(); + } + } + } - } + } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/DistributedSearch/Distributed/Search/DistributedSearchable.cs ---------------------------------------------------------------------- diff --git a/src/contrib/DistributedSearch/Distributed/Search/DistributedSearchable.cs b/src/contrib/DistributedSearch/Distributed/Search/DistributedSearchable.cs index 87d7665..3488e26 100644 --- a/src/contrib/DistributedSearch/Distributed/Search/DistributedSearchable.cs +++ b/src/contrib/DistributedSearch/Distributed/Search/DistributedSearchable.cs @@ -53,19 +53,19 @@ namespace Lucene.Net.Distributed.Search public override object InitializeLifetimeService() { DistributedSearchable.leaseTimeSpan = new TimeSpan(0, 0, DistributedSearchable.initialLeaseTime + DistributedSearchable.TIME_FACTOR); - if (DistributedSearchable.initialLeaseTime == -1) - { - return null; //Permanent TTL; never get's GC'd - } - else - { - ILease oLease = (ILease) base.InitializeLifetimeService(); - if (oLease.CurrentState == LeaseState.Initial) - { - oLease.InitialLeaseTime = TimeSpan.FromSeconds(DistributedSearchable.leaseTimeSpan.TotalSeconds); - oLease.RenewOnCallTime = TimeSpan.FromSeconds(DistributedSearchable.TIME_FACTOR); - } - return oLease; + if (DistributedSearchable.initialLeaseTime == -1) + { + return null; //Permanent TTL; never get's GC'd + } + else + { + ILease oLease = (ILease) base.InitializeLifetimeService(); + if (oLease.CurrentState == LeaseState.Initial) + { + oLease.InitialLeaseTime = TimeSpan.FromSeconds(DistributedSearchable.leaseTimeSpan.TotalSeconds); + oLease.RenewOnCallTime = TimeSpan.FromSeconds(DistributedSearchable.TIME_FACTOR); + } + return oLease; } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/DistributedSearch/LuceneMonitor/LuceneMonitor.cs ---------------------------------------------------------------------- diff --git a/src/contrib/DistributedSearch/LuceneMonitor/LuceneMonitor.cs b/src/contrib/DistributedSearch/LuceneMonitor/LuceneMonitor.cs index 153d6f7..e36beb7 100644 --- a/src/contrib/DistributedSearch/LuceneMonitor/LuceneMonitor.cs +++ b/src/contrib/DistributedSearch/LuceneMonitor/LuceneMonitor.cs @@ -36,149 +36,149 @@ namespace Lucene.Net.Distributed.Operations /// /// A Windows service that provides system ping checking against LuceneServer. /// - public class LuceneMonitor : System.ServiceProcess.ServiceBase - { - /// - /// Required designer variable. - /// - private System.ComponentModel.Container components = null; - private ServiceController scMonitor = new ServiceController(); - private Thread serviceThread; - private int sleepTime = 5000; - private bool bRun = true; - private string ipAddress = ""; - private int port = 0; - private static readonly log4net.ILog oLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + public class LuceneMonitor : System.ServiceProcess.ServiceBase + { + /// + /// Required designer variable. + /// + private System.ComponentModel.Container components = null; + private ServiceController scMonitor = new ServiceController(); + private Thread serviceThread; + private int sleepTime = 5000; + private bool bRun = true; + private string ipAddress = ""; + private int port = 0; + private static readonly log4net.ILog oLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); public LuceneMonitor() - { - // This call is required by the Windows.Forms Component Designer. - InitializeComponent(); + { + // This call is required by the Windows.Forms Component Designer. + InitializeComponent(); - // TODO: Add any initialization after the InitComponent call - } + // TODO: Add any initialization after the InitComponent call + } - // The main entry point for the process - static void Main() - { - System.ServiceProcess.ServiceBase[] ServicesToRun; + // The main entry point for the process + static void Main() + { + System.ServiceProcess.ServiceBase[] ServicesToRun; ServicesToRun = new System.ServiceProcess.ServiceBase[] { new LuceneMonitor() }; - System.ServiceProcess.ServiceBase.Run(ServicesToRun); - } - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - components = new System.ComponentModel.Container(); - this.ServiceName = "LuceneMonitor"; - } - - /// - /// Clean up any resources being used. - /// - protected override void Dispose( bool disposing ) - { - if( disposing ) - { - if (components != null) - { - components.Dispose(); - } - } - base.Dispose( disposing ); - } - - /// - /// Set things in motion so your service can do its work. - /// - protected override void OnStart(string[] args) - { - ThreadStart threadStart = new ThreadStart(MonitorService); - serviceThread = new Thread(threadStart); - serviceThread.Start(); - } - - private void LogMessage(string message) - { - this.LogMessage(message, Level.Info); - } - private void LogMessage(string message, Level msgLevel) - { - if (msgLevel==Level.Info) - { - if (oLog.IsInfoEnabled) - oLog.Info(message); - } - else if (msgLevel==Level.Warn) - { - if (oLog.IsWarnEnabled) - oLog.Warn(message); - } - } - private void LogMessage(string message, Level msgLevel, int ErrorLevel) - { - if (msgLevel==Level.Error) - { - if (oLog.IsErrorEnabled) - { - oLog.Error(message); - EventLog.WriteEntry(this.ServiceName, message, EventLogEntryType.Error, ErrorLevel); - } - } - } - - private void MonitorService() - { - this.LogMessage(this.ServiceName+" started"); - scMonitor.ServiceName="LuceneServer"; + System.ServiceProcess.ServiceBase.Run(ServicesToRun); + } + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + this.ServiceName = "LuceneMonitor"; + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if (components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + /// + /// Set things in motion so your service can do its work. + /// + protected override void OnStart(string[] args) + { + ThreadStart threadStart = new ThreadStart(MonitorService); + serviceThread = new Thread(threadStart); + serviceThread.Start(); + } + + private void LogMessage(string message) + { + this.LogMessage(message, Level.Info); + } + private void LogMessage(string message, Level msgLevel) + { + if (msgLevel==Level.Info) + { + if (oLog.IsInfoEnabled) + oLog.Info(message); + } + else if (msgLevel==Level.Warn) + { + if (oLog.IsWarnEnabled) + oLog.Warn(message); + } + } + private void LogMessage(string message, Level msgLevel, int ErrorLevel) + { + if (msgLevel==Level.Error) + { + if (oLog.IsErrorEnabled) + { + oLog.Error(message); + EventLog.WriteEntry(this.ServiceName, message, EventLogEntryType.Error, ErrorLevel); + } + } + } + + private void MonitorService() + { + this.LogMessage(this.ServiceName+" started"); + scMonitor.ServiceName="LuceneServer"; this.sleepTime = (ConfigurationManager.AppSettings["ServiceSleepTime"] != null ? Convert.ToInt32(ConfigurationManager.AppSettings["ServiceSleepTime"]) : this.sleepTime); this.ipAddress = (ConfigurationManager.AppSettings["IPAddress"] != null ? ConfigurationManager.AppSettings["IPAddress"] : ""); this.port = (ConfigurationManager.AppSettings["Port"] != null ? Convert.ToInt32(ConfigurationManager.AppSettings["Port"]) : 0); - this.LogMessage("ServiceSleepTime = "+this.sleepTime.ToString()+"; ipAddress="+this.ipAddress+"; port="+this.port.ToString()); - - while (bRun) - { - this.CheckService(); - Thread.Sleep(sleepTime); - } - } - - private void CheckService() - { - try - { - scMonitor.Refresh(); - - if (scMonitor.Status.Equals(ServiceControllerStatus.StopPending)) - scMonitor.WaitForStatus(ServiceControllerStatus.Stopped); - - if (scMonitor.Status.Equals(ServiceControllerStatus.Stopped)) - { - // Start the service if the current status is stopped. - foreach (IChannel ic in ChannelServices.RegisteredChannels) - ChannelServices.UnregisterChannel(ic); - scMonitor.Start(); - this.LogMessage(scMonitor.ServiceName + " started (Service stopped or StopPending)", Level.Error, 99); - } - } - catch (Exception e) - { - this.LogMessage(scMonitor.ServiceName + " error: "+e.Message+e.StackTrace, Level.Error, 199); - } - - } - - - /// - /// Stop this service. - /// - protected override void OnStop() - { - this.bRun=false; - } - } + this.LogMessage("ServiceSleepTime = "+this.sleepTime.ToString()+"; ipAddress="+this.ipAddress+"; port="+this.port.ToString()); + + while (bRun) + { + this.CheckService(); + Thread.Sleep(sleepTime); + } + } + + private void CheckService() + { + try + { + scMonitor.Refresh(); + + if (scMonitor.Status.Equals(ServiceControllerStatus.StopPending)) + scMonitor.WaitForStatus(ServiceControllerStatus.Stopped); + + if (scMonitor.Status.Equals(ServiceControllerStatus.Stopped)) + { + // Start the service if the current status is stopped. + foreach (IChannel ic in ChannelServices.RegisteredChannels) + ChannelServices.UnregisterChannel(ic); + scMonitor.Start(); + this.LogMessage(scMonitor.ServiceName + " started (Service stopped or StopPending)", Level.Error, 99); + } + } + catch (Exception e) + { + this.LogMessage(scMonitor.ServiceName + " error: "+e.Message+e.StackTrace, Level.Error, 199); + } + + } + + + /// + /// Stop this service. + /// + protected override void OnStop() + { + this.bRun=false; + } + } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/DistributedSearch/LuceneMonitor/ProjectInstaller.cs ---------------------------------------------------------------------- diff --git a/src/contrib/DistributedSearch/LuceneMonitor/ProjectInstaller.cs b/src/contrib/DistributedSearch/LuceneMonitor/ProjectInstaller.cs index b802cb0..9b635b5 100644 --- a/src/contrib/DistributedSearch/LuceneMonitor/ProjectInstaller.cs +++ b/src/contrib/DistributedSearch/LuceneMonitor/ProjectInstaller.cs @@ -24,118 +24,118 @@ using Microsoft.Win32; namespace LuceneMonitorInstall { - /// - /// Summary description for ProjectInstaller. - /// - [RunInstallerAttribute(true)] - public class ProjectInstaller : Installer - { - private ServiceProcessInstaller processInstaller; - private ServiceInstaller serviceInstaller; - /// - /// Required designer variable. - /// - private System.ComponentModel.Container components = null; - - public ProjectInstaller() - { - // This call is required by the Designer. - InitializeComponent(); - - // TODO: Add any initialization after the InitializeComponent call - } - - /// - /// Clean up any resources being used. - /// - protected override void Dispose( bool disposing ) - { - if( disposing ) - { - if(components != null) - { - components.Dispose(); - } - } - base.Dispose( disposing ); - } - - - #region Component Designer generated code - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.processInstaller = new ServiceProcessInstaller(); - this.serviceInstaller = new ServiceInstaller(); - this.processInstaller.Account = ServiceAccount.LocalSystem; - - this.serviceInstaller.ServiceName = "LuceneMonitor"; - this.serviceInstaller.StartType = ServiceStartMode.Manual; - - Installers.Add(this.processInstaller); - Installers.Add(this.serviceInstaller); - - } - #endregion - - public override void Install(IDictionary stateSaver) - { - RegistryKey system; - RegistryKey currentControlSet; //HKEY_LOCAL_MACHINE\Services\CurrentControlSet - RegistryKey services; //...\Services - RegistryKey service; //...\ - - try - { - //Let the project installer do its job - base.Install(stateSaver); - - system = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("System"); //Open the HKEY_LOCAL_MACHINE\SYSTEM key - currentControlSet = system.OpenSubKey("CurrentControlSet"); //Open CurrentControlSet - services = currentControlSet.OpenSubKey("Services"); //Go to the services key - service = services.OpenSubKey(this.serviceInstaller.ServiceName, true); //Open the key for serviceInstaller - - service.SetValue("Description", "Lucene Monitor"); - - - } - catch(Exception e) - { - Console.WriteLine("An exception was thrown during service installation:\n" + e.ToString()); - } - } - - public override void Uninstall(IDictionary savedState) - { - RegistryKey system; - RegistryKey currentControlSet; //HKEY_LOCAL_MACHINE\Services\CurrentControlSet - RegistryKey services; //...\Services - RegistryKey service; //...\ - - try - { - //Drill down to the service key and open it with write permission - system = Registry.LocalMachine.OpenSubKey("System"); - currentControlSet = system.OpenSubKey("CurrentControlSet"); - services = currentControlSet.OpenSubKey("Services"); - service = services.OpenSubKey(this.serviceInstaller.ServiceName, true); - service.DeleteSubKeyTree("Description"); //Delete keys created during installation - - } - catch(Exception e) - { - Console.WriteLine("Exception encountered while uninstalling service:\n" + e.ToString()); - } - finally - { - //Let the project installer do its job - base.Uninstall(savedState); - } - } - - - } + /// + /// Summary description for ProjectInstaller. + /// + [RunInstallerAttribute(true)] + public class ProjectInstaller : Installer + { + private ServiceProcessInstaller processInstaller; + private ServiceInstaller serviceInstaller; + /// + /// Required designer variable. + /// + private System.ComponentModel.Container components = null; + + public ProjectInstaller() + { + // This call is required by the Designer. + InitializeComponent(); + + // TODO: Add any initialization after the InitializeComponent call + } + + /// + /// Clean up any resources being used. + /// + protected override void Dispose( bool disposing ) + { + if( disposing ) + { + if(components != null) + { + components.Dispose(); + } + } + base.Dispose( disposing ); + } + + + #region Component Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.processInstaller = new ServiceProcessInstaller(); + this.serviceInstaller = new ServiceInstaller(); + this.processInstaller.Account = ServiceAccount.LocalSystem; + + this.serviceInstaller.ServiceName = "LuceneMonitor"; + this.serviceInstaller.StartType = ServiceStartMode.Manual; + + Installers.Add(this.processInstaller); + Installers.Add(this.serviceInstaller); + + } + #endregion + + public override void Install(IDictionary stateSaver) + { + RegistryKey system; + RegistryKey currentControlSet; //HKEY_LOCAL_MACHINE\Services\CurrentControlSet + RegistryKey services; //...\Services + RegistryKey service; //...\ + + try + { + //Let the project installer do its job + base.Install(stateSaver); + + system = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("System"); //Open the HKEY_LOCAL_MACHINE\SYSTEM key + currentControlSet = system.OpenSubKey("CurrentControlSet"); //Open CurrentControlSet + services = currentControlSet.OpenSubKey("Services"); //Go to the services key + service = services.OpenSubKey(this.serviceInstaller.ServiceName, true); //Open the key for serviceInstaller + + service.SetValue("Description", "Lucene Monitor"); + + + } + catch(Exception e) + { + Console.WriteLine("An exception was thrown during service installation:\n" + e.ToString()); + } + } + + public override void Uninstall(IDictionary savedState) + { + RegistryKey system; + RegistryKey currentControlSet; //HKEY_LOCAL_MACHINE\Services\CurrentControlSet + RegistryKey services; //...\Services + RegistryKey service; //...\ + + try + { + //Drill down to the service key and open it with write permission + system = Registry.LocalMachine.OpenSubKey("System"); + currentControlSet = system.OpenSubKey("CurrentControlSet"); + services = currentControlSet.OpenSubKey("Services"); + service = services.OpenSubKey(this.serviceInstaller.ServiceName, true); + service.DeleteSubKeyTree("Description"); //Delete keys created during installation + + } + catch(Exception e) + { + Console.WriteLine("Exception encountered while uninstalling service:\n" + e.ToString()); + } + finally + { + //Let the project installer do its job + base.Uninstall(savedState); + } + } + + + } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/FastVectorHighlighter/Properties/AssemblyInfo.cs ---------------------------------------------------------------------- diff --git a/src/contrib/FastVectorHighlighter/Properties/AssemblyInfo.cs b/src/contrib/FastVectorHighlighter/Properties/AssemblyInfo.cs index 9a545d9..e44909c 100644 --- a/src/contrib/FastVectorHighlighter/Properties/AssemblyInfo.cs +++ b/src/contrib/FastVectorHighlighter/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -/* +/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/FastVectorHighlighter/StringUtils.cs ---------------------------------------------------------------------- diff --git a/src/contrib/FastVectorHighlighter/StringUtils.cs b/src/contrib/FastVectorHighlighter/StringUtils.cs index 7b27259..995d714 100644 --- a/src/contrib/FastVectorHighlighter/StringUtils.cs +++ b/src/contrib/FastVectorHighlighter/StringUtils.cs @@ -1,4 +1,4 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/FastVectorHighlighter/VectorHighlightMapper.cs ---------------------------------------------------------------------- diff --git a/src/contrib/FastVectorHighlighter/VectorHighlightMapper.cs b/src/contrib/FastVectorHighlighter/VectorHighlightMapper.cs index da2966c..c9c6ced 100644 --- a/src/contrib/FastVectorHighlighter/VectorHighlightMapper.cs +++ b/src/contrib/FastVectorHighlighter/VectorHighlightMapper.cs @@ -1,4 +1,4 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Highlighter/DefaultEncoder.cs ---------------------------------------------------------------------- diff --git a/src/contrib/Highlighter/DefaultEncoder.cs b/src/contrib/Highlighter/DefaultEncoder.cs index 54500a5..ff1efb7 100644 --- a/src/contrib/Highlighter/DefaultEncoder.cs +++ b/src/contrib/Highlighter/DefaultEncoder.cs @@ -17,12 +17,12 @@ namespace Lucene.Net.Search.Highlight { - /// Simple implementation that does not modify the output - public class DefaultEncoder : IEncoder - { - public virtual System.String EncodeText(System.String originalText) - { - return originalText; - } - } + /// Simple implementation that does not modify the output + public class DefaultEncoder : IEncoder + { + public virtual System.String EncodeText(System.String originalText) + { + return originalText; + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Highlighter/GradientFormatter.cs ---------------------------------------------------------------------- diff --git a/src/contrib/Highlighter/GradientFormatter.cs b/src/contrib/Highlighter/GradientFormatter.cs index 6b102a0..3b50d42 100644 --- a/src/contrib/Highlighter/GradientFormatter.cs +++ b/src/contrib/Highlighter/GradientFormatter.cs @@ -19,194 +19,194 @@ using System; namespace Lucene.Net.Search.Highlight { - /// - /// Formats text with different color intensity depending on the score of the term. - /// - public class GradientFormatter : IFormatter - { - private float maxScore; + /// + /// Formats text with different color intensity depending on the score of the term. + /// + public class GradientFormatter : IFormatter + { + private float maxScore; protected internal int fgRMin, fgGMin, fgBMin; protected internal int fgRMax, fgGMax, fgBMax; - protected bool highlightForeground; + protected bool highlightForeground; protected internal int bgRMin, bgGMin, bgBMin; protected internal int bgRMax, bgGMax, bgBMax; - protected bool highlightBackground; - - /// Sets the color range for the IDF scores + protected bool highlightBackground; + + /// Sets the color range for the IDF scores /// - /// The score (and above) displayed as maxColor (See QueryScorer.getMaxWeight - /// which can be used to callibrate scoring scale) - /// + /// The score (and above) displayed as maxColor (See QueryScorer.getMaxWeight + /// which can be used to callibrate scoring scale) + /// /// - /// The hex color used for representing IDF scores of zero eg - /// #FFFFFF (white) or null if no foreground color required - /// + /// The hex color used for representing IDF scores of zero eg + /// #FFFFFF (white) or null if no foreground color required + /// /// - /// The largest hex color used for representing IDF scores eg - /// #000000 (black) or null if no foreground color required - /// + /// The largest hex color used for representing IDF scores eg + /// #000000 (black) or null if no foreground color required + /// /// - /// The hex color used for representing IDF scores of zero eg - /// #FFFFFF (white) or null if no background color required - /// + /// The hex color used for representing IDF scores of zero eg + /// #FFFFFF (white) or null if no background color required + /// /// - /// The largest hex color used for representing IDF scores eg - /// #000000 (black) or null if no background color required - /// - public GradientFormatter(float maxScore, string minForegroundColor, string maxForegroundColor, string minBackgroundColor, string maxBackgroundColor) - { - highlightForeground = (minForegroundColor != null) && (maxForegroundColor != null); + /// The largest hex color used for representing IDF scores eg + /// #000000 (black) or null if no background color required + /// + public GradientFormatter(float maxScore, string minForegroundColor, string maxForegroundColor, string minBackgroundColor, string maxBackgroundColor) + { + highlightForeground = (minForegroundColor != null) && (maxForegroundColor != null); if (highlightForeground) - { - if (minForegroundColor.Length != 7) - { - throw new ArgumentException("minForegroundColor is not 7 bytes long eg a hex " + "RGB value such as #FFFFFF"); - } - if (maxForegroundColor.Length != 7) - { - throw new ArgumentException("minForegroundColor is not 7 bytes long eg a hex " + "RGB value such as #FFFFFF"); - } - fgRMin = HexToInt(minForegroundColor.Substring(1, 2)); - fgGMin = HexToInt(minForegroundColor.Substring(3, 2)); - fgBMin = HexToInt(minForegroundColor.Substring(5, 2)); - - fgRMax = HexToInt(maxForegroundColor.Substring(1, 2)); - fgGMax = HexToInt(maxForegroundColor.Substring(3, 2)); - fgBMax = HexToInt(maxForegroundColor.Substring(5, 2)); - } - - highlightBackground = (minBackgroundColor != null) && (maxBackgroundColor != null); - if (highlightBackground) - { - if (minBackgroundColor.Length != 7) - { - throw new System.ArgumentException("minBackgroundColor is not 7 bytes long eg a hex " + "RGB value such as #FFFFFF"); - } - if (maxBackgroundColor.Length != 7) - { - throw new System.ArgumentException("minBackgroundColor is not 7 bytes long eg a hex " + "RGB value such as #FFFFFF"); - } - bgRMin = HexToInt(minBackgroundColor.Substring(1, 2)); - bgGMin = HexToInt(minBackgroundColor.Substring(3, 2)); - bgBMin = HexToInt(minBackgroundColor.Substring(5, 2)); - - bgRMax = HexToInt(maxBackgroundColor.Substring(1, 2)); - bgGMax = HexToInt(maxBackgroundColor.Substring(3, 2)); - bgBMax = HexToInt(maxBackgroundColor.Substring(5, 2)); - } - // this.corpusReader = corpusReader; - this.maxScore = maxScore; - // totalNumDocs = corpusReader.numDocs(); - } - - public virtual string HighlightTerm(string originalText, TokenGroup tokenGroup) - { - if (tokenGroup.TotalScore == 0) - return originalText; - float score = tokenGroup.TotalScore; - if (score == 0) - { - return originalText; - } + { + if (minForegroundColor.Length != 7) + { + throw new ArgumentException("minForegroundColor is not 7 bytes long eg a hex " + "RGB value such as #FFFFFF"); + } + if (maxForegroundColor.Length != 7) + { + throw new ArgumentException("minForegroundColor is not 7 bytes long eg a hex " + "RGB value such as #FFFFFF"); + } + fgRMin = HexToInt(minForegroundColor.Substring(1, 2)); + fgGMin = HexToInt(minForegroundColor.Substring(3, 2)); + fgBMin = HexToInt(minForegroundColor.Substring(5, 2)); + + fgRMax = HexToInt(maxForegroundColor.Substring(1, 2)); + fgGMax = HexToInt(maxForegroundColor.Substring(3, 2)); + fgBMax = HexToInt(maxForegroundColor.Substring(5, 2)); + } + + highlightBackground = (minBackgroundColor != null) && (maxBackgroundColor != null); + if (highlightBackground) + { + if (minBackgroundColor.Length != 7) + { + throw new System.ArgumentException("minBackgroundColor is not 7 bytes long eg a hex " + "RGB value such as #FFFFFF"); + } + if (maxBackgroundColor.Length != 7) + { + throw new System.ArgumentException("minBackgroundColor is not 7 bytes long eg a hex " + "RGB value such as #FFFFFF"); + } + bgRMin = HexToInt(minBackgroundColor.Substring(1, 2)); + bgGMin = HexToInt(minBackgroundColor.Substring(3, 2)); + bgBMin = HexToInt(minBackgroundColor.Substring(5, 2)); + + bgRMax = HexToInt(maxBackgroundColor.Substring(1, 2)); + bgGMax = HexToInt(maxBackgroundColor.Substring(3, 2)); + bgBMax = HexToInt(maxBackgroundColor.Substring(5, 2)); + } + // this.corpusReader = corpusReader; + this.maxScore = maxScore; + // totalNumDocs = corpusReader.numDocs(); + } + + public virtual string HighlightTerm(string originalText, TokenGroup tokenGroup) + { + if (tokenGroup.TotalScore == 0) + return originalText; + float score = tokenGroup.TotalScore; + if (score == 0) + { + return originalText; + } - var sb = new System.Text.StringBuilder(); - sb.Append(""); - sb.Append(originalText); - sb.Append(""); - return sb.ToString(); - } - - protected internal virtual string GetForegroundColorString(float score) - { - int rVal = GetColorVal(fgRMin, fgRMax, score); - int gVal = GetColorVal(fgGMin, fgGMax, score); - int bVal = GetColorVal(fgBMin, fgBMax, score); - var sb = new System.Text.StringBuilder(); - sb.Append("#"); - sb.Append(IntToHex(rVal)); - sb.Append(IntToHex(gVal)); - sb.Append(IntToHex(bVal)); - return sb.ToString(); - } - - protected internal virtual string GetBackgroundColorString(float score) - { - int rVal = GetColorVal(bgRMin, bgRMax, score); - int gVal = GetColorVal(bgGMin, bgGMax, score); - int bVal = GetColorVal(bgBMin, bgBMax, score); - var sb = new System.Text.StringBuilder(); - sb.Append("#"); - sb.Append(IntToHex(rVal)); - sb.Append(IntToHex(gVal)); - sb.Append(IntToHex(bVal)); - return sb.ToString(); - } - - private int GetColorVal(int colorMin, int colorMax, float score) - { - if (colorMin == colorMax) - { - return colorMin; - } - float scale = Math.Abs(colorMin - colorMax); - float relScorePercent = Math.Min(maxScore, score) / maxScore; - float colScore = scale * relScorePercent; - return Math.Min(colorMin, colorMax) + (int) colScore; - } - - private static char[] hexDigits = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; - - private static string IntToHex(int i) - { - return "" + hexDigits[(i & 0xF0) >> 4] + hexDigits[i & 0x0F]; - } - - /// Converts a hex string into an int. Integer.parseInt(hex, 16) assumes the - /// input is nonnegative unless there is a preceding minus sign. This method - /// reads the input as twos complement instead, so if the input is 8 bytes - /// long, it will correctly restore a negative int produced by - /// Integer.toHexString() but not neccesarily one produced by - /// Integer.toString(x,16) since that method will produce a string like '-FF' - /// for negative integer values. - /// - /// + var sb = new System.Text.StringBuilder(); + sb.Append(""); + sb.Append(originalText); + sb.Append(""); + return sb.ToString(); + } + + protected internal virtual string GetForegroundColorString(float score) + { + int rVal = GetColorVal(fgRMin, fgRMax, score); + int gVal = GetColorVal(fgGMin, fgGMax, score); + int bVal = GetColorVal(fgBMin, fgBMax, score); + var sb = new System.Text.StringBuilder(); + sb.Append("#"); + sb.Append(IntToHex(rVal)); + sb.Append(IntToHex(gVal)); + sb.Append(IntToHex(bVal)); + return sb.ToString(); + } + + protected internal virtual string GetBackgroundColorString(float score) + { + int rVal = GetColorVal(bgRMin, bgRMax, score); + int gVal = GetColorVal(bgGMin, bgGMax, score); + int bVal = GetColorVal(bgBMin, bgBMax, score); + var sb = new System.Text.StringBuilder(); + sb.Append("#"); + sb.Append(IntToHex(rVal)); + sb.Append(IntToHex(gVal)); + sb.Append(IntToHex(bVal)); + return sb.ToString(); + } + + private int GetColorVal(int colorMin, int colorMax, float score) + { + if (colorMin == colorMax) + { + return colorMin; + } + float scale = Math.Abs(colorMin - colorMax); + float relScorePercent = Math.Min(maxScore, score) / maxScore; + float colScore = scale * relScorePercent; + return Math.Min(colorMin, colorMax) + (int) colScore; + } + + private static char[] hexDigits = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; + + private static string IntToHex(int i) + { + return "" + hexDigits[(i & 0xF0) >> 4] + hexDigits[i & 0x0F]; + } + + /// Converts a hex string into an int. Integer.parseInt(hex, 16) assumes the + /// input is nonnegative unless there is a preceding minus sign. This method + /// reads the input as twos complement instead, so if the input is 8 bytes + /// long, it will correctly restore a negative int produced by + /// Integer.toHexString() but not neccesarily one produced by + /// Integer.toString(x,16) since that method will produce a string like '-FF' + /// for negative integer values. + /// + /// /// - /// A string in capital or lower case hex, of no more then 16 - /// characters. - /// + /// A string in capital or lower case hex, of no more then 16 + /// characters. + /// /// if the string is more than 16 characters long, or if any - /// character is not in the set [0-9a-fA-f] - public static int HexToInt(string hex) - { - int len = hex.Length; - if (len > 16) - throw new FormatException(); - - int l = 0; - for (int i = 0; i < len; i++) - { - l <<= 4; - int c = (int) System.Char.GetNumericValue(hex[i]); - if (c < 0) - throw new FormatException(); - l |= c; - } - return l; - } - } + /// character is not in the set [0-9a-fA-f] + public static int HexToInt(string hex) + { + int len = hex.Length; + if (len > 16) + throw new FormatException(); + + int l = 0; + for (int i = 0; i < len; i++) + { + l <<= 4; + int c = (int) System.Char.GetNumericValue(hex[i]); + if (c < 0) + throw new FormatException(); + l |= c; + } + return l; + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Highlighter/Highlighter.cs ---------------------------------------------------------------------- diff --git a/src/contrib/Highlighter/Highlighter.cs b/src/contrib/Highlighter/Highlighter.cs index 28e920e..239c0f7 100644 --- a/src/contrib/Highlighter/Highlighter.cs +++ b/src/contrib/Highlighter/Highlighter.cs @@ -233,10 +233,10 @@ namespace Lucene.Net.Search.Highlight tokenGroup.AddToken(_fragmentScorer.GetTokenScore()); - // if(lastEndOffset>maxDocBytesToAnalyze) - // { - // break; - // } + // if(lastEndOffset>maxDocBytesToAnalyze) + // { + // break; + // } } currentFrag.Score = _fragmentScorer.FragmentScore; @@ -256,10 +256,10 @@ namespace Lucene.Net.Search.Highlight //Test what remains of the original text beyond the point where we stopped analyzing if ( - // if there is text beyond the last token considered.. + // if there is text beyond the last token considered.. (lastEndOffset < text.Length) && - // and that text is not too large... + // and that text is not too large... (text.Length <= _maxDocCharsToAnalyze) ) { http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Highlighter/IEncoder.cs ---------------------------------------------------------------------- diff --git a/src/contrib/Highlighter/IEncoder.cs b/src/contrib/Highlighter/IEncoder.cs index d8cff13..0e45d49 100644 --- a/src/contrib/Highlighter/IEncoder.cs +++ b/src/contrib/Highlighter/IEncoder.cs @@ -17,10 +17,10 @@ namespace Lucene.Net.Search.Highlight { - /// Encodes original text. The IEncoder works with the Formatter to generate the output. - public interface IEncoder - { - /// The section of text being output - string EncodeText(System.String originalText); - } + /// Encodes original text. The IEncoder works with the Formatter to generate the output. + public interface IEncoder + { + /// The section of text being output + string EncodeText(System.String originalText); + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Highlighter/IFormatter.cs ---------------------------------------------------------------------- diff --git a/src/contrib/Highlighter/IFormatter.cs b/src/contrib/Highlighter/IFormatter.cs index 90ca8b3..2164afd 100644 --- a/src/contrib/Highlighter/IFormatter.cs +++ b/src/contrib/Highlighter/IFormatter.cs @@ -17,13 +17,13 @@ namespace Lucene.Net.Search.Highlight { - /// Processes terms found in the original text, typically by applying some form - /// of mark-up to highlight terms in HTML search results pages. - public interface IFormatter - { - /// The section of text being considered for markup - /// contains one or several overlapping Tokens along with - /// their scores and positions. - string HighlightTerm(System.String originalText, TokenGroup tokenGroup); - } + /// Processes terms found in the original text, typically by applying some form + /// of mark-up to highlight terms in HTML search results pages. + public interface IFormatter + { + /// The section of text being considered for markup + /// contains one or several overlapping Tokens along with + /// their scores and positions. + string HighlightTerm(System.String originalText, TokenGroup tokenGroup); + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Highlighter/NullFragmenter.cs ---------------------------------------------------------------------- diff --git a/src/contrib/Highlighter/NullFragmenter.cs b/src/contrib/Highlighter/NullFragmenter.cs index fa73736..c86dda1 100644 --- a/src/contrib/Highlighter/NullFragmenter.cs +++ b/src/contrib/Highlighter/NullFragmenter.cs @@ -19,18 +19,18 @@ using Lucene.Net.Analysis; namespace Lucene.Net.Search.Highlight { - - /// implementation which does not fragment the text. - /// This is useful for highlighting the entire content of a document or field. - /// - public class NullFragmenter : IFragmenter - { - public virtual void Start(string originalText, TokenStream tokenStream) - { } + + /// implementation which does not fragment the text. + /// This is useful for highlighting the entire content of a document or field. + /// + public class NullFragmenter : IFragmenter + { + public virtual void Start(string originalText, TokenStream tokenStream) + { } - public virtual bool IsNewFragment() - { + public virtual bool IsNewFragment() + { return false; - } - } + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Highlighter/QueryTermExtractor.cs ---------------------------------------------------------------------- diff --git a/src/contrib/Highlighter/QueryTermExtractor.cs b/src/contrib/Highlighter/QueryTermExtractor.cs index ba2e1e2..2a5bc7e 100644 --- a/src/contrib/Highlighter/QueryTermExtractor.cs +++ b/src/contrib/Highlighter/QueryTermExtractor.cs @@ -24,36 +24,36 @@ using Lucene.Net.Util; namespace Lucene.Net.Search.Highlight { - - /// Utility class used to extract the terms used in a query, plus any weights. - /// This class will not find terms for MultiTermQuery, RangeQuery and PrefixQuery classes - /// so the caller must pass a rewritten query (see Query.rewrite) to obtain a list of - /// expanded terms. - public static class QueryTermExtractor - { - - /// Extracts all terms texts of a given Query into an array of WeightedTerms - /// - /// - /// Query to extract term texts from - /// - /// an array of the terms used in a query, plus their weights. - /// - public static WeightedTerm[] GetTerms(Query query) - { - return GetTerms(query, false); - } - - /// Extracts all terms texts of a given Query into an array of WeightedTerms - /// - /// - /// Query to extract term texts from - /// used to compute IDF which can be used to a) score selected fragments better - /// b) use graded highlights eg chaning intensity of font color - /// the field on which Inverse Document Frequency (IDF) calculations are based - /// an array of the terms used in a query, plus their weights. - public static WeightedTerm[] GetIdfWeightedTerms(Query query, IndexReader reader, string fieldName) - { + + /// Utility class used to extract the terms used in a query, plus any weights. + /// This class will not find terms for MultiTermQuery, RangeQuery and PrefixQuery classes + /// so the caller must pass a rewritten query (see Query.rewrite) to obtain a list of + /// expanded terms. + public static class QueryTermExtractor + { + + /// Extracts all terms texts of a given Query into an array of WeightedTerms + /// + /// + /// Query to extract term texts from + /// + /// an array of the terms used in a query, plus their weights. + /// + public static WeightedTerm[] GetTerms(Query query) + { + return GetTerms(query, false); + } + + /// Extracts all terms texts of a given Query into an array of WeightedTerms + /// + /// + /// Query to extract term texts from + /// used to compute IDF which can be used to a) score selected fragments better + /// b) use graded highlights eg chaning intensity of font color + /// the field on which Inverse Document Frequency (IDF) calculations are based + /// an array of the terms used in a query, plus their weights. + public static WeightedTerm[] GetIdfWeightedTerms(Query query, IndexReader reader, string fieldName) + { WeightedTerm[] terms = GetTerms(query, false, fieldName); int totalNumDocs = reader.NumDocs(); foreach (WeightedTerm t in terms) @@ -75,16 +75,16 @@ namespace Lucene.Net.Search.Highlight //ignore } } - return terms; - } - - /// Extracts all terms texts of a given Query into an array of WeightedTerms - /// Query to extract term texts from - /// true to extract "prohibited" terms, too - /// The fieldName used to filter query terms - /// an array of the terms used in a query, plus their weights. - public static WeightedTerm[] GetTerms(Query query, bool prohibited, string fieldName) - { + return terms; + } + + /// Extracts all terms texts of a given Query into an array of WeightedTerms + /// Query to extract term texts from + /// true to extract "prohibited" terms, too + /// The fieldName used to filter query terms + /// an array of the terms used in a query, plus their weights. + public static WeightedTerm[] GetTerms(Query query, bool prohibited, string fieldName) + { var terms = new HashSet(); if (fieldName != null) { @@ -92,23 +92,23 @@ namespace Lucene.Net.Search.Highlight } GetTerms(query, terms, prohibited, fieldName); return terms.ToArray(); - } - - /// Extracts all terms texts of a given Query into an array of WeightedTerms - /// - /// - /// Query to extract term texts from - /// - /// true to extract "prohibited" terms, too - /// - /// an array of the terms used in a query, plus their weights. - /// - public static WeightedTerm[] GetTerms(Query query, bool prohibited) - { - return GetTerms(query, prohibited, null); - } - - //fieldname MUST be interned prior to this call + } + + /// Extracts all terms texts of a given Query into an array of WeightedTerms + /// + /// + /// Query to extract term texts from + /// + /// true to extract "prohibited" terms, too + /// + /// an array of the terms used in a query, plus their weights. + /// + public static WeightedTerm[] GetTerms(Query query, bool prohibited) + { + return GetTerms(query, prohibited, null); + } + + //fieldname MUST be interned prior to this call private static void GetTerms(Query query, HashSet terms, bool prohibited, string fieldName) { try @@ -136,28 +136,28 @@ namespace Lucene.Net.Search.Highlight } } - /// extractTerms is currently the only query-independent means of introspecting queries but it only reveals - /// a list of terms for that query - not the boosts each individual term in that query may or may not have. - /// "Container" queries such as BooleanQuery should be unwrapped to get at the boost info held - /// in each child element. - /// Some discussion around this topic here: - /// http://www.gossamer-threads.com/lists/lucene/java-dev/34208?search_string=introspection;#34208 - /// Unfortunately there seemed to be limited interest in requiring all Query objects to implement - /// something common which would allow access to child queries so what follows here are query-specific - /// implementations for accessing embedded query elements. - /// - private static void GetTermsFromBooleanQuery(BooleanQuery query, HashSet terms, bool prohibited, string fieldName) - { + /// extractTerms is currently the only query-independent means of introspecting queries but it only reveals + /// a list of terms for that query - not the boosts each individual term in that query may or may not have. + /// "Container" queries such as BooleanQuery should be unwrapped to get at the boost info held + /// in each child element. + /// Some discussion around this topic here: + /// http://www.gossamer-threads.com/lists/lucene/java-dev/34208?search_string=introspection;#34208 + /// Unfortunately there seemed to be limited interest in requiring all Query objects to implement + /// something common which would allow access to child queries so what follows here are query-specific + /// implementations for accessing embedded query elements. + /// + private static void GetTermsFromBooleanQuery(BooleanQuery query, HashSet terms, bool prohibited, string fieldName) + { BooleanClause[] queryClauses = query.GetClauses(); for (int i = 0; i < queryClauses.Length; i++) { if (prohibited || queryClauses[i].Occur != Occur.MUST_NOT) GetTerms(queryClauses[i].Query, terms, prohibited, fieldName); } - } + } private static void GetTermsFromFilteredQuery(FilteredQuery query, HashSet terms, bool prohibited, string fieldName) - { - GetTerms(query.Query, terms, prohibited, fieldName); - } - } + { + GetTerms(query.Query, terms, prohibited, fieldName); + } + } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Highlighter/SimpleHTMLFormatter.cs ---------------------------------------------------------------------- diff --git a/src/contrib/Highlighter/SimpleHTMLFormatter.cs b/src/contrib/Highlighter/SimpleHTMLFormatter.cs index 0013f2a..ea51b05 100644 --- a/src/contrib/Highlighter/SimpleHTMLFormatter.cs +++ b/src/contrib/Highlighter/SimpleHTMLFormatter.cs @@ -17,47 +17,47 @@ namespace Lucene.Net.Search.Highlight { - /// Simple implementation to highlight terms with a pre and post tag - /// MAHarwood - /// - /// - public class SimpleHTMLFormatter : IFormatter - { - internal System.String preTag; - internal System.String postTag; - - - public SimpleHTMLFormatter(System.String preTag, System.String postTag) - { - this.preTag = preTag; - this.postTag = postTag; - } - - /// Default constructor uses HTML: <B> tags to markup terms - /// - /// - /// - public SimpleHTMLFormatter() - { - this.preTag = ""; - this.postTag = ""; - } - - /* (non-Javadoc) - * - */ - public virtual System.String HighlightTerm(System.String originalText, TokenGroup tokenGroup) - { - System.Text.StringBuilder returnBuffer; - if (tokenGroup.TotalScore > 0) - { - returnBuffer = new System.Text.StringBuilder(); - returnBuffer.Append(preTag); - returnBuffer.Append(originalText); - returnBuffer.Append(postTag); - return returnBuffer.ToString(); - } - return originalText; - } - } + /// Simple implementation to highlight terms with a pre and post tag + /// MAHarwood + /// + /// + public class SimpleHTMLFormatter : IFormatter + { + internal System.String preTag; + internal System.String postTag; + + + public SimpleHTMLFormatter(System.String preTag, System.String postTag) + { + this.preTag = preTag; + this.postTag = postTag; + } + + /// Default constructor uses HTML: <B> tags to markup terms + /// + /// + /// + public SimpleHTMLFormatter() + { + this.preTag = ""; + this.postTag = ""; + } + + /* (non-Javadoc) + * + */ + public virtual System.String HighlightTerm(System.String originalText, TokenGroup tokenGroup) + { + System.Text.StringBuilder returnBuffer; + if (tokenGroup.TotalScore > 0) + { + returnBuffer = new System.Text.StringBuilder(); + returnBuffer.Append(preTag); + returnBuffer.Append(originalText); + returnBuffer.Append(postTag); + return returnBuffer.ToString(); + } + return originalText; + } + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Highlighter/TokenSources.cs ---------------------------------------------------------------------- diff --git a/src/contrib/Highlighter/TokenSources.cs b/src/contrib/Highlighter/TokenSources.cs index dc44bb5..745ac2a 100644 --- a/src/contrib/Highlighter/TokenSources.cs +++ b/src/contrib/Highlighter/TokenSources.cs @@ -144,8 +144,8 @@ namespace Lucene.Net.Search.Highlight /// - reanalyzing the original content - 980 milliseconds /// /// The re-analyze timings will typically vary depending on - - /// 1) The complexity of the analyzer code (timings above were using a - /// stemmer/lowercaser/stopword combo) + /// 1) The complexity of the analyzer code (timings above were using a + /// stemmer/lowercaser/stopword combo) /// 2) The number of other fields (Lucene reads ALL fields off the disk /// when accessing just one document field - can cost dear!) /// 3) Use of compression on field storage - could be faster due to compression (less disk IO) http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Highlighter/WeightedSpanTerm.cs ---------------------------------------------------------------------- diff --git a/src/contrib/Highlighter/WeightedSpanTerm.cs b/src/contrib/Highlighter/WeightedSpanTerm.cs index 7d94383..d89b915 100644 --- a/src/contrib/Highlighter/WeightedSpanTerm.cs +++ b/src/contrib/Highlighter/WeightedSpanTerm.cs @@ -1,4 +1,4 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Queries/BooleanFilter.cs ---------------------------------------------------------------------- diff --git a/src/contrib/Queries/BooleanFilter.cs b/src/contrib/Queries/BooleanFilter.cs index e964498..de4b8fd 100644 --- a/src/contrib/Queries/BooleanFilter.cs +++ b/src/contrib/Queries/BooleanFilter.cs @@ -1,4 +1,4 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Queries/BoostingQuery.cs ---------------------------------------------------------------------- diff --git a/src/contrib/Queries/BoostingQuery.cs b/src/contrib/Queries/BoostingQuery.cs index d2716be..5d57d2c 100644 --- a/src/contrib/Queries/BoostingQuery.cs +++ b/src/contrib/Queries/BoostingQuery.cs @@ -1,4 +1,4 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Queries/DuplicateFilter.cs ---------------------------------------------------------------------- diff --git a/src/contrib/Queries/DuplicateFilter.cs b/src/contrib/Queries/DuplicateFilter.cs index 274f8ab..d5f4745 100644 --- a/src/contrib/Queries/DuplicateFilter.cs +++ b/src/contrib/Queries/DuplicateFilter.cs @@ -1,4 +1,4 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Queries/FilterClause.cs ---------------------------------------------------------------------- diff --git a/src/contrib/Queries/FilterClause.cs b/src/contrib/Queries/FilterClause.cs index 06f6ef4..f292914 100644 --- a/src/contrib/Queries/FilterClause.cs +++ b/src/contrib/Queries/FilterClause.cs @@ -1,4 +1,4 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Queries/FuzzyLikeThisQuery.cs ---------------------------------------------------------------------- diff --git a/src/contrib/Queries/FuzzyLikeThisQuery.cs b/src/contrib/Queries/FuzzyLikeThisQuery.cs index c28d94c..09f1c8c 100644 --- a/src/contrib/Queries/FuzzyLikeThisQuery.cs +++ b/src/contrib/Queries/FuzzyLikeThisQuery.cs @@ -1,4 +1,4 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Queries/Properties/AssemblyInfo.cs ---------------------------------------------------------------------- diff --git a/src/contrib/Queries/Properties/AssemblyInfo.cs b/src/contrib/Queries/Properties/AssemblyInfo.cs index fd774f2..0938b45 100644 --- a/src/contrib/Queries/Properties/AssemblyInfo.cs +++ b/src/contrib/Queries/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -/* +/* * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Queries/Similar/MoreLikeThis.cs ---------------------------------------------------------------------- diff --git a/src/contrib/Queries/Similar/MoreLikeThis.cs b/src/contrib/Queries/Similar/MoreLikeThis.cs index 7b5f335..62883a8 100644 --- a/src/contrib/Queries/Similar/MoreLikeThis.cs +++ b/src/contrib/Queries/Similar/MoreLikeThis.cs @@ -1,4 +1,4 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. @@ -780,30 +780,30 @@ namespace Lucene.Net.Search.Similar private void AddTermFrequencies(System.IO.TextReader r, IDictionary termFreqMap, System.String fieldName) { TokenStream ts = analyzer.TokenStream(fieldName, r); - int tokenCount=0; - // for every token + int tokenCount=0; + // for every token ITermAttribute termAtt = ts.AddAttribute(); - - while (ts.IncrementToken()) { - string word = termAtt.Term; - tokenCount++; - if(tokenCount>maxNumTokensParsed) - { - break; - } - if(IsNoiseWord(word)){ - continue; - } - - // increment frequency - Int cnt = termFreqMap[word]; - if (cnt == null) { + + while (ts.IncrementToken()) { + string word = termAtt.Term; + tokenCount++; + if(tokenCount>maxNumTokensParsed) + { + break; + } + if(IsNoiseWord(word)){ + continue; + } + + // increment frequency + Int cnt = termFreqMap[word]; + if (cnt == null) { termFreqMap[word] = new Int(); - } - else { - cnt.x++; - } - } + } + else { + cnt.x++; + } + } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Queries/Similar/MoreLikeThisQuery.cs ---------------------------------------------------------------------- diff --git a/src/contrib/Queries/Similar/MoreLikeThisQuery.cs b/src/contrib/Queries/Similar/MoreLikeThisQuery.cs index 7cd4681..ae071c0 100644 --- a/src/contrib/Queries/Similar/MoreLikeThisQuery.cs +++ b/src/contrib/Queries/Similar/MoreLikeThisQuery.cs @@ -1,4 +1,4 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Queries/Similar/SimilarityQueries.cs ---------------------------------------------------------------------- diff --git a/src/contrib/Queries/Similar/SimilarityQueries.cs b/src/contrib/Queries/Similar/SimilarityQueries.cs index 8a1f38b..2bbd5d4 100644 --- a/src/contrib/Queries/Similar/SimilarityQueries.cs +++ b/src/contrib/Queries/Similar/SimilarityQueries.cs @@ -1,4 +1,4 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Queries/TermsFilter.cs ---------------------------------------------------------------------- diff --git a/src/contrib/Queries/TermsFilter.cs b/src/contrib/Queries/TermsFilter.cs index 263d2f5..3426732 100644 --- a/src/contrib/Queries/TermsFilter.cs +++ b/src/contrib/Queries/TermsFilter.cs @@ -1,4 +1,4 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Regex/CSharpRegexCapabilities.cs ---------------------------------------------------------------------- diff --git a/src/contrib/Regex/CSharpRegexCapabilities.cs b/src/contrib/Regex/CSharpRegexCapabilities.cs index 312ec4a..21174a2 100644 --- a/src/contrib/Regex/CSharpRegexCapabilities.cs +++ b/src/contrib/Regex/CSharpRegexCapabilities.cs @@ -1,4 +1,4 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. @@ -19,73 +19,73 @@ using System; namespace Contrib.Regex { - /// - /// C# Regex based implementation of . - /// - /// http://www.java2s.com/Open-Source/Java-Document/Net/lucene-connector/org/apache/lucene/search/regex/JavaUtilRegexCapabilities.java.htm - public class CSharpRegexCapabilities : IRegexCapabilities, IEquatable - { - private System.Text.RegularExpressions.Regex _rPattern; + /// + /// C# Regex based implementation of . + /// + /// http://www.java2s.com/Open-Source/Java-Document/Net/lucene-connector/org/apache/lucene/search/regex/JavaUtilRegexCapabilities.java.htm + public class CSharpRegexCapabilities : IRegexCapabilities, IEquatable + { + private System.Text.RegularExpressions.Regex _rPattern; - /// - /// Called by the constructor of allowing implementations to cache - /// a compiled version of the regular expression pattern. - /// - /// regular expression pattern - public void Compile(string pattern) - { - _rPattern = new System.Text.RegularExpressions.Regex(pattern, - System.Text.RegularExpressions.RegexOptions.Compiled); - } + /// + /// Called by the constructor of allowing implementations to cache + /// a compiled version of the regular expression pattern. + /// + /// regular expression pattern + public void Compile(string pattern) + { + _rPattern = new System.Text.RegularExpressions.Regex(pattern, + System.Text.RegularExpressions.RegexOptions.Compiled); + } - /// - /// True on match. - /// - /// text to match - /// true on match - public bool Match(string s) - { - return _rPattern.IsMatch(s); - } + /// + /// True on match. + /// + /// text to match + /// true on match + public bool Match(string s) + { + return _rPattern.IsMatch(s); + } - /// - /// A wise prefix implementation can reduce the term enumeration (and thus performance) - /// of RegexQuery dramatically. - /// - /// static non-regex prefix of the pattern last passed to . - /// May return null - public string Prefix() - { - return null; - } + /// + /// A wise prefix implementation can reduce the term enumeration (and thus performance) + /// of RegexQuery dramatically. + /// + /// static non-regex prefix of the pattern last passed to . + /// May return null + public string Prefix() + { + return null; + } - /// - /// Indicates whether the current object is equal to another object of the same type. - /// - /// - /// true if the current object is equal to the parameter; otherwise, false. - /// - /// An object to compare with this object - public bool Equals(CSharpRegexCapabilities other) - { - if (other == null) return false; - if (this == other) return true; + /// + /// Indicates whether the current object is equal to another object of the same type. + /// + /// + /// true if the current object is equal to the parameter; otherwise, false. + /// + /// An object to compare with this object + public bool Equals(CSharpRegexCapabilities other) + { + if (other == null) return false; + if (this == other) return true; - if (_rPattern != null ? !_rPattern.Equals(other._rPattern) : other._rPattern != null) - return false; + if (_rPattern != null ? !_rPattern.Equals(other._rPattern) : other._rPattern != null) + return false; - return true; - } + return true; + } - public override bool Equals(object obj) - { - if (obj as CSharpRegexCapabilities == null) return false; - return Equals((CSharpRegexCapabilities) obj); - } + public override bool Equals(object obj) + { + if (obj as CSharpRegexCapabilities == null) return false; + return Equals((CSharpRegexCapabilities) obj); + } - public override int GetHashCode() - { - return (_rPattern != null ? _rPattern.GetHashCode() : 0); - } - } + public override int GetHashCode() + { + return (_rPattern != null ? _rPattern.GetHashCode() : 0); + } + } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Regex/IRegexCapabilities.cs ---------------------------------------------------------------------- diff --git a/src/contrib/Regex/IRegexCapabilities.cs b/src/contrib/Regex/IRegexCapabilities.cs index 64f71ea..e5225eb 100644 --- a/src/contrib/Regex/IRegexCapabilities.cs +++ b/src/contrib/Regex/IRegexCapabilities.cs @@ -1,4 +1,4 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. @@ -17,32 +17,32 @@ namespace Contrib.Regex { - /// - /// Defines basic operations needed by for a regular expression implementation. - /// - /// http://www.java2s.com/Open-Source/Java-Document/Net/lucene-connector/org/apache/lucene/search/regex/RegexCapabilities.java.htm - public interface IRegexCapabilities - { - /// - /// Called by the constructor of allowing implementations to cache - /// a compiled version of the regular expression pattern. - /// - /// regular expression pattern - void Compile(string pattern); + /// + /// Defines basic operations needed by for a regular expression implementation. + /// + /// http://www.java2s.com/Open-Source/Java-Document/Net/lucene-connector/org/apache/lucene/search/regex/RegexCapabilities.java.htm + public interface IRegexCapabilities + { + /// + /// Called by the constructor of allowing implementations to cache + /// a compiled version of the regular expression pattern. + /// + /// regular expression pattern + void Compile(string pattern); - /// - /// True on match. - /// - /// text to match - /// true on match - bool Match(string s); + /// + /// True on match. + /// + /// text to match + /// true on match + bool Match(string s); - /// - /// A wise prefix implementation can reduce the term enumeration (and thus performance) - /// of RegexQuery dramatically. - /// - /// static non-regex prefix of the pattern last passed to . - /// May return null - string Prefix(); - } + /// + /// A wise prefix implementation can reduce the term enumeration (and thus performance) + /// of RegexQuery dramatically. + /// + /// static non-regex prefix of the pattern last passed to . + /// May return null + string Prefix(); + } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Regex/IRegexQueryCapable.cs ---------------------------------------------------------------------- diff --git a/src/contrib/Regex/IRegexQueryCapable.cs b/src/contrib/Regex/IRegexQueryCapable.cs index d9692b6..b65513b 100644 --- a/src/contrib/Regex/IRegexQueryCapable.cs +++ b/src/contrib/Regex/IRegexQueryCapable.cs @@ -1,4 +1,4 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. @@ -17,12 +17,12 @@ namespace Contrib.Regex { - /// - /// Defines methods for regular expression supporting queries to use. - /// - /// http://www.java2s.com/Open-Source/Java-Document/Net/lucene-connector/org/apache/lucene/search/regex/RegexQueryCapable.java.htm - public interface IRegexQueryCapable - { - IRegexCapabilities RegexImplementation { set; get; } - } + /// + /// Defines methods for regular expression supporting queries to use. + /// + /// http://www.java2s.com/Open-Source/Java-Document/Net/lucene-connector/org/apache/lucene/search/regex/RegexQueryCapable.java.htm + public interface IRegexQueryCapable + { + IRegexCapabilities RegexImplementation { set; get; } + } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/62f018ab/src/contrib/Regex/Properties/AssemblyInfo.cs ---------------------------------------------------------------------- diff --git a/src/contrib/Regex/Properties/AssemblyInfo.cs b/src/contrib/Regex/Properties/AssemblyInfo.cs index 36cbb93..c9ff782 100644 --- a/src/contrib/Regex/Properties/AssemblyInfo.cs +++ b/src/contrib/Regex/Properties/AssemblyInfo.cs @@ -1,4 +1,4 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership.