Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 0F9D4200C59 for ; Mon, 17 Apr 2017 15:55:29 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 0E2E4160B9C; Mon, 17 Apr 2017 13:55:29 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id AF0D0160BB1 for ; Mon, 17 Apr 2017 15:55:27 +0200 (CEST) Received: (qmail 19636 invoked by uid 500); 17 Apr 2017 13:55:26 -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 19473 invoked by uid 99); 17 Apr 2017 13:55:26 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Apr 2017 13:55:26 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 2620DE00B4; Mon, 17 Apr 2017 13:55:26 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: nightowl888@apache.org To: commits@lucenenet.apache.org Date: Mon, 17 Apr 2017 13:55:30 -0000 Message-Id: <522634b1877b4431b57b45d23887a664@git.apache.org> In-Reply-To: <23543cc858a54b0d8dba6feb5b7464a1@git.apache.org> References: <23543cc858a54b0d8dba6feb5b7464a1@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [5/7] lucenenet git commit: SWEEP: Moved BreakIterator-dependent functionality to a common Lucene.Net.Icu library so we can manage the icu.net dependency from one place and not make the majority of the users deal with it when they don't need to archived-at: Mon, 17 Apr 2017 13:55:29 -0000 http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b1fdcca3/src/Lucene.Net.Tests.Highlighter/TestBreakIterator.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests.Highlighter/TestBreakIterator.cs b/src/Lucene.Net.Tests.Highlighter/TestBreakIterator.cs deleted file mode 100644 index 07fe932..0000000 --- a/src/Lucene.Net.Tests.Highlighter/TestBreakIterator.cs +++ /dev/null @@ -1,421 +0,0 @@ -#if FEATURE_BREAKITERATOR -using Lucene.Net.Support; -using Lucene.Net.Util; -using NUnit.Framework; -using System; -using System.Globalization; - -namespace Lucene.Net.Search -{ - /* - * 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. - */ - - public class TestBreakIterator : LuceneTestCase - { - static readonly String TEXT = - "Apache Lucene(TM) is a high-performance, full-featured text search engine library written entirely in Java."; - - static readonly String SENTENCE_TEXT = - "Apache Lucene(TM) is a high-performance, full-featured text search engine library written entirely in Java. " + - "It is a technology suitable for nearly any application that requires" + - "full-text search, especially cross-platform. Apache Lucene is an open source project available for free download. " + - "Lucene makes finding things easy. Lucene is powerful. Lucene is exciting. Lucene is cool. Where be Lucene now?"; - - private BreakIterator GetWordInstance(CultureInfo locale) - { - //return new WordBreakIterator(locale); - return new IcuBreakIterator(Icu.BreakIterator.UBreakIteratorType.WORD, locale) { EnableHacks = true }; - } - - private BreakIterator GetSentenceInstance(CultureInfo locale) - { - return new IcuBreakIterator(Icu.BreakIterator.UBreakIteratorType.SENTENCE, locale); - } - - [Test] - public void TestWordIteration() - { - BreakIterator bi = GetWordInstance(CultureInfo.InvariantCulture); - bi.SetText(TEXT); - - int temp; - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(0, temp); - - temp = bi.Next(); - Console.WriteLine(temp); - assertEquals(6, temp); - - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(6, temp); - - temp = bi.Next(); - Console.WriteLine(temp); - assertEquals(7, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(7, temp); - temp = bi.Next(); - Console.WriteLine(temp); - assertEquals(13, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(13, temp); - temp = bi.Next(); - Console.WriteLine(temp); - assertEquals(14, temp); - temp = bi.Next(); - Console.WriteLine(temp); - assertEquals(16, temp); - temp = bi.Next(); - Console.WriteLine(temp); - assertEquals(17, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(17, temp); - - temp = bi.Previous(); - Console.WriteLine(temp); - assertEquals(16, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(16, temp); - temp = bi.Next(); - Console.WriteLine(temp); - assertEquals(17, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(17, temp); - temp = bi.Next(); - Console.WriteLine(temp); - assertEquals(18, temp); - - temp = bi.Last(); - Console.WriteLine(temp); - assertEquals(107, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(107, temp); - temp = bi.Next(); - Console.WriteLine(temp); - assertEquals(-1, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(107, temp); - temp = bi.Previous(); - Console.WriteLine(temp); - assertEquals(106, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(106, temp); - temp = bi.Previous(); - Console.WriteLine(temp); - assertEquals(102, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(102, temp); - temp = bi.Previous(); - Console.WriteLine(temp); - assertEquals(101, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(101, temp); - } - - [Test] - public void TestWordFollowing() - { - BreakIterator bi = GetWordInstance(CultureInfo.InvariantCulture); - bi.SetText(TEXT); - - int temp; - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(0, temp); - temp = bi.Next(); - Console.WriteLine(temp); - assertEquals(6, temp); - - - temp = bi.Following(70); - Console.WriteLine(temp); - assertEquals(73, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(73, temp); - temp = bi.Next(); - Console.WriteLine(temp); - assertEquals(74, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(74, temp); - temp = bi.Next(); - Console.WriteLine(temp); - assertEquals(81, temp); - temp = bi.Following(107); // Test the final boundary - Console.WriteLine(temp); - assertEquals(-1, temp); - temp = bi.Next(); - Console.WriteLine(temp); - assertEquals(-1, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(107, temp); - - temp = bi.Following(66); // Test exactly on a boundary position - Console.WriteLine(temp); - assertEquals(67, temp); - temp = bi.Next(); - Console.WriteLine(temp); - assertEquals(73, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(73, temp); - - temp = bi.Following(0); // Test the first boundary - Console.WriteLine(temp); - assertEquals(6, temp); - temp = bi.Next(); - Console.WriteLine(temp); - assertEquals(7, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(7, temp); - - } - - [Test] - public void TestWordPreceding() - { - BreakIterator bi = GetWordInstance(CultureInfo.InvariantCulture); - bi.SetText(TEXT); - - int temp; - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(0, temp); - temp = bi.Next(); - Console.WriteLine(temp); - assertEquals(6, temp); - - - temp = bi.Preceding(70); - Console.WriteLine(temp); - assertEquals(67, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(67, temp); - temp = bi.Next(); - Console.WriteLine(temp); - assertEquals(73, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(73, temp); - temp = bi.Next(); - Console.WriteLine(temp); - assertEquals(74, temp); - temp = bi.Preceding(107); // Test the final boundary - Console.WriteLine(temp); - assertEquals(106, temp); - temp = bi.Next(); - Console.WriteLine(temp); - assertEquals(107, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(107, temp); - - temp = bi.Preceding(66); // Test exactly on a boundary position - Console.WriteLine(temp); - assertEquals(60, temp); - temp = bi.Previous(); - Console.WriteLine(temp); - assertEquals(59, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(59, temp); - - temp = bi.Preceding(0); // Test the first boundary - Console.WriteLine(temp); - assertEquals(-1, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(0, temp); - temp = bi.Next(); - Console.WriteLine(temp); - assertEquals(6, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(6, temp); - - } - - [Test] - public void TestWordNextWithInt() - { - BreakIterator bi = GetWordInstance(CultureInfo.InvariantCulture); - bi.SetText(TEXT); - - int temp; - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(0, temp); - temp = bi.Next(); - Console.WriteLine(temp); - assertEquals(6, temp); - - - temp = bi.Next(10); - Console.WriteLine(temp); - assertEquals(23, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(23, temp); - temp = bi.Next(); - Console.WriteLine(temp); - assertEquals(39, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(39, temp); - temp = bi.Next(); - Console.WriteLine(temp); - assertEquals(40, temp); - temp = bi.Next(-8); // Test going backward - Console.WriteLine(temp); - assertEquals(16, temp); // Magically, this is correct (from position 28 back 8 places) in Java, even though its start position is wrong - temp = bi.Next(); - Console.WriteLine(temp); - assertEquals(17, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(17, temp); - - - temp = bi.Next(107); // Go past the last boundary - Console.WriteLine(temp); - assertEquals(-1, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(107, temp); - temp = bi.Next(-107); // Go past the first boundary - Console.WriteLine(temp); - assertEquals(-1, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(0, temp); - - } - - [Test] - public void TestSentenceIteration() - { - BreakIterator bi = GetSentenceInstance(CultureInfo.InvariantCulture); - bi.SetText(SENTENCE_TEXT); - - int temp; - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(0, temp); - - temp = bi.Next(); - Console.WriteLine(temp); - assertEquals(108, temp); - - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(108, temp); - - temp = bi.Next(); - Console.WriteLine(temp); - assertEquals(221, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(221, temp); - temp = bi.Next(); - Console.WriteLine(temp); - assertEquals(290, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(290, temp); - temp = bi.Next(); - Console.WriteLine(temp); - assertEquals(324, temp); - temp = bi.Next(); - Console.WriteLine(temp); - assertEquals(344, temp); - temp = bi.Next(); - Console.WriteLine(temp); - assertEquals(364, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(364, temp); - - temp = bi.Previous(); - Console.WriteLine(temp); - assertEquals(344, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(344, temp); - temp = bi.Next(); - Console.WriteLine(temp); - assertEquals(364, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(364, temp); - temp = bi.Next(); - Console.WriteLine(temp); - assertEquals(380, temp); - - temp = bi.First(); - Console.WriteLine(temp); - assertEquals(0, temp); - - temp = bi.Last(); - Console.WriteLine(temp); - assertEquals(400, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(400, temp); - temp = bi.Next(); - Console.WriteLine(temp); - assertEquals(-1, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(400, temp); - temp = bi.Previous(); - Console.WriteLine(temp); - assertEquals(380, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(380, temp); - temp = bi.Previous(); - Console.WriteLine(temp); - assertEquals(364, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(364, temp); - temp = bi.Previous(); - Console.WriteLine(temp); - assertEquals(344, temp); - temp = bi.Current; - Console.WriteLine(temp); - assertEquals(344, temp); - } - } -} -#endif \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b1fdcca3/src/Lucene.Net.Tests.Highlighter/project.json ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests.Highlighter/project.json b/src/Lucene.Net.Tests.Highlighter/project.json index 6caafe2..4e380ba 100644 --- a/src/Lucene.Net.Tests.Highlighter/project.json +++ b/src/Lucene.Net.Tests.Highlighter/project.json @@ -10,6 +10,7 @@ "testRunner": "nunit", "frameworks": { "netcoreapp1.0": { + "imports": "dnxcore50", "buildOptions": { "debugType": "portable", "define": [ "NETSTANDARD" ], @@ -33,8 +34,7 @@ "version": "1.0.1" }, "System.Xml.XmlDocument": "4.0.1" - }, - "imports": "dnxcore50" + } }, "net451": { "buildOptions": { http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b1fdcca3/src/Lucene.Net.Tests.Icu/Lucene.Net.Tests.Icu.csproj ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests.Icu/Lucene.Net.Tests.Icu.csproj b/src/Lucene.Net.Tests.Icu/Lucene.Net.Tests.Icu.csproj new file mode 100644 index 0000000..355ae92 --- /dev/null +++ b/src/Lucene.Net.Tests.Icu/Lucene.Net.Tests.Icu.csproj @@ -0,0 +1,121 @@ + + + + + Debug + AnyCPU + {D5AA1A22-1B28-4DF6-BFDA-02519A189839} + Library + Properties + Lucene.Net + Lucene.Net.Tests.Icu + v4.5.1 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + $(DefineConstants);FEATURE_BREAKITERATOR;FEATURE_SERIALIZABLE + + + + + + + + + + Analysis\Th\TestThaiAnalyzer.cs + + + Analysis\Th\TestThaiTokenizerFactory.cs + + + Analysis\Th\TestThaiWordFilterFactory.cs + + + Analysis\Util\TestCharArrayIterator.cs + + + Analysis\Util\TestSegmentingTokenizerBase.cs + + + Search\PostingsHighlight\TestMultiTermHighlighting.cs + + + Search\PostingsHighlight\TestPostingsHighlighter.cs + + + Search\PostingsHighlight\TestPostingsHighlighterRanking.cs + + + Search\PostingsHighlight\TestWholeBreakIterator.cs + + + Search\VectorHighlight\BreakIteratorBoundaryScannerTest.cs + + + + + + + Properties\CommonAssemblyInfo.cs + + + + + {4add0bbc-b900-4715-9526-d871de8eea64} + Lucene.Net.Analysis.Common + + + {e9e769ea-8504-44bc-8dc9-ccf958765f8f} + Lucene.Net.Highlighter + + + {349cb7c9-7534-4e1d-9b0a-5521441af0ae} + Lucene.Net.Icu + + + {b2c0d749-ce34-4f62-a15e-00cb2ff5ddb3} + Lucene.Net.TestFramework + + + {c54fe8fa-7986-4c94-b872-d5bff7c6c74e} + Lucene.Net.Tests.Analysis.Common + + + {5d4ad9be-1ffb-41ab-9943-25737971bf57} + Lucene.Net + + + + + + + + + + + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b1fdcca3/src/Lucene.Net.Tests.Icu/Lucene.Net.Tests.Icu.project.json ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests.Icu/Lucene.Net.Tests.Icu.project.json b/src/Lucene.Net.Tests.Icu/Lucene.Net.Tests.Icu.project.json new file mode 100644 index 0000000..2a96d5b --- /dev/null +++ b/src/Lucene.Net.Tests.Icu/Lucene.Net.Tests.Icu.project.json @@ -0,0 +1,12 @@ +{ + "runtimes": { + "win": {} + }, + "dependencies": { + "NUnit": "3.5.0", + "icu.net": "54.1.1-alpha" + }, + "frameworks": { + "net451": {} + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b1fdcca3/src/Lucene.Net.Tests.Icu/Lucene.Net.Tests.Icu.xproj ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests.Icu/Lucene.Net.Tests.Icu.xproj b/src/Lucene.Net.Tests.Icu/Lucene.Net.Tests.Icu.xproj new file mode 100644 index 0000000..8892b87 --- /dev/null +++ b/src/Lucene.Net.Tests.Icu/Lucene.Net.Tests.Icu.xproj @@ -0,0 +1,22 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + 32fd3471-e862-4055-b969-79c12a656366 + Lucene.Net.Search + .\obj + .\bin\ + v4.5.1 + + + 2.0 + + + + + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b1fdcca3/src/Lucene.Net.Tests.Icu/Properties/AssemblyInfo.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests.Icu/Properties/AssemblyInfo.cs b/src/Lucene.Net.Tests.Icu/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..2313bd8 --- /dev/null +++ b/src/Lucene.Net.Tests.Icu/Properties/AssemblyInfo.cs @@ -0,0 +1,21 @@ +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.Tests.Icu")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[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("d5aa1a22-1b28-4df6-bfda-02519a189839")] + +// NOTE: Version information is in CommonAssemblyInfo.cs