You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by pn...@apache.org on 2011/05/07 23:34:19 UTC
[Lucene.Net] svn commit: r1100632 - in /incubator/lucene.net/branches/Lucene.Net_2_9_4g:
./ build/vs2010/contrib/ build/vs2010/test/ src/contrib/Regex/
src/contrib/Regex/Properties/ src/core/ src/core/Search/Regex/ test/core/
test/core/Search/Regex/
Author: pnasser
Date: Sat May 7 21:34:19 2011
New Revision: 1100632
URL: http://svn.apache.org/viewvc?rev=1100632&view=rev
Log:
LULUCENENET-371 & LUCENENET-330 - Moving to Contrib, created solution files in build/vs2010
Added:
incubator/lucene.net/branches/Lucene.Net_2_9_4g/build/vs2010/contrib/Contrib.Regex.sln
incubator/lucene.net/branches/Lucene.Net_2_9_4g/build/vs2010/test/Contrib.Regex.Test.sln
incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/
incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/CSharpRegexCapabilities.cs
incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/Contrib.Regex.csproj
incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/Contrib.Regex.suo (with props)
incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/IRegexCapabilities.cs
incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/IRegexQueryCapable.cs
incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/Properties/
incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/Properties/AssemblyInfo.cs
incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/RegexQuery.cs
incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/RegexTermEnum.cs
incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/SpanRegexQuery.cs
Removed:
incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Search/Regex/
incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Search/Regex/
Modified:
incubator/lucene.net/branches/Lucene.Net_2_9_4g/DIFFs FROM 2.9.4.txt
incubator/lucene.net/branches/Lucene.Net_2_9_4g/build/vs2010/contrib/Contrib.All.sln
incubator/lucene.net/branches/Lucene.Net_2_9_4g/build/vs2010/test/Contrib.All.Test.sln
incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Lucene.Net.csproj
incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Lucene.Net.Test.csproj
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/DIFFs FROM 2.9.4.txt
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/DIFFs%20FROM%202.9.4.txt?rev=1100632&r1=1100631&r2=1100632&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/DIFFs FROM 2.9.4.txt (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/DIFFs FROM 2.9.4.txt Sat May 7 21:34:19 2011
@@ -12,7 +12,7 @@
* LUCENENET-172 (fix for unexceptional exceptions ecountered in FastCharStream)
-* LUCENENET-330 Search.Regex Minimal Port
+* LUCENENET-330 Search.Regex Minimal Port
* LUCENENET-371 Unit test for Search.Regex port
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/build/vs2010/contrib/Contrib.All.sln
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/build/vs2010/contrib/Contrib.All.sln?rev=1100632&r1=1100631&r2=1100632&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/build/vs2010/contrib/Contrib.All.sln (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/build/vs2010/contrib/Contrib.All.sln Sat May 7 21:34:19 2011
@@ -1,6 +1,6 @@

Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual C# Express 2010
+# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lucene.Net", "..\..\..\src\core\Lucene.Net.csproj", "{5D4AD9BE-1FFB-41AB-9943-25737971BF57}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Contrib.Core", "..\..\..\src\contrib\Core\Contrib.Core.csproj", "{FEF899EB-610C-4D3C-A556-A01F56F4AFE0}"
@@ -27,6 +27,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Contrib.WordNet.Syns2Index", "..\..\..\src\contrib\WordNet\Syns2Index\Contrib.WordNet.Syns2Index.csproj", "{7563D4D9-AE91-42BA-A270-1D264660F6DF}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Contrib.Regex", "..\..\..\src\contrib\Regex\Contrib.Regex.csproj", "{A26BD3B7-DF90-43B4-99E2-6A617CDE1579}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -85,6 +87,10 @@ Global
{7563D4D9-AE91-42BA-A270-1D264660F6DF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7563D4D9-AE91-42BA-A270-1D264660F6DF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7563D4D9-AE91-42BA-A270-1D264660F6DF}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A26BD3B7-DF90-43B4-99E2-6A617CDE1579}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A26BD3B7-DF90-43B4-99E2-6A617CDE1579}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A26BD3B7-DF90-43B4-99E2-6A617CDE1579}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A26BD3B7-DF90-43B4-99E2-6A617CDE1579}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Added: incubator/lucene.net/branches/Lucene.Net_2_9_4g/build/vs2010/contrib/Contrib.Regex.sln
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/build/vs2010/contrib/Contrib.Regex.sln?rev=1100632&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/build/vs2010/contrib/Contrib.Regex.sln (added)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/build/vs2010/contrib/Contrib.Regex.sln Sat May 7 21:34:19 2011
@@ -0,0 +1,22 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lucene.Net", "..\..\..\src\core\Lucene.Net.csproj", "{5D4AD9BE-1FFB-41AB-9943-25737971BF57}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Contrib.Core", "..\..\..\src\contrib\Regex\Contrib.Regex.csproj", "{A26BD3B7-DF90-43B4-99E2-6A617CDE1579}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {A26BD3B7-DF90-43B4-99E2-6A617CDE1579}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A26BD3B7-DF90-43B4-99E2-6A617CDE1579}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A26BD3B7-DF90-43B4-99E2-6A617CDE1579}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A26BD3B7-DF90-43B4-99E2-6A617CDE1579}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/build/vs2010/test/Contrib.All.Test.sln
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/build/vs2010/test/Contrib.All.Test.sln?rev=1100632&r1=1100631&r2=1100632&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/build/vs2010/test/Contrib.All.Test.sln (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/build/vs2010/test/Contrib.All.Test.sln Sat May 7 21:34:19 2011
@@ -1,6 +1,6 @@

Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual C# Express 2010
+# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lucene.Net", "..\..\..\src\core\Lucene.Net.csproj", "{5D4AD9BE-1FFB-41AB-9943-25737971BF57}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Contrib.Core", "..\..\..\src\contrib\Core\Contrib.Core.csproj", "{FEF899EB-610C-4D3C-A556-A01F56F4AFE0}"
@@ -39,6 +39,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demo.Common", "..\..\..\src\demo\Demo.Common\Demo.Common.csproj", "{F04CA2F4-E182-46A8-B914-F46AF5319E83}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Contrib.Regex.Test", "..\..\..\test\contrib\Regex\Contrib.Regex.Test.csproj", "{F1875552-0E59-46AA-976E-6183733FD2AB}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Contrib.Regex", "..\..\..\src\contrib\Regex\Contrib.Regex.csproj", "{A26BD3B7-DF90-43B4-99E2-6A617CDE1579}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -121,6 +125,14 @@ Global
{F04CA2F4-E182-46A8-B914-F46AF5319E83}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F04CA2F4-E182-46A8-B914-F46AF5319E83}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F04CA2F4-E182-46A8-B914-F46AF5319E83}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F1875552-0E59-46AA-976E-6183733FD2AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F1875552-0E59-46AA-976E-6183733FD2AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F1875552-0E59-46AA-976E-6183733FD2AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F1875552-0E59-46AA-976E-6183733FD2AB}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A26BD3B7-DF90-43B4-99E2-6A617CDE1579}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A26BD3B7-DF90-43B4-99E2-6A617CDE1579}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A26BD3B7-DF90-43B4-99E2-6A617CDE1579}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A26BD3B7-DF90-43B4-99E2-6A617CDE1579}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Added: incubator/lucene.net/branches/Lucene.Net_2_9_4g/build/vs2010/test/Contrib.Regex.Test.sln
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/build/vs2010/test/Contrib.Regex.Test.sln?rev=1100632&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/build/vs2010/test/Contrib.Regex.Test.sln (added)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/build/vs2010/test/Contrib.Regex.Test.sln Sat May 7 21:34:19 2011
@@ -0,0 +1,29 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lucene.Net", "..\..\..\src\core\Lucene.Net.csproj", "{5D4AD9BE-1FFB-41AB-9943-25737971BF57}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Contrib.Regex", "..\..\..\src\contrib\Regex\Contrib.Regex.csproj", "{481CF6E3-52AF-4621-9DEB-022122079AF6}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lucene.Net.Test", "..\..\..\test\core\Lucene.Net.Test.csproj", "{AAF68BCF-F781-45FC-98B3-2B9CEE411E01}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Contrib.Regex.Test", "..\..\..\test\contrib\Regex\Contrib.Regex.Test.csproj", "{F1875552-0E59-46AA-976E-6183733FD2AB}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Demo.Common", "..\..\..\src\demo\Demo.Common\Demo.Common.csproj", "{F04CA2F4-E182-46A8-B914-F46AF5319E83}"
+EndProject
+
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {F1875552-0E59-46AA-976E-6183733FD2AB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F1875552-0E59-46AA-976E-6183733FD2AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F1875552-0E59-46AA-976E-6183733FD2AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F1875552-0E59-46AA-976E-6183733FD2AB}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
Added: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/CSharpRegexCapabilities.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/CSharpRegexCapabilities.cs?rev=1100632&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/CSharpRegexCapabilities.cs (added)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/CSharpRegexCapabilities.cs Sat May 7 21:34:19 2011
@@ -0,0 +1,91 @@
+/*
+ * 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.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+
+namespace Lucene.Net.Search.Regex
+{
+ /// <summary>
+ /// C# Regex based implementation of <see cref="IRegexCapabilities"/>.
+ /// </summary>
+ /// <remarks>http://www.java2s.com/Open-Source/Java-Document/Net/lucene-connector/org/apache/lucene/search/regex/JavaUtilRegexCapabilities.java.htm</remarks>
+ public class CSharpRegexCapabilities : IRegexCapabilities, IEquatable<CSharpRegexCapabilities>
+ {
+ private System.Text.RegularExpressions.Regex _rPattern;
+
+ /// <summary>
+ /// Called by the constructor of <see cref="RegexTermEnum"/> allowing implementations to cache
+ /// a compiled version of the regular expression pattern.
+ /// </summary>
+ /// <param name="pattern">regular expression pattern</param>
+ public void Compile(string pattern)
+ {
+ _rPattern = new System.Text.RegularExpressions.Regex(pattern,
+ System.Text.RegularExpressions.RegexOptions.Compiled);
+ }
+
+ /// <summary>
+ /// True on match.
+ /// </summary>
+ /// <param name="s">text to match</param>
+ /// <returns>true on match</returns>
+ public bool Match(string s)
+ {
+ return _rPattern.IsMatch(s);
+ }
+
+ /// <summary>
+ /// A wise prefix implementation can reduce the term enumeration (and thus performance)
+ /// of RegexQuery dramatically.
+ /// </summary>
+ /// <returns>static non-regex prefix of the pattern last passed to <see cref="IRegexCapabilities.Compile"/>.
+ /// May return null</returns>
+ public string Prefix()
+ {
+ return null;
+ }
+
+ /// <summary>
+ /// Indicates whether the current object is equal to another object of the same type.
+ /// </summary>
+ /// <returns>
+ /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
+ /// </returns>
+ /// <param name="other">An object to compare with this object</param>
+ 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;
+
+ return true;
+ }
+
+ 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);
+ }
+ }
+}
Added: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/Contrib.Regex.csproj
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/Contrib.Regex.csproj?rev=1100632&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/Contrib.Regex.csproj (added)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/Contrib.Regex.csproj Sat May 7 21:34:19 2011
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{A26BD3B7-DF90-43B4-99E2-6A617CDE1579}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Contrib.Regex</RootNamespace>
+ <AssemblyName>Contrib.Regex</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\..\..\bin\contrib\Regex\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="CSharpRegexCapabilities.cs" />
+ <Compile Include="IRegexCapabilities.cs" />
+ <Compile Include="IRegexQueryCapable.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="RegexQuery.cs" />
+ <Compile Include="RegexTermEnum.cs" />
+ <Compile Include="SpanRegexQuery.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\core\Lucene.Net.csproj">
+ <Project>{5D4AD9BE-1FFB-41AB-9943-25737971BF57}</Project>
+ <Name>Lucene.Net</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
Added: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/Contrib.Regex.suo
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/Contrib.Regex.suo?rev=1100632&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/Contrib.Regex.suo
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/IRegexCapabilities.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/IRegexCapabilities.cs?rev=1100632&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/IRegexCapabilities.cs (added)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/IRegexCapabilities.cs Sat May 7 21:34:19 2011
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Lucene.Net.Search.Regex
+{
+ /// <summary>
+ /// Defines basic operations needed by {@link RegexQuery} for a regular expression implementation.
+ /// </summary>
+ /// <remarks>http://www.java2s.com/Open-Source/Java-Document/Net/lucene-connector/org/apache/lucene/search/regex/RegexCapabilities.java.htm</remarks>
+ public interface IRegexCapabilities
+ {
+ /// <summary>
+ /// Called by the constructor of <see cref="RegexTermEnum"/> allowing implementations to cache
+ /// a compiled version of the regular expression pattern.
+ /// </summary>
+ /// <param name="pattern">regular expression pattern</param>
+ void Compile(string pattern);
+
+ /// <summary>
+ /// True on match.
+ /// </summary>
+ /// <param name="s">text to match</param>
+ /// <returns>true on match</returns>
+ bool Match(string s);
+
+ /// <summary>
+ /// A wise prefix implementation can reduce the term enumeration (and thus performance)
+ /// of RegexQuery dramatically.
+ /// </summary>
+ /// <returns>static non-regex prefix of the pattern last passed to <see cref="Compile"/>.
+ /// May return null</returns>
+ string Prefix();
+ }
+}
Added: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/IRegexQueryCapable.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/IRegexQueryCapable.cs?rev=1100632&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/IRegexQueryCapable.cs (added)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/IRegexQueryCapable.cs Sat May 7 21:34:19 2011
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Lucene.Net.Search.Regex
+{
+ /// <summary>
+ /// Defines methods for regular expression supporting queries to use.
+ /// </summary>
+ /// <remarks>http://www.java2s.com/Open-Source/Java-Document/Net/lucene-connector/org/apache/lucene/search/regex/RegexQueryCapable.java.htm</remarks>
+ public interface IRegexQueryCapable
+ {
+ void SetRegexImplementation(IRegexCapabilities impl);
+ IRegexCapabilities GetRegexImplementation();
+ }
+}
Added: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/Properties/AssemblyInfo.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/Properties/AssemblyInfo.cs?rev=1100632&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/Properties/AssemblyInfo.cs (added)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/Properties/AssemblyInfo.cs Sat May 7 21:34:19 2011
@@ -0,0 +1,53 @@
+/**
+ * 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.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Lucene.Net.Contrib.Regex")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("The Apache Software Foundation")]
+[assembly: AssemblyProduct("Lucene.Net.Contrib.Regex")]
+[assembly: AssemblyCopyright("Copyright 2006 - 2011 The Apache Software Foundation")]
+[assembly: AssemblyTrademark("Copyright 2006 - 2011 The Apache Software Foundation")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("7c479233-95a2-4d53-b0fd-0ad2389556b1")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("2.9.4")]
+[assembly: AssemblyFileVersion("2.9.4")]
Added: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/RegexQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/RegexQuery.cs?rev=1100632&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/RegexQuery.cs (added)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/RegexQuery.cs Sat May 7 21:34:19 2011
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using Lucene.Net.Index;
+
+namespace Lucene.Net.Search.Regex
+{
+ /// <summary>
+ /// Regular expression based query.
+ /// </summary>
+ /// <remarks>http://www.java2s.com/Open-Source/Java-Document/Net/lucene-connector/org/apache/lucene/search/regex/RegexQuery.java.htm</remarks>
+ public class RegexQuery : MultiTermQuery, IRegexQueryCapable, IEquatable<RegexQuery>
+ {
+ private IRegexCapabilities _regexImpl = new CSharpRegexCapabilities();
+
+ public RegexQuery(Term term) : base(term)
+ {
+ }
+
+ /// <summary>Construct the enumeration to be used, expanding the pattern term. </summary>
+ public override FilteredTermEnum GetEnum(IndexReader reader)
+ {
+ Term term = new Term(GetTerm().Field(), GetTerm().Text());
+ return new RegexTermEnum(reader, term, _regexImpl);
+ }
+
+ public void SetRegexImplementation(IRegexCapabilities impl)
+ {
+ _regexImpl = impl;
+ }
+
+ public IRegexCapabilities GetRegexImplementation()
+ {
+ return _regexImpl;
+ }
+
+ /// <summary>
+ /// Indicates whether the current object is equal to another object of the same type.
+ /// </summary>
+ /// <returns>
+ /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
+ /// </returns>
+ /// <param name="other">An object to compare with this object</param>
+ public bool Equals(RegexQuery other)
+ {
+ if (other == null) return false;
+ if (this == other) return true;
+
+ if (!base.Equals(other)) return false;
+ return _regexImpl.Equals(other._regexImpl);
+ }
+
+ public override bool Equals(object obj)
+ {
+ if ((obj == null) || (obj as RegexQuery == null)) return false;
+ if (this == obj) return true;
+
+ return Equals((RegexQuery) obj);
+ }
+
+ public override int GetHashCode()
+ {
+ return 29 * base.GetHashCode() + _regexImpl.GetHashCode();
+ }
+ }
+}
Added: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/RegexTermEnum.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/RegexTermEnum.cs?rev=1100632&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/RegexTermEnum.cs (added)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/RegexTermEnum.cs Sat May 7 21:34:19 2011
@@ -0,0 +1,83 @@
+/*
+ * 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.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using Lucene.Net.Index;
+
+namespace Lucene.Net.Search.Regex
+{
+ /// <summary>
+ /// Subclass of FilteredTermEnum for enumerating all terms that match the
+ /// specified regular expression term using the specified regular expression
+ /// implementation.
+ /// <para>Term enumerations are always ordered by Term.compareTo(). Each term in
+ /// the enumeration is greater than all that precede it.</para>
+ /// </summary>
+ /// <remarks>http://www.java2s.com/Open-Source/Java-Document/Net/lucene-connector/org/apache/lucene/search/regex/RegexTermEnum.java.htm</remarks>
+ public class RegexTermEnum : FilteredTermEnum
+ {
+ private string _sField = "";
+ private string _sPre = "";
+ private bool _bEndEnum;
+ private readonly IRegexCapabilities _regexImpl;
+
+ public RegexTermEnum(IndexReader reader, Term term, IRegexCapabilities regexImpl)
+ {
+ _sField = term.Field();
+ string sText = term.Text();
+
+ _regexImpl = regexImpl;
+
+ _regexImpl.Compile(sText);
+
+ _sPre = _regexImpl.Prefix() ?? "";
+
+ SetEnum(reader.Terms(new Term(term.Field(), _sPre)));
+ }
+
+ /// <summary>Equality compare on the term </summary>
+ public override bool TermCompare(Term term)
+ {
+ if (_sField == term.Field())
+ {
+ string sSearchText = term.Text();
+ if (sSearchText.StartsWith(_sPre)) return _regexImpl.Match(sSearchText);
+ } //eif
+
+ _bEndEnum = true;
+ return false;
+ }
+
+ /// <summary>Equality measure on the term </summary>
+ public override float Difference()
+ {
+ // TODO: adjust difference based on distance of searchTerm.text() and term().text()
+ return 1.0F;
+ }
+
+ /// <summary>Indicates the end of the enumeration has been reached </summary>
+ public override bool EndEnum()
+ {
+ return _bEndEnum;
+ }
+
+ //public override void Close()
+ //{
+ // base.Close();
+ // _sField = null;
+ //}
+ }
+}
Added: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/SpanRegexQuery.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/SpanRegexQuery.cs?rev=1100632&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/SpanRegexQuery.cs (added)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/contrib/Regex/SpanRegexQuery.cs Sat May 7 21:34:19 2011
@@ -0,0 +1,161 @@
+/*
+ * 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.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Text;
+using Lucene.Net.Index;
+using Lucene.Net.Search.Spans;
+using Lucene.Net.Util;
+
+namespace Lucene.Net.Search.Regex
+{
+ /// <summary>
+ /// A SpanQuery version of <see cref="RegexQuery"/> allowing regular expression queries to be nested
+ /// within other SpanQuery subclasses.
+ /// </summary>
+ /// <remarks>http://www.java2s.com/Open-Source/Java-Document/Net/lucene-connector/org/apache/lucene/search/regex/SpanRegexQuery.java.htm</remarks>
+ public class SpanRegexQuery : SpanQuery, IRegexQueryCapable, IEquatable<SpanRegexQuery>
+ {
+ private IRegexCapabilities _regexImpl = new CSharpRegexCapabilities();
+ private readonly Term _term;
+
+ public SpanRegexQuery(Term term)
+ {
+ _term = term;
+ }
+
+ public Term GetTerm()
+ {
+ return _term;
+ }
+
+ public override string ToString(string field)
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.Append("SpanRegexQuery(");
+ sb.Append(_term);
+ sb.Append(')');
+ sb.Append(ToStringUtils.Boost(GetBoost()));
+ return sb.ToString();
+ }
+
+ public override Query Rewrite(IndexReader reader)
+ {
+ RegexQuery orig = new RegexQuery(_term);
+ orig.SetRegexImplementation(_regexImpl);
+
+ // RegexQuery (via MultiTermQuery).Rewrite always returns a BooleanQuery
+ orig.SetRewriteMethod(MultiTermQuery.SCORING_BOOLEAN_QUERY_REWRITE); //@@
+ BooleanQuery bq = (BooleanQuery) orig.Rewrite(reader);
+
+ BooleanClause[] clauses = bq.GetClauses();
+ SpanQuery[] sqs = new SpanQuery[clauses.Length];
+ for (int i = 0; i < clauses.Length; i++)
+ {
+ BooleanClause clause = clauses[i];
+
+ // Clauses from RegexQuery.Rewrite are always TermQuery's
+ TermQuery tq = (TermQuery) clause.GetQuery();
+
+ sqs[i] = new SpanTermQuery(tq.GetTerm());
+ sqs[i].SetBoost(tq.GetBoost());
+ } //efor
+
+ SpanOrQuery query = new SpanOrQuery(sqs);
+ query.SetBoost(orig.GetBoost());
+
+ return query;
+ }
+
+ /// <summary>Expert: Returns the matches for this query in an index. Used internally
+ /// to search for spans.
+ /// </summary>
+ public override Spans.Spans GetSpans(IndexReader reader)
+ {
+ throw new InvalidOperationException("Query should have been rewritten");
+ }
+
+ /// <summary>Returns the name of the field matched by this query.</summary>
+ public override string GetField()
+ {
+ return _term.Field();
+ }
+
+ /// <summary>Returns a collection of all terms matched by this query.</summary>
+ /// <deprecated> use extractTerms instead
+ /// </deprecated>
+ /// <seealso cref="Query.ExtractTerms">
+ /// </seealso>
+ public override IList<Term> GetTerms()
+ {
+ IList<Term> terms = new List<Term> {_term};
+ return terms;
+ }
+
+ public void SetRegexImplementation(IRegexCapabilities impl)
+ {
+ _regexImpl = impl;
+ }
+
+ public IRegexCapabilities GetRegexImplementation()
+ {
+ return _regexImpl;
+ }
+
+ /// <summary>
+ /// Indicates whether the current object is equal to another object of the same type.
+ /// </summary>
+ /// <returns>
+ /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
+ /// </returns>
+ /// <param name="other">An object to compare with this object.
+ /// </param>
+ public bool Equals(SpanRegexQuery other)
+ {
+ if (other == null) return false;
+ if (this == other) return true;
+
+ if (!_regexImpl.Equals(other._regexImpl)) return false;
+ if (!_term.Equals(other._term)) return false;
+
+ return true;
+ }
+
+ /// <summary>
+ /// True if this object equals the specified object.
+ /// </summary>
+ /// <param name="obj">object</param>
+ /// <returns>true on equality</returns>
+ public override bool Equals(object obj)
+ {
+ if (obj as SpanRegexQuery == null) return false;
+
+ return Equals((SpanRegexQuery) obj);
+ }
+
+ /// <summary>
+ /// Get hash code for this object.
+ /// </summary>
+ /// <returns>hash code</returns>
+ public override int GetHashCode()
+ {
+ return 29 * _regexImpl.GetHashCode() + _term.GetHashCode();
+ }
+ }
+}
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Lucene.Net.csproj
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Lucene.Net.csproj?rev=1100632&r1=1100631&r2=1100632&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Lucene.Net.csproj (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Lucene.Net.csproj Sat May 7 21:34:19 2011
@@ -527,7 +527,6 @@
<Compile Include="Search\ConstantScoreRangeQuery.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="Search\Regex\CSharpRegexCapabilities.cs" />
<Compile Include="Search\DefaultSimilarity.cs">
<SubType>Code</SubType>
</Compile>
@@ -620,8 +619,6 @@
<Compile Include="Search\IndexSearcher.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="Search\Regex\IRegexCapabilities.cs" />
- <Compile Include="Search\Regex\IRegexQueryCapable.cs" />
<Compile Include="Search\MatchAllDocsQuery.cs">
<SubType>Code</SubType>
</Compile>
@@ -684,8 +681,6 @@
<Compile Include="Search\RangeQuery.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="Search\Regex\RegexQuery.cs" />
- <Compile Include="Search\Regex\RegexTermEnum.cs" />
<Compile Include="Search\ReqExclScorer.cs">
<SubType>Code</SubType>
</Compile>
@@ -732,7 +727,6 @@
<Compile Include="Search\SpanFilter.cs" />
<Compile Include="Search\SpanFilterResult.cs" />
<Compile Include="Search\SpanQueryFilter.cs" />
- <Compile Include="Search\Regex\SpanRegexQuery.cs" />
<Compile Include="Search\Spans\FieldMaskingSpanQuery.cs" />
<Compile Include="Search\Spans\NearSpansOrdered.cs">
<SubType>Code</SubType>
Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Lucene.Net.Test.csproj
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Lucene.Net.Test.csproj?rev=1100632&r1=1100631&r2=1100632&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Lucene.Net.Test.csproj (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Lucene.Net.Test.csproj Sat May 7 21:34:19 2011
@@ -386,7 +386,6 @@
<Compile Include="Search\TestPrefixQuery.cs" />
<Compile Include="Search\TestQueryTermVector.cs" />
<Compile Include="Search\TestQueryWrapperFilter.cs" />
- <Compile Include="Search\Regex\TestRegexpQuery.cs" />
<Compile Include="Search\TestScoreCachingWrappingScorer.cs" />
<Compile Include="Search\TestScorerPerf.cs" />
<Compile Include="Search\TestSearchHitsWithDeletions.cs" />