You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by er...@apache.org on 2012/09/17 18:02:02 UTC
svn commit: r1386681 [4/8] - in /lucene/dev/trunk:
lucene/analysis/common/src/java/org/apache/lucene/analysis/br/
lucene/analysis/common/src/java/org/apache/lucene/analysis/charfilter/
lucene/analysis/common/src/java/org/apache/lucene/analysis/compound...
Modified: lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/el/GreekAnalyzerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/el/GreekAnalyzerTest.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/el/GreekAnalyzerTest.java (original)
+++ lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/el/GreekAnalyzerTest.java Mon Sep 17 16:01:56 2012
@@ -46,7 +46,7 @@ public class GreekAnalyzerTest extends B
assertAnalyzesTo(a, "ΠΡÎΫΠÎÎÎΣÎÎΣ ÎÏογοÏ, ο μεÏÏÏÏ ÎºÎ±Î¹ οι άλλοι",
new String[] { "ÏÏοÏ
ÏοθεÏ", "αÏογ", "μεÏÏ", "αλλ" });
}
-
+
public void testReusableTokenStream() throws Exception {
Analyzer a = new GreekAnalyzer(TEST_VERSION_CURRENT);
// Verify the correct analysis of capitals and small accented letters, and
Modified: lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/fr/TestFrenchAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/fr/TestFrenchAnalyzer.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/fr/TestFrenchAnalyzer.java (original)
+++ lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/fr/TestFrenchAnalyzer.java Mon Sep 17 16:01:56 2012
@@ -31,93 +31,92 @@ import org.apache.lucene.util.Version;
public class TestFrenchAnalyzer extends BaseTokenStreamTestCase {
- public void testAnalyzer() throws Exception {
- FrenchAnalyzer fa = new FrenchAnalyzer(TEST_VERSION_CURRENT);
-
- assertAnalyzesTo(fa, "", new String[] {
- });
-
- assertAnalyzesTo(
- fa,
- "chien chat cheval",
- new String[] { "chien", "chat", "cheval" });
-
- assertAnalyzesTo(
- fa,
- "chien CHAT CHEVAL",
- new String[] { "chien", "chat", "cheval" });
-
- assertAnalyzesTo(
- fa,
- " chien ,? + = - CHAT /: > CHEVAL",
- new String[] { "chien", "chat", "cheval" });
-
- assertAnalyzesTo(fa, "chien++", new String[] { "chien" });
-
- assertAnalyzesTo(
- fa,
- "mot \"entreguillemet\"",
- new String[] { "mot", "entreguilemet" });
-
- // let's do some french specific tests now
-
- /* 1. couldn't resist
- I would expect this to stay one term as in French the minus
- sign is often used for composing words */
- assertAnalyzesTo(
- fa,
- "Jean-François",
- new String[] { "jean", "francoi" });
-
- // 2. stopwords
- assertAnalyzesTo(
- fa,
- "le la chien les aux chat du des à cheval",
- new String[] { "chien", "chat", "cheval" });
-
- // some nouns and adjectives
- assertAnalyzesTo(
- fa,
- "lances chismes habitable chiste éléments captifs",
- new String[] {
- "lanc",
- "chism",
- "habitabl",
- "chist",
- "element",
- "captif" });
-
- // some verbs
- assertAnalyzesTo(
- fa,
- "finissions souffrirent rugissante",
- new String[] { "finision", "soufrirent", "rugisant" });
-
- // some everything else
- // aujourd'hui stays one term which is OK
- assertAnalyzesTo(
- fa,
- "C3PO aujourd'hui oeuf ïâöûà ä anticonstitutionnellement Java++ ",
- new String[] {
- "c3po",
- "aujourd'hui",
- "oeuf",
- "ïaöuaä",
- "anticonstitutionel",
- "java" });
-
- // some more everything else
- // here 1940-1945 stays as one term, 1940:1945 not ?
- assertAnalyzesTo(
- fa,
- "33Bis 1940-1945 1940:1945 (---i+++)*",
- new String[] { "33bi", "1940", "1945", "1940", "1945", "i" });
-
- }
-
- public void testReusableTokenStream() throws Exception {
- FrenchAnalyzer fa = new FrenchAnalyzer(TEST_VERSION_CURRENT);
- // stopwords
+ public void testAnalyzer() throws Exception {
+ FrenchAnalyzer fa = new FrenchAnalyzer(TEST_VERSION_CURRENT);
+
+ assertAnalyzesTo(fa, "", new String[] {
+ });
+
+ assertAnalyzesTo(
+ fa,
+ "chien chat cheval",
+ new String[] { "chien", "chat", "cheval" });
+
+ assertAnalyzesTo(
+ fa,
+ "chien CHAT CHEVAL",
+ new String[] { "chien", "chat", "cheval" });
+
+ assertAnalyzesTo(
+ fa,
+ " chien ,? + = - CHAT /: > CHEVAL",
+ new String[] { "chien", "chat", "cheval" });
+
+ assertAnalyzesTo(fa, "chien++", new String[] { "chien" });
+
+ assertAnalyzesTo(
+ fa,
+ "mot \"entreguillemet\"",
+ new String[] { "mot", "entreguilemet" });
+
+ // let's do some french specific tests now
+ /* 1. couldn't resist
+ I would expect this to stay one term as in French the minus
+ sign is often used for composing words */
+ assertAnalyzesTo(
+ fa,
+ "Jean-François",
+ new String[] { "jean", "francoi" });
+
+ // 2. stopwords
+ assertAnalyzesTo(
+ fa,
+ "le la chien les aux chat du des à cheval",
+ new String[] { "chien", "chat", "cheval" });
+
+ // some nouns and adjectives
+ assertAnalyzesTo(
+ fa,
+ "lances chismes habitable chiste éléments captifs",
+ new String[] {
+ "lanc",
+ "chism",
+ "habitabl",
+ "chist",
+ "element",
+ "captif" });
+
+ // some verbs
+ assertAnalyzesTo(
+ fa,
+ "finissions souffrirent rugissante",
+ new String[] { "finision", "soufrirent", "rugisant" });
+
+ // some everything else
+ // aujourd'hui stays one term which is OK
+ assertAnalyzesTo(
+ fa,
+ "C3PO aujourd'hui oeuf ïâöûà ä anticonstitutionnellement Java++ ",
+ new String[] {
+ "c3po",
+ "aujourd'hui",
+ "oeuf",
+ "ïaöuaä",
+ "anticonstitutionel",
+ "java" });
+
+ // some more everything else
+ // here 1940-1945 stays as one term, 1940:1945 not ?
+ assertAnalyzesTo(
+ fa,
+ "33Bis 1940-1945 1940:1945 (---i+++)*",
+ new String[] { "33bi", "1940", "1945", "1940", "1945", "i" });
+
+ }
+
+ public void testReusableTokenStream() throws Exception {
+ FrenchAnalyzer fa = new FrenchAnalyzer(TEST_VERSION_CURRENT);
+ // stopwords
assertAnalyzesToReuse(
fa,
"le la chien les aux chat du des à cheval",
@@ -134,7 +133,7 @@ public class TestFrenchAnalyzer extends
"chist",
"element",
"captif" });
- }
+ }
public void testExclusionTableViaCtor() throws Exception {
CharArraySet set = new CharArraySet(TEST_VERSION_CURRENT, 1, true);
Modified: lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestHyphenatedWordsFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestHyphenatedWordsFilter.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestHyphenatedWordsFilter.java (original)
+++ lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/miscellaneous/TestHyphenatedWordsFilter.java Mon Sep 17 16:01:56 2012
@@ -32,37 +32,37 @@ import org.apache.lucene.analysis.core.K
* HyphenatedWordsFilter test
*/
public class TestHyphenatedWordsFilter extends BaseTokenStreamTestCase {
- public void testHyphenatedWords() throws Exception {
- String input = "ecologi-\r\ncal devel-\r\n\r\nop compre-\u0009hensive-hands-on and ecologi-\ncal";
- // first test
- TokenStream ts = new MockTokenizer(new StringReader(input), MockTokenizer.WHITESPACE, false);
- ts = new HyphenatedWordsFilter(ts);
- assertTokenStreamContents(ts,
- new String[] { "ecological", "develop", "comprehensive-hands-on", "and", "ecological" });
- }
-
- /**
- * Test that HyphenatedWordsFilter behaves correctly with a final hyphen
- */
- public void testHyphenAtEnd() throws Exception {
- String input = "ecologi-\r\ncal devel-\r\n\r\nop compre-\u0009hensive-hands-on and ecology-";
- // first test
- TokenStream ts = new MockTokenizer(new StringReader(input), MockTokenizer.WHITESPACE, false);
- ts = new HyphenatedWordsFilter(ts);
- assertTokenStreamContents(ts,
- new String[] { "ecological", "develop", "comprehensive-hands-on", "and", "ecology-" });
- }
-
- public void testOffsets() throws Exception {
- String input = "abc- def geh 1234- 5678-";
+ public void testHyphenatedWords() throws Exception {
+ String input = "ecologi-\r\ncal devel-\r\n\r\nop compre-\u0009hensive-hands-on and ecologi-\ncal";
+ // first test
+ TokenStream ts = new MockTokenizer(new StringReader(input), MockTokenizer.WHITESPACE, false);
+ ts = new HyphenatedWordsFilter(ts);
+ assertTokenStreamContents(ts,
+ new String[] { "ecological", "develop", "comprehensive-hands-on", "and", "ecological" });
+ }
+
+ /**
+ * Test that HyphenatedWordsFilter behaves correctly with a final hyphen
+ */
+ public void testHyphenAtEnd() throws Exception {
+ String input = "ecologi-\r\ncal devel-\r\n\r\nop compre-\u0009hensive-hands-on and ecology-";
+ // first test
+ TokenStream ts = new MockTokenizer(new StringReader(input), MockTokenizer.WHITESPACE, false);
+ ts = new HyphenatedWordsFilter(ts);
+ assertTokenStreamContents(ts,
+ new String[] { "ecological", "develop", "comprehensive-hands-on", "and", "ecology-" });
+ }
+
+ public void testOffsets() throws Exception {
+ String input = "abc- def geh 1234- 5678-";
TokenStream ts = new MockTokenizer(new StringReader(input), MockTokenizer.WHITESPACE, false);
ts = new HyphenatedWordsFilter(ts);
assertTokenStreamContents(ts,
new String[] { "abcdef", "geh", "12345678-" },
new int[] { 0, 9, 13 },
new int[] { 8, 12, 24 });
- }
-
+ }
+
/** blast some random strings through the analyzer */
public void testRandomString() throws Exception {
Analyzer a = new Analyzer() {
Modified: lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/nl/TestDutchStemmer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/nl/TestDutchStemmer.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/nl/TestDutchStemmer.java (original)
+++ lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/nl/TestDutchStemmer.java Mon Sep 17 16:01:56 2012
@@ -34,83 +34,83 @@ import org.apache.lucene.util.Version;
public class TestDutchStemmer extends BaseTokenStreamTestCase {
public void testWithSnowballExamples() throws Exception {
- check("lichaamsziek", "lichaamsziek");
- check("lichamelijk", "licham");
- check("lichamelijke", "licham");
- check("lichamelijkheden", "licham");
- check("lichamen", "licham");
- check("lichere", "licher");
- check("licht", "licht");
- check("lichtbeeld", "lichtbeeld");
- check("lichtbruin", "lichtbruin");
- check("lichtdoorlatende", "lichtdoorlat");
- check("lichte", "licht");
- check("lichten", "licht");
- check("lichtende", "lichtend");
- check("lichtenvoorde", "lichtenvoord");
- check("lichter", "lichter");
- check("lichtere", "lichter");
- check("lichters", "lichter");
- check("lichtgevoeligheid", "lichtgevoel");
- check("lichtgewicht", "lichtgewicht");
- check("lichtgrijs", "lichtgrijs");
- check("lichthoeveelheid", "lichthoevel");
- check("lichtintensiteit", "lichtintensiteit");
- check("lichtje", "lichtj");
- check("lichtjes", "lichtjes");
- check("lichtkranten", "lichtkrant");
- check("lichtkring", "lichtkring");
- check("lichtkringen", "lichtkring");
- check("lichtregelsystemen", "lichtregelsystem");
- check("lichtste", "lichtst");
- check("lichtstromende", "lichtstrom");
- check("lichtte", "licht");
- check("lichtten", "licht");
- check("lichttoetreding", "lichttoetred");
- check("lichtverontreinigde", "lichtverontreinigd");
- check("lichtzinnige", "lichtzinn");
- check("lid", "lid");
- check("lidia", "lidia");
- check("lidmaatschap", "lidmaatschap");
- check("lidstaten", "lidstat");
- check("lidvereniging", "lidveren");
- check("opgingen", "opging");
- check("opglanzing", "opglanz");
- check("opglanzingen", "opglanz");
- check("opglimlachten", "opglimlacht");
- check("opglimpen", "opglimp");
- check("opglimpende", "opglimp");
- check("opglimping", "opglimp");
- check("opglimpingen", "opglimp");
- check("opgraven", "opgrav");
- check("opgrijnzen", "opgrijnz");
- check("opgrijzende", "opgrijz");
- check("opgroeien", "opgroei");
- check("opgroeiende", "opgroei");
- check("opgroeiplaats", "opgroeiplat");
- check("ophaal", "ophal");
- check("ophaaldienst", "ophaaldienst");
- check("ophaalkosten", "ophaalkost");
- check("ophaalsystemen", "ophaalsystem");
- check("ophaalt", "ophaalt");
- check("ophaaltruck", "ophaaltruck");
- check("ophalen", "ophal");
- check("ophalend", "ophal");
- check("ophalers", "ophaler");
- check("ophef", "ophef");
- check("opheldering", "ophelder");
- check("ophemelde", "ophemeld");
- check("ophemelen", "ophemel");
- check("opheusden", "opheusd");
- check("ophief", "ophief");
- check("ophield", "ophield");
- check("ophieven", "ophiev");
- check("ophoepelt", "ophoepelt");
- check("ophoog", "ophog");
- check("ophoogzand", "ophoogzand");
- check("ophopen", "ophop");
- check("ophoping", "ophop");
- check("ophouden", "ophoud");
+ check("lichaamsziek", "lichaamsziek");
+ check("lichamelijk", "licham");
+ check("lichamelijke", "licham");
+ check("lichamelijkheden", "licham");
+ check("lichamen", "licham");
+ check("lichere", "licher");
+ check("licht", "licht");
+ check("lichtbeeld", "lichtbeeld");
+ check("lichtbruin", "lichtbruin");
+ check("lichtdoorlatende", "lichtdoorlat");
+ check("lichte", "licht");
+ check("lichten", "licht");
+ check("lichtende", "lichtend");
+ check("lichtenvoorde", "lichtenvoord");
+ check("lichter", "lichter");
+ check("lichtere", "lichter");
+ check("lichters", "lichter");
+ check("lichtgevoeligheid", "lichtgevoel");
+ check("lichtgewicht", "lichtgewicht");
+ check("lichtgrijs", "lichtgrijs");
+ check("lichthoeveelheid", "lichthoevel");
+ check("lichtintensiteit", "lichtintensiteit");
+ check("lichtje", "lichtj");
+ check("lichtjes", "lichtjes");
+ check("lichtkranten", "lichtkrant");
+ check("lichtkring", "lichtkring");
+ check("lichtkringen", "lichtkring");
+ check("lichtregelsystemen", "lichtregelsystem");
+ check("lichtste", "lichtst");
+ check("lichtstromende", "lichtstrom");
+ check("lichtte", "licht");
+ check("lichtten", "licht");
+ check("lichttoetreding", "lichttoetred");
+ check("lichtverontreinigde", "lichtverontreinigd");
+ check("lichtzinnige", "lichtzinn");
+ check("lid", "lid");
+ check("lidia", "lidia");
+ check("lidmaatschap", "lidmaatschap");
+ check("lidstaten", "lidstat");
+ check("lidvereniging", "lidveren");
+ check("opgingen", "opging");
+ check("opglanzing", "opglanz");
+ check("opglanzingen", "opglanz");
+ check("opglimlachten", "opglimlacht");
+ check("opglimpen", "opglimp");
+ check("opglimpende", "opglimp");
+ check("opglimping", "opglimp");
+ check("opglimpingen", "opglimp");
+ check("opgraven", "opgrav");
+ check("opgrijnzen", "opgrijnz");
+ check("opgrijzende", "opgrijz");
+ check("opgroeien", "opgroei");
+ check("opgroeiende", "opgroei");
+ check("opgroeiplaats", "opgroeiplat");
+ check("ophaal", "ophal");
+ check("ophaaldienst", "ophaaldienst");
+ check("ophaalkosten", "ophaalkost");
+ check("ophaalsystemen", "ophaalsystem");
+ check("ophaalt", "ophaalt");
+ check("ophaaltruck", "ophaaltruck");
+ check("ophalen", "ophal");
+ check("ophalend", "ophal");
+ check("ophalers", "ophaler");
+ check("ophef", "ophef");
+ check("opheldering", "ophelder");
+ check("ophemelde", "ophemeld");
+ check("ophemelen", "ophemel");
+ check("opheusden", "opheusd");
+ check("ophief", "ophief");
+ check("ophield", "ophield");
+ check("ophieven", "ophiev");
+ check("ophoepelt", "ophoepelt");
+ check("ophoog", "ophog");
+ check("ophoogzand", "ophoogzand");
+ check("ophopen", "ophop");
+ check("ophoping", "ophop");
+ check("ophouden", "ophoud");
}
public void testSnowballCorrectness() throws Exception {
@@ -171,4 +171,4 @@ public class TestDutchStemmer extends Ba
checkRandomData(random(), new DutchAnalyzer(TEST_VERSION_CURRENT), 1000*RANDOM_MULTIPLIER);
}
-}
\ No newline at end of file
+}
Modified: lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/pattern/TestPatternTokenizer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/pattern/TestPatternTokenizer.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/pattern/TestPatternTokenizer.java (original)
+++ lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/pattern/TestPatternTokenizer.java Mon Sep 17 16:01:56 2012
@@ -37,7 +37,7 @@ import org.apache.lucene.analysis.tokena
public class TestPatternTokenizer extends BaseTokenStreamTestCase
{
- public void testSplitting() throws Exception
+ public void testSplitting() throws Exception
{
String qpattern = "\\'([^\\']+)\\'"; // get stuff between "'"
String[][] tests = {
@@ -71,8 +71,8 @@ public class TestPatternTokenizer extend
}
}*/
}
- }
-
+ }
+
public void testOffsetCorrection() throws Exception {
final String INPUT = "Günther Günther is here";
Modified: lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/th/TestThaiAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/th/TestThaiAnalyzer.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/th/TestThaiAnalyzer.java (original)
+++ lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/th/TestThaiAnalyzer.java Mon Sep 17 16:01:56 2012
@@ -38,31 +38,31 @@ import org.apache.lucene.util.Version;
*/
public class TestThaiAnalyzer extends BaseTokenStreamTestCase {
-
+
@Override
public void setUp() throws Exception {
super.setUp();
assumeTrue("JRE does not support Thai dictionary-based BreakIterator", ThaiWordFilter.DBBI_AVAILABLE);
}
- /*
- * testcase for offsets
- */
- public void testOffsets() throws Exception {
- assertAnalyzesTo(new ThaiAnalyzer(TEST_VERSION_CURRENT, CharArraySet.EMPTY_SET), "à¸à¸²à¸£à¸à¸µà¹à¹à¸à¹à¸à¹à¸à¸à¹à¸ªà¸à¸à¸§à¹à¸²à¸à¸²à¸à¸à¸µ",
- new String[] { "à¸à¸²à¸£", "à¸à¸µà¹", "à¹à¸à¹", "à¸à¹à¸à¸", "à¹à¸ªà¸à¸", "วà¹à¸²", "à¸à¸²à¸", "à¸à¸µ" },
- new int[] { 0, 3, 6, 9, 13, 17, 20, 23 },
- new int[] { 3, 6, 9, 13, 17, 20, 23, 25 });
- }
-
- public void testStopWords() throws Exception {
- assertAnalyzesTo(new ThaiAnalyzer(TEST_VERSION_CURRENT), "à¸à¸²à¸£à¸à¸µà¹à¹à¸à¹à¸à¹à¸à¸à¹à¸ªà¸à¸à¸§à¹à¸²à¸à¸²à¸à¸à¸µ",
- new String[] { "à¹à¸ªà¸à¸", "à¸à¸²à¸", "à¸à¸µ" },
- new int[] { 13, 20, 23 },
- new int[] { 17, 23, 25 },
- new int[] { 5, 2, 1 });
- }
-
- public void testTokenType() throws Exception {
+ /*
+ * testcase for offsets
+ */
+ public void testOffsets() throws Exception {
+ assertAnalyzesTo(new ThaiAnalyzer(TEST_VERSION_CURRENT, CharArraySet.EMPTY_SET), "à¸à¸²à¸£à¸à¸µà¹à¹à¸à¹à¸à¹à¸à¸à¹à¸ªà¸à¸à¸§à¹à¸²à¸à¸²à¸à¸à¸µ",
+ new String[] { "à¸à¸²à¸£", "à¸à¸µà¹", "à¹à¸à¹", "à¸à¹à¸à¸", "à¹à¸ªà¸à¸", "วà¹à¸²", "à¸à¸²à¸", "à¸à¸µ" },
+ new int[] { 0, 3, 6, 9, 13, 17, 20, 23 },
+ new int[] { 3, 6, 9, 13, 17, 20, 23, 25 });
+ }
+
+ public void testStopWords() throws Exception {
+ assertAnalyzesTo(new ThaiAnalyzer(TEST_VERSION_CURRENT), "à¸à¸²à¸£à¸à¸µà¹à¹à¸à¹à¸à¹à¸à¸à¹à¸ªà¸à¸à¸§à¹à¸²à¸à¸²à¸à¸à¸µ",
+ new String[] { "à¹à¸ªà¸à¸", "à¸à¸²à¸", "à¸à¸µ" },
+ new int[] { 13, 20, 23 },
+ new int[] { 17, 23, 25 },
+ new int[] { 5, 2, 1 });
+ }
+
+ public void testTokenType() throws Exception {
assertAnalyzesTo(new ThaiAnalyzer(TEST_VERSION_CURRENT, CharArraySet.EMPTY_SET), "à¸à¸²à¸£à¸à¸µà¹à¹à¸à¹à¸à¹à¸à¸à¹à¸ªà¸à¸à¸§à¹à¸²à¸à¸²à¸à¸à¸µ à¹à¹à¹",
new String[] { "à¸à¸²à¸£", "à¸à¸µà¹", "à¹à¸à¹", "à¸à¹à¸à¸", "à¹à¸ªà¸à¸", "วà¹à¸²", "à¸à¸²à¸", "à¸à¸µ", "à¹à¹à¹" },
new String[] { "<SOUTHEAST_ASIAN>", "<SOUTHEAST_ASIAN>",
@@ -70,31 +70,31 @@ public class TestThaiAnalyzer extends Ba
"<SOUTHEAST_ASIAN>", "<SOUTHEAST_ASIAN>",
"<SOUTHEAST_ASIAN>", "<SOUTHEAST_ASIAN>",
"<NUM>" });
- }
+ }
- /*
- * Test that position increments are adjusted correctly for stopwords.
- */
- // note this test uses stopfilter's stopset
- public void testPositionIncrements() throws Exception {
- final ThaiAnalyzer analyzer = new ThaiAnalyzer(TEST_VERSION_CURRENT, StopAnalyzer.ENGLISH_STOP_WORDS_SET);
+ /*
+ * Test that position increments are adjusted correctly for stopwords.
+ */
+ // note this test uses stopfilter's stopset
+ public void testPositionIncrements() throws Exception {
+ final ThaiAnalyzer analyzer = new ThaiAnalyzer(TEST_VERSION_CURRENT, StopAnalyzer.ENGLISH_STOP_WORDS_SET);
assertAnalyzesTo(analyzer, "à¸à¸²à¸£à¸à¸µà¹à¹à¸à¹à¸à¹à¸à¸ the à¹à¸ªà¸à¸à¸§à¹à¸²à¸à¸²à¸à¸à¸µ",
new String[] { "à¸à¸²à¸£", "à¸à¸µà¹", "à¹à¸à¹", "à¸à¹à¸à¸", "à¹à¸ªà¸à¸", "วà¹à¸²", "à¸à¸²à¸", "à¸à¸µ" },
new int[] { 0, 3, 6, 9, 18, 22, 25, 28 },
new int[] { 3, 6, 9, 13, 22, 25, 28, 30 },
new int[] { 1, 1, 1, 1, 2, 1, 1, 1 });
-
- // case that a stopword is adjacent to thai text, with no whitespace
+
+ // case that a stopword is adjacent to thai text, with no whitespace
assertAnalyzesTo(analyzer, "à¸à¸²à¸£à¸à¸µà¹à¹à¸à¹à¸à¹à¸à¸the à¹à¸ªà¸à¸à¸§à¹à¸²à¸à¸²à¸à¸à¸µ",
new String[] { "à¸à¸²à¸£", "à¸à¸µà¹", "à¹à¸à¹", "à¸à¹à¸à¸", "à¹à¸ªà¸à¸", "วà¹à¸²", "à¸à¸²à¸", "à¸à¸µ" },
new int[] { 0, 3, 6, 9, 17, 21, 24, 27 },
new int[] { 3, 6, 9, 13, 21, 24, 27, 29 },
new int[] { 1, 1, 1, 1, 2, 1, 1, 1 });
- }
-
- public void testReusableTokenStream() throws Exception {
- ThaiAnalyzer analyzer = new ThaiAnalyzer(TEST_VERSION_CURRENT, CharArraySet.EMPTY_SET);
- assertAnalyzesToReuse(analyzer, "", new String[] {});
+ }
+
+ public void testReusableTokenStream() throws Exception {
+ ThaiAnalyzer analyzer = new ThaiAnalyzer(TEST_VERSION_CURRENT, CharArraySet.EMPTY_SET);
+ assertAnalyzesToReuse(analyzer, "", new String[] {});
assertAnalyzesToReuse(
analyzer,
@@ -105,8 +105,8 @@ public class TestThaiAnalyzer extends Ba
analyzer,
"à¸à¸£à¸´à¸©à¸±à¸à¸à¸·à¹à¸ XY&Z - à¸à¸¸à¸¢à¸à¸±à¸ xyz@demo.com",
new String[] { "à¸à¸£à¸´à¸©à¸±à¸", "à¸à¸·à¹à¸", "xy", "z", "à¸à¸¸à¸¢", "à¸à¸±à¸", "xyz", "demo.com" });
- }
-
+ }
+
/** blast some random strings through the analyzer */
public void testRandomStrings() throws Exception {
checkRandomData(random(), new ThaiAnalyzer(TEST_VERSION_CURRENT), 1000*RANDOM_MULTIPLIER);
Modified: lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/util/TestWordlistLoader.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/util/TestWordlistLoader.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/util/TestWordlistLoader.java (original)
+++ lucene/dev/trunk/lucene/analysis/common/src/test/org/apache/lucene/analysis/util/TestWordlistLoader.java Mon Sep 17 16:01:56 2012
@@ -46,8 +46,8 @@ public class TestWordlistLoader extends
private void checkSet(CharArraySet wordset) {
assertEquals(3, wordset.size());
- assertTrue(wordset.contains("ONE")); // case is not modified
- assertTrue(wordset.contains("two")); // surrounding whitespace is removed
+ assertTrue(wordset.contains("ONE")); // case is not modified
+ assertTrue(wordset.contains("two")); // surrounding whitespace is removed
assertTrue(wordset.contains("three"));
assertFalse(wordset.contains("four"));
}
Modified: lucene/dev/trunk/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseTokenizer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseTokenizer.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseTokenizer.java (original)
+++ lucene/dev/trunk/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/JapaneseTokenizer.java Mon Sep 17 16:01:56 2012
@@ -292,12 +292,12 @@ public final class JapaneseTokenizer ext
if (!characterDefinition.isKanji((char) buffer.get(pos2))) {
allKanji = false;
break;
- }
+ }
}
- if (allKanji) { // Process only Kanji keywords
+ if (allKanji) { // Process only Kanji keywords
return (length - SEARCH_MODE_KANJI_LENGTH) * SEARCH_MODE_KANJI_PENALTY;
} else if (length > SEARCH_MODE_OTHER_LENGTH) {
- return (length - SEARCH_MODE_OTHER_LENGTH) * SEARCH_MODE_OTHER_PENALTY;
+ return (length - SEARCH_MODE_OTHER_LENGTH) * SEARCH_MODE_OTHER_PENALTY;
}
}
return 0;
@@ -807,7 +807,7 @@ public final class JapaneseTokenizer ext
}
if (characterId == characterDefinition.getCharacterClass((char) ch) &&
isPunctuation((char) ch) == isPunct) {
- unknownWordLength++;
+ unknownWordLength++;
} else {
break;
}
Modified: lucene/dev/trunk/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/BinaryDictionary.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/BinaryDictionary.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/BinaryDictionary.java (original)
+++ lucene/dev/trunk/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/BinaryDictionary.java Mon Sep 17 16:01:56 2012
@@ -150,7 +150,7 @@ public abstract class BinaryDictionary i
ref.length = targetMapOffsets[sourceId + 1] - ref.offset;
}
- @Override
+ @Override
public int getLeftId(int wordId) {
return buffer.getShort(wordId) >>> 3;
}
@@ -162,7 +162,7 @@ public abstract class BinaryDictionary i
@Override
public int getWordCost(int wordId) {
- return buffer.getShort(wordId + 2); // Skip id
+ return buffer.getShort(wordId + 2); // Skip id
}
@Override
Modified: lucene/dev/trunk/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/Dictionary.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/Dictionary.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/Dictionary.java (original)
+++ lucene/dev/trunk/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/Dictionary.java Mon Sep 17 16:01:56 2012
@@ -28,21 +28,21 @@ public interface Dictionary {
/**
* Get left id of specified word
* @param wordId
- * @return left id
+ * @return left id
*/
public int getLeftId(int wordId);
/**
* Get right id of specified word
* @param wordId
- * @return left id
+ * @return left id
*/
public int getRightId(int wordId);
/**
* Get word cost of specified word
* @param wordId
- * @return left id
+ * @return left id
*/
public int getWordCost(int wordId);
Modified: lucene/dev/trunk/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/UnknownDictionary.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/UnknownDictionary.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/UnknownDictionary.java (original)
+++ lucene/dev/trunk/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/UnknownDictionary.java Mon Sep 17 16:01:56 2012
@@ -40,7 +40,7 @@ public final class UnknownDictionary ext
int length = 1;
for (int i = 1; i < len; i++) {
if (characterIdOfFirstCharacter == characterDefinition.getCharacterClass(text[offset+i])){
- length++;
+ length++;
} else {
break;
}
Modified: lucene/dev/trunk/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/UserDictionary.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/UserDictionary.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/UserDictionary.java (original)
+++ lucene/dev/trunk/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/UserDictionary.java Mon Sep 17 16:01:56 2012
@@ -246,7 +246,7 @@ public final class UserDictionary implem
return null;
}
- return allFeatures.split(INTERNAL_SEPARATOR);
+ return allFeatures.split(INTERNAL_SEPARATOR);
}
@@ -261,7 +261,7 @@ public final class UserDictionary implem
sb.append(CSVUtil.quoteEscape(feature)).append(",");
}
} else if (fields.length == 1) { // One feature doesn't need to escape value
- sb.append(allFeatures[fields[0]]).append(",");
+ sb.append(allFeatures[fields[0]]).append(",");
} else {
for (int field : fields){
sb.append(CSVUtil.quoteEscape(allFeatures[field])).append(",");
Modified: lucene/dev/trunk/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/util/CSVUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/util/CSVUtil.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/util/CSVUtil.java (original)
+++ lucene/dev/trunk/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/util/CSVUtil.java Mon Sep 17 16:01:56 2012
@@ -42,7 +42,7 @@ public final class CSVUtil {
*/
public static String[] parse(String line) {
boolean insideQuote = false;
- ArrayList<String> result = new ArrayList<String>();
+ ArrayList<String> result = new ArrayList<String>();
int quoteCount = 0;
StringBuilder sb = new StringBuilder();
for(int i = 0; i < line.length(); i++) {
Modified: lucene/dev/trunk/lucene/analysis/kuromoji/src/test/org/apache/lucene/analysis/ja/TestJapaneseTokenizer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/analysis/kuromoji/src/test/org/apache/lucene/analysis/ja/TestJapaneseTokenizer.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/analysis/kuromoji/src/test/org/apache/lucene/analysis/ja/TestJapaneseTokenizer.java (original)
+++ lucene/dev/trunk/lucene/analysis/kuromoji/src/test/org/apache/lucene/analysis/ja/TestJapaneseTokenizer.java Mon Sep 17 16:01:56 2012
@@ -326,12 +326,12 @@ public class TestJapaneseTokenizer exten
public void testSegmentation() throws Exception {
// Skip tests for Michelle Kwan -- UniDic segments Kwan as 㯠ã¯ã³
- // String input = "ãã·ã§ã«ã»ã¯ã¯ã³ãåªåãã¾ãããã¹ãã¼ã¹ã¹ãã¼ã·ã§ã³ã«è¡ãã¾ããããããããã";
- // String[] surfaceForms = {
- // "ãã·ã§ã«", "ã»", "ã¯ã¯ã³", "ã", "åªå", "ã", "ã¾ã", "ã", "ã",
- // "ã¹ãã¼ã¹", "ã¹ãã¼ã·ã§ã³", "ã«", "è¡ã", "ã¾ã", "ã",
- // "ãããããã", "ã"
- // };
+ // String input = "ãã·ã§ã«ã»ã¯ã¯ã³ãåªåãã¾ãããã¹ãã¼ã¹ã¹ãã¼ã·ã§ã³ã«è¡ãã¾ããããããããã";
+ // String[] surfaceForms = {
+ // "ãã·ã§ã«", "ã»", "ã¯ã¯ã³", "ã", "åªå", "ã", "ã¾ã", "ã", "ã",
+ // "ã¹ãã¼ã¹", "ã¹ãã¼ã·ã§ã³", "ã«", "è¡ã", "ã¾ã", "ã",
+ // "ãããããã", "ã"
+ // };
String input = "ã¹ãã¼ã¹ã¹ãã¼ã·ã§ã³ã«è¡ãã¾ããããããããã";
String[] surfaceForms = {
"ã¹ãã¼ã¹", "ã¹ãã¼ã·ã§ã³", "ã«", "è¡ã", "ã¾ã", "ã",
Modified: lucene/dev/trunk/lucene/analysis/kuromoji/src/test/org/apache/lucene/analysis/ja/dict/UserDictionaryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/analysis/kuromoji/src/test/org/apache/lucene/analysis/ja/dict/UserDictionaryTest.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/analysis/kuromoji/src/test/org/apache/lucene/analysis/ja/dict/UserDictionaryTest.java (original)
+++ lucene/dev/trunk/lucene/analysis/kuromoji/src/test/org/apache/lucene/analysis/ja/dict/UserDictionaryTest.java Mon Sep 17 16:01:56 2012
@@ -75,6 +75,6 @@ public class UserDictionaryTest extends
@Test
public void testRead() throws IOException {
UserDictionary dictionary = TestJapaneseTokenizer.readDict();
- assertNotNull(dictionary);
+ assertNotNull(dictionary);
}
}
Modified: lucene/dev/trunk/lucene/analysis/kuromoji/src/tools/java/org/apache/lucene/analysis/ja/util/TokenInfoDictionaryBuilder.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/analysis/kuromoji/src/tools/java/org/apache/lucene/analysis/ja/util/TokenInfoDictionaryBuilder.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/analysis/kuromoji/src/tools/java/org/apache/lucene/analysis/ja/util/TokenInfoDictionaryBuilder.java (original)
+++ lucene/dev/trunk/lucene/analysis/kuromoji/src/tools/java/org/apache/lucene/analysis/ja/util/TokenInfoDictionaryBuilder.java Mon Sep 17 16:01:56 2012
@@ -174,26 +174,26 @@ public class TokenInfoDictionaryBuilder
/*
* IPADIC features
*
- * 0 - surface
- * 1 - left cost
- * 2 - right cost
- * 3 - word cost
- * 4-9 - pos
- * 10 - base form
- * 11 - reading
- * 12 - pronounciation
+ * 0 - surface
+ * 1 - left cost
+ * 2 - right cost
+ * 3 - word cost
+ * 4-9 - pos
+ * 10 - base form
+ * 11 - reading
+ * 12 - pronounciation
*
* UniDic features
*
- * 0 - surface
- * 1 - left cost
- * 2 - right cost
- * 3 - word cost
- * 4-9 - pos
- * 10 - base form reading
- * 11 - base form
- * 12 - surface form
- * 13 - surface reading
+ * 0 - surface
+ * 1 - left cost
+ * 2 - right cost
+ * 3 - word cost
+ * 4-9 - pos
+ * 10 - base form reading
+ * 11 - base form
+ * 12 - surface form
+ * 13 - surface reading
*/
public String[] formatEntry(String[] features) {
@@ -221,7 +221,7 @@ public class TokenInfoDictionaryBuilder
} else {
features2[11] = features[13];
features2[12] = features[13];
- }
+ }
return features2;
}
}
Modified: lucene/dev/trunk/lucene/analysis/kuromoji/src/tools/java/org/apache/lucene/analysis/ja/util/UnknownDictionaryBuilder.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/analysis/kuromoji/src/tools/java/org/apache/lucene/analysis/ja/util/UnknownDictionaryBuilder.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/analysis/kuromoji/src/tools/java/org/apache/lucene/analysis/ja/util/UnknownDictionaryBuilder.java (original)
+++ lucene/dev/trunk/lucene/analysis/kuromoji/src/tools/java/org/apache/lucene/analysis/ja/util/UnknownDictionaryBuilder.java Mon Sep 17 16:01:56 2012
@@ -107,22 +107,22 @@ public class UnknownDictionaryBuilder {
continue;
}
- if(line.startsWith("0x")) { // Category mapping
- String[] values = line.split(" ", 2); // Split only first space
+ if(line.startsWith("0x")) { // Category mapping
+ String[] values = line.split(" ", 2); // Split only first space
if(!values[0].contains("..")) {
int cp = Integer.decode(values[0]).intValue();
- dictionary.putCharacterCategory(cp, values[1]);
+ dictionary.putCharacterCategory(cp, values[1]);
} else {
String[] codePoints = values[0].split("\\.\\.");
int cpFrom = Integer.decode(codePoints[0]).intValue();
int cpTo = Integer.decode(codePoints[1]).intValue();
for(int i = cpFrom; i <= cpTo; i++){
- dictionary.putCharacterCategory(i, values[1]);
+ dictionary.putCharacterCategory(i, values[1]);
}
}
- } else { // Invoke definition
+ } else { // Invoke definition
String[] values = line.split(" "); // Consecutive space is merged above
String characterClassName = values[0];
int invoke = Integer.parseInt(values[1]);
Modified: lucene/dev/trunk/lucene/analysis/phonetic/src/test/org/apache/lucene/analysis/phonetic/TestPhoneticFilterFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/analysis/phonetic/src/test/org/apache/lucene/analysis/phonetic/TestPhoneticFilterFactory.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/analysis/phonetic/src/test/org/apache/lucene/analysis/phonetic/TestPhoneticFilterFactory.java (original)
+++ lucene/dev/trunk/lucene/analysis/phonetic/src/test/org/apache/lucene/analysis/phonetic/TestPhoneticFilterFactory.java Mon Sep 17 16:01:56 2012
@@ -175,23 +175,23 @@ public class TestPhoneticFilterFactory e
}
public void testSpeed() throws Exception {
- checkSpeedEncoding("Metaphone", "easgasg", "ESKS");
- checkSpeedEncoding("DoubleMetaphone", "easgasg", "ASKS");
- checkSpeedEncoding("Soundex", "easgasg", "E220");
- checkSpeedEncoding("RefinedSoundex", "easgasg", "E034034");
- checkSpeedEncoding("Caverphone", "Carlene", "KLN1111111");
- checkSpeedEncoding("ColognePhonetic", "Schmitt", "862");
+ checkSpeedEncoding("Metaphone", "easgasg", "ESKS");
+ checkSpeedEncoding("DoubleMetaphone", "easgasg", "ASKS");
+ checkSpeedEncoding("Soundex", "easgasg", "E220");
+ checkSpeedEncoding("RefinedSoundex", "easgasg", "E034034");
+ checkSpeedEncoding("Caverphone", "Carlene", "KLN1111111");
+ checkSpeedEncoding("ColognePhonetic", "Schmitt", "862");
}
private void checkSpeedEncoding(String encoder, String toBeEncoded, String estimated) throws Exception {
- long start = System.currentTimeMillis();
- for ( int i=0; i<REPEATS; i++) {
- assertAlgorithm(encoder, "false", toBeEncoded,
- new String[] { estimated });
- }
- long duration = System.currentTimeMillis()-start;
- if (VERBOSE)
- System.out.println(encoder + " encodings per msec: "+(REPEATS/duration));
+ long start = System.currentTimeMillis();
+ for ( int i=0; i<REPEATS; i++) {
+ assertAlgorithm(encoder, "false", toBeEncoded,
+ new String[] { estimated });
+ }
+ long duration = System.currentTimeMillis()-start;
+ if (VERBOSE)
+ System.out.println(encoder + " encodings per msec: "+(REPEATS/duration));
}
}
Modified: lucene/dev/trunk/lucene/analysis/smartcn/src/java/org/apache/lucene/analysis/cn/smart/hhmm/AbstractDictionary.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/analysis/smartcn/src/java/org/apache/lucene/analysis/cn/smart/hhmm/AbstractDictionary.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/analysis/smartcn/src/java/org/apache/lucene/analysis/cn/smart/hhmm/AbstractDictionary.java (original)
+++ lucene/dev/trunk/lucene/analysis/smartcn/src/java/org/apache/lucene/analysis/cn/smart/hhmm/AbstractDictionary.java Mon Sep 17 16:01:56 2012
@@ -115,7 +115,7 @@ abstract class AbstractDictionary {
}
int b0 = (buffer[0] & 0x0FF) - 161; // Code starts from A1, therefore subtract 0xA1=161
int b1 = (buffer[1] & 0x0FF) - 161; // There is no Chinese char for the first and last symbol.
- // Therefore, each code page only has 16*6-2=94 characters.
+ // Therefore, each code page only has 16*6-2=94 characters.
return (short) (b0 * 94 + b1);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
Modified: lucene/dev/trunk/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/StreamUtils.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/StreamUtils.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/StreamUtils.java (original)
+++ lucene/dev/trunk/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/StreamUtils.java Mon Sep 17 16:01:56 2012
@@ -37,43 +37,43 @@ import org.apache.commons.compress.compr
*/
public class StreamUtils {
- /** Buffer size used across the benchmark package */
- public static final int BUFFER_SIZE = 1 << 16; // 64K
-
- /** File format type */
- public enum Type {
- /** BZIP2 is automatically used for <b>.bz2</b> and <b>.bzip2</b> extensions. */
- BZIP2(CompressorStreamFactory.BZIP2),
- /** GZIP is automatically used for <b>.gz</b> and <b>.gzip</b> extensions. */
- GZIP(CompressorStreamFactory.GZIP),
- /** Plain text is used for anything which is not GZIP or BZIP. */
- PLAIN(null);
- private final String csfType;
- Type(String csfType) {
- this.csfType = csfType;
- }
- private InputStream inputStream(InputStream in) throws IOException {
- try {
- return csfType==null ? in : new CompressorStreamFactory().createCompressorInputStream(csfType, in);
- } catch (CompressorException e) {
- IOException ioe = new IOException(e.getMessage());
- ioe.initCause(e);
- throw ioe; }
- }
- private OutputStream outputStream(OutputStream os) throws IOException {
- try {
- return csfType==null ? os : new CompressorStreamFactory().createCompressorOutputStream(csfType, os);
- } catch (CompressorException e) {
- IOException ioe = new IOException(e.getMessage());
- ioe.initCause(e);
- throw ioe;
- }
- }
- }
-
+ /** Buffer size used across the benchmark package */
+ public static final int BUFFER_SIZE = 1 << 16; // 64K
+
+ /** File format type */
+ public enum Type {
+ /** BZIP2 is automatically used for <b>.bz2</b> and <b>.bzip2</b> extensions. */
+ BZIP2(CompressorStreamFactory.BZIP2),
+ /** GZIP is automatically used for <b>.gz</b> and <b>.gzip</b> extensions. */
+ GZIP(CompressorStreamFactory.GZIP),
+ /** Plain text is used for anything which is not GZIP or BZIP. */
+ PLAIN(null);
+ private final String csfType;
+ Type(String csfType) {
+ this.csfType = csfType;
+ }
+ private InputStream inputStream(InputStream in) throws IOException {
+ try {
+ return csfType==null ? in : new CompressorStreamFactory().createCompressorInputStream(csfType, in);
+ } catch (CompressorException e) {
+ IOException ioe = new IOException(e.getMessage());
+ ioe.initCause(e);
+ throw ioe; }
+ }
+ private OutputStream outputStream(OutputStream os) throws IOException {
+ try {
+ return csfType==null ? os : new CompressorStreamFactory().createCompressorOutputStream(csfType, os);
+ } catch (CompressorException e) {
+ IOException ioe = new IOException(e.getMessage());
+ ioe.initCause(e);
+ throw ioe;
+ }
+ }
+ }
+
private static final Map<String,Type> extensionToType = new HashMap<String,Type>();
static {
- // these in are lower case, we will lower case at the test as well
+ // these in are lower case, we will lower case at the test as well
extensionToType.put(".bz2", Type.BZIP2);
extensionToType.put(".bzip", Type.BZIP2);
extensionToType.put(".gz", Type.GZIP);
@@ -95,14 +95,14 @@ public class StreamUtils {
/** Return the type of the file, or null if unknown */
private static Type fileType(File file) {
- Type type = null;
+ Type type = null;
String fileName = file.getName();
int idx = fileName.lastIndexOf('.');
if (idx != -1) {
type = extensionToType.get(fileName.substring(idx).toLowerCase(Locale.ROOT));
}
return type==null ? Type.PLAIN : type;
- }
+ }
/**
* Returns an {@link OutputStream} over the requested file, identifying
Modified: lucene/dev/trunk/lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/tasks/WriteLineDocTaskTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/tasks/WriteLineDocTaskTest.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/tasks/WriteLineDocTaskTest.java (original)
+++ lucene/dev/trunk/lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/tasks/WriteLineDocTaskTest.java Mon Sep 17 16:01:56 2012
@@ -157,16 +157,16 @@ public class WriteLineDocTaskTest extend
String expDate, String expBody) throws Exception {
InputStream in = new FileInputStream(file);
switch(fileType) {
- case BZIP2:
- in = csFactory.createCompressorInputStream(CompressorStreamFactory.BZIP2, in);
- break;
- case GZIP:
- in = csFactory.createCompressorInputStream(CompressorStreamFactory.GZIP, in);
- break;
- case PLAIN:
- break; // nothing to do
- default:
- assertFalse("Unknown file type!",true); //fail, should not happen
+ case BZIP2:
+ in = csFactory.createCompressorInputStream(CompressorStreamFactory.BZIP2, in);
+ break;
+ case GZIP:
+ in = csFactory.createCompressorInputStream(CompressorStreamFactory.GZIP, in);
+ break;
+ case PLAIN:
+ break; // nothing to do
+ default:
+ assertFalse("Unknown file type!",true); //fail, should not happen
}
BufferedReader br = new BufferedReader(new InputStreamReader(in, "utf-8"));
try {
Modified: lucene/dev/trunk/lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/utils/StreamUtilsTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/utils/StreamUtilsTest.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/utils/StreamUtilsTest.java (original)
+++ lucene/dev/trunk/lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/utils/StreamUtilsTest.java Mon Sep 17 16:01:56 2012
@@ -57,38 +57,38 @@ public class StreamUtilsTest extends Ben
@Test
public void testGetInputStreamBzip2() throws Exception {
- assertReadText(rawBzip2File("bz2"));
- assertReadText(rawBzip2File("bzip"));
- assertReadText(rawBzip2File("BZ2"));
- assertReadText(rawBzip2File("BZIP"));
+ assertReadText(rawBzip2File("bz2"));
+ assertReadText(rawBzip2File("bzip"));
+ assertReadText(rawBzip2File("BZ2"));
+ assertReadText(rawBzip2File("BZIP"));
}
@Test
public void testGetOutputStreamBzip2() throws Exception {
- assertReadText(autoOutFile("bz2"));
- assertReadText(autoOutFile("bzip"));
- assertReadText(autoOutFile("BZ2"));
- assertReadText(autoOutFile("BZIP"));
+ assertReadText(autoOutFile("bz2"));
+ assertReadText(autoOutFile("bzip"));
+ assertReadText(autoOutFile("BZ2"));
+ assertReadText(autoOutFile("BZIP"));
}
@Test
public void testGetOutputStreamGzip() throws Exception {
- assertReadText(autoOutFile("gz"));
- assertReadText(autoOutFile("gzip"));
- assertReadText(autoOutFile("GZ"));
- assertReadText(autoOutFile("GZIP"));
+ assertReadText(autoOutFile("gz"));
+ assertReadText(autoOutFile("gzip"));
+ assertReadText(autoOutFile("GZ"));
+ assertReadText(autoOutFile("GZIP"));
}
@Test
public void testGetOutputStreamPlain() throws Exception {
- assertReadText(autoOutFile("txt"));
- assertReadText(autoOutFile("text"));
- assertReadText(autoOutFile("TXT"));
- assertReadText(autoOutFile("TEXT"));
+ assertReadText(autoOutFile("txt"));
+ assertReadText(autoOutFile("text"));
+ assertReadText(autoOutFile("TXT"));
+ assertReadText(autoOutFile("TEXT"));
}
private File rawTextFile(String ext) throws Exception {
- File f = new File(testDir,"testfile." + ext);
+ File f = new File(testDir,"testfile." + ext);
BufferedWriter w = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(f), IOUtils.CHARSET_UTF_8));
w.write(TEXT);
w.newLine();
@@ -97,32 +97,32 @@ public class StreamUtilsTest extends Ben
}
private File rawGzipFile(String ext) throws Exception {
- File f = new File(testDir,"testfile." + ext);
+ File f = new File(testDir,"testfile." + ext);
OutputStream os = new CompressorStreamFactory().createCompressorOutputStream(CompressorStreamFactory.GZIP, new FileOutputStream(f));
writeText(os);
return f;
}
private File rawBzip2File(String ext) throws Exception {
- File f = new File(testDir,"testfile." + ext);
- OutputStream os = new CompressorStreamFactory().createCompressorOutputStream(CompressorStreamFactory.BZIP2, new FileOutputStream(f));
- writeText(os);
- return f;
+ File f = new File(testDir,"testfile." + ext);
+ OutputStream os = new CompressorStreamFactory().createCompressorOutputStream(CompressorStreamFactory.BZIP2, new FileOutputStream(f));
+ writeText(os);
+ return f;
}
private File autoOutFile(String ext) throws Exception {
- File f = new File(testDir,"testfile." + ext);
- OutputStream os = StreamUtils.outputStream(f);
- writeText(os);
- return f;
+ File f = new File(testDir,"testfile." + ext);
+ OutputStream os = StreamUtils.outputStream(f);
+ writeText(os);
+ return f;
}
- private void writeText(OutputStream os) throws IOException {
- BufferedWriter w = new BufferedWriter(new OutputStreamWriter(os, IOUtils.CHARSET_UTF_8));
- w.write(TEXT);
- w.newLine();
- w.close();
- }
+ private void writeText(OutputStream os) throws IOException {
+ BufferedWriter w = new BufferedWriter(new OutputStreamWriter(os, IOUtils.CHARSET_UTF_8));
+ w.write(TEXT);
+ w.newLine();
+ w.close();
+ }
private void assertReadText(File f) throws Exception {
InputStream ir = StreamUtils.inputStream(f);
Modified: lucene/dev/trunk/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/FixedGapTermsIndexReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/FixedGapTermsIndexReader.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/FixedGapTermsIndexReader.java (original)
+++ lucene/dev/trunk/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/FixedGapTermsIndexReader.java Mon Sep 17 16:01:56 2012
@@ -170,7 +170,7 @@ public class FixedGapTermsIndexReader ex
@Override
public long seek(BytesRef target) {
- int lo = 0; // binary search
+ int lo = 0; // binary search
int hi = fieldIndex.numIndexTerms - 1;
assert totalIndexInterval > 0 : "totalIndexInterval=" + totalIndexInterval;
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/codecs/lucene40/BitVector.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/codecs/lucene40/BitVector.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/codecs/lucene40/BitVector.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/codecs/lucene40/BitVector.java Mon Sep 17 16:01:56 2012
@@ -163,7 +163,7 @@ final class BitVector implements Cloneab
int c = 0;
int end = bits.length;
for (int i = 0; i < end; i++) {
- c += BYTE_COUNTS[bits[i] & 0xFF]; // sum bits per byte
+ c += BYTE_COUNTS[bits[i] & 0xFF]; // sum bits per byte
}
count = c;
}
@@ -176,12 +176,12 @@ final class BitVector implements Cloneab
int c = 0;
int end = bits.length;
for (int i = 0; i < end; i++) {
- c += BYTE_COUNTS[bits[i] & 0xFF]; // sum bits per byte
+ c += BYTE_COUNTS[bits[i] & 0xFF]; // sum bits per byte
}
return c;
}
- private static final byte[] BYTE_COUNTS = { // table of bits/byte
+ private static final byte[] BYTE_COUNTS = { // table of bits/byte
0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java Mon Sep 17 16:01:56 2012
@@ -1672,7 +1672,7 @@ public class CheckIndex {
" times, to check more than one segment, eg '-segment _2 -segment _a'.\n" +
" You can't use this with the -fix option\n" +
" -dir-impl X: use a specific " + FSDirectory.class.getSimpleName() + " implementation. " +
- "If no package is specified the " + FSDirectory.class.getPackage().getName() + " package will be used.\n" +
+ "If no package is specified the " + FSDirectory.class.getPackage().getName() + " package will be used.\n" +
"\n" +
"**WARNING**: -fix should only be used on an emergency basis as it will cause\n" +
"documents (perhaps many) to be permanently removed from the index. Always make\n" +
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterFlushControl.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterFlushControl.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterFlushControl.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/DocumentsWriterFlushControl.java Mon Sep 17 16:01:56 2012
@@ -396,11 +396,11 @@ final class DocumentsWriterFlushControl
return flushingWriters.size();
}
- public boolean doApplyAllDeletes() {
+ public boolean doApplyAllDeletes() {
return flushDeletes.getAndSet(false);
}
- public void setApplyAllDeletes() {
+ public void setApplyAllDeletes() {
flushDeletes.set(true);
}
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/IndexFileDeleter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/IndexFileDeleter.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/IndexFileDeleter.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/IndexFileDeleter.java Mon Sep 17 16:01:56 2012
@@ -571,7 +571,7 @@ final class IndexFileDeleter {
infoStream.message("IFD", "delete \"" + fileName + "\"");
}
directory.deleteFile(fileName);
- } catch (IOException e) { // if delete fails
+ } catch (IOException e) { // if delete fails
if (directory.fileExists(fileName)) {
// Some operating systems (e.g. Windows) don't
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java Mon Sep 17 16:01:56 2012
@@ -2847,7 +2847,7 @@ public class IndexWriter implements Clos
final boolean anySegmentFlushed;
synchronized (fullFlushLock) {
- boolean flushSuccess = false;
+ boolean flushSuccess = false;
try {
anySegmentFlushed = docWriter.flushAllThreads();
flushSuccess = true;
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/SegmentInfo.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/SegmentInfo.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/SegmentInfo.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/index/SegmentInfo.java Mon Sep 17 16:01:56 2012
@@ -42,9 +42,9 @@ public final class SegmentInfo {
public static final int NO = -1; // e.g. no norms; no deletes;
public static final int YES = 1; // e.g. have norms; have deletes;
- public final String name; // unique name in dir
- private int docCount; // number of docs in seg
- public final Directory dir; // where segment resides
+ public final String name; // unique name in dir
+ private int docCount; // number of docs in seg
+ public final Directory dir; // where segment resides
private boolean isCompoundFile;
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/BooleanQuery.java Mon Sep 17 16:01:56 2012
@@ -404,7 +404,7 @@ public class BooleanQuery extends Query
public Query rewrite(IndexReader reader) throws IOException {
if (minNrShouldMatch == 0 && clauses.size() == 1) { // optimize 1-clause queries
BooleanClause c = clauses.get(0);
- if (!c.isProhibited()) { // just return clause
+ if (!c.isProhibited()) { // just return clause
Query query = c.getQuery().rewrite(reader); // rewrite first
@@ -475,7 +475,7 @@ public class BooleanQuery extends Query
Query subQuery = c.getQuery();
if (subQuery != null) {
- if (subQuery instanceof BooleanQuery) { // wrap sub-bools in parens
+ if (subQuery instanceof BooleanQuery) { // wrap sub-bools in parens
buffer.append("(");
buffer.append(subQuery.toString(field));
buffer.append(")");
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/FieldCache.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/FieldCache.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/FieldCache.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/FieldCache.java Mon Sep 17 16:01:56 2012
@@ -508,7 +508,7 @@ public interface FieldCache {
// this special case is the reason that Arrays.binarySearch() isn't useful.
if (key == null)
return 0;
-
+
int low = 1;
int high = numOrd()-1;
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/FieldCacheImpl.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/FieldCacheImpl.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/FieldCacheImpl.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/FieldCacheImpl.java Mon Sep 17 16:01:56 2012
@@ -52,7 +52,7 @@ import org.apache.lucene.util.packed.Pac
* @since lucene 1.4
*/
class FieldCacheImpl implements FieldCache {
-
+
private Map<Class<?>,Cache> caches;
FieldCacheImpl() {
init();
@@ -173,7 +173,7 @@ class FieldCacheImpl implements FieldCac
((AtomicReader)key).addReaderClosedListener(purgeReader);
} else {
// last chance
- reader.addReaderClosedListener(purgeReader);
+ reader.addReaderClosedListener(purgeReader);
}
}
}
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/FilteredDocIdSetIterator.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/FilteredDocIdSetIterator.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/FilteredDocIdSetIterator.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/FilteredDocIdSetIterator.java Mon Sep 17 16:01:56 2012
@@ -28,7 +28,7 @@ import java.io.IOException;
public abstract class FilteredDocIdSetIterator extends DocIdSetIterator {
protected DocIdSetIterator _innerIter;
private int doc;
-
+
/**
* Constructor.
* @param innerIter Underlying DocIdSetIterator.
@@ -40,7 +40,7 @@ public abstract class FilteredDocIdSetIt
_innerIter = innerIter;
doc = -1;
}
-
+
/**
* Validation method to determine whether a docid should be in the result set.
* @param doc docid to be tested
@@ -48,7 +48,7 @@ public abstract class FilteredDocIdSetIt
* @see #FilteredDocIdSetIterator(DocIdSetIterator)
*/
protected abstract boolean match(int doc);
-
+
@Override
public int docID() {
return doc;
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/MultiPhraseQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/MultiPhraseQuery.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/MultiPhraseQuery.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/MultiPhraseQuery.java Mon Sep 17 16:01:56 2012
@@ -110,7 +110,7 @@ public class MultiPhraseQuery extends Qu
* Do not modify the List or its contents.
*/
public List<Term[]> getTermArrays() {
- return Collections.unmodifiableList(termArrays);
+ return Collections.unmodifiableList(termArrays);
}
/**
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/PhrasePositions.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/PhrasePositions.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/PhrasePositions.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/PhrasePositions.java Mon Sep 17 16:01:56 2012
@@ -24,13 +24,13 @@ import org.apache.lucene.index.*;
* Position of a term in a document that takes into account the term offset within the phrase.
*/
final class PhrasePositions {
- int doc; // current doc
- int position; // position in doc
- int count; // remaining pos in this doc
- int offset; // position in phrase
+ int doc; // current doc
+ int position; // position in doc
+ int count; // remaining pos in this doc
+ int offset; // position in phrase
final int ord; // unique across all PhrasePositions instances
- final DocsAndPositionsEnum postings; // stream of docs & positions
- PhrasePositions next; // used to make lists
+ final DocsAndPositionsEnum postings; // stream of docs & positions
+ PhrasePositions next; // used to make lists
int rptGroup = -1; // >=0 indicates that this is a repeating PP
int rptInd; // index in the rptGroup
final Term[] terms; // for repetitions initialization
@@ -42,7 +42,7 @@ final class PhrasePositions {
this.terms = terms;
}
- final boolean next() throws IOException { // increments to next doc
+ final boolean next() throws IOException { // increments to next doc
doc = postings.nextDoc();
if (doc == DocIdSetIterator.NO_MORE_DOCS) {
return false;
@@ -59,7 +59,7 @@ final class PhrasePositions {
}
final void firstPosition() throws IOException {
- count = postings.freq(); // read first pos
+ count = postings.freq(); // read first pos
nextPosition();
}
@@ -70,7 +70,7 @@ final class PhrasePositions {
* have exactly the same <code>position</code>.
*/
final boolean nextPosition() throws IOException {
- if (count-- > 0) { // read subsequent pos's
+ if (count-- > 0) { // read subsequent pos's
position = postings.nextPosition() - offset;
return true;
} else
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/PhraseQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/PhraseQuery.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/PhraseQuery.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/PhraseQuery.java Mon Sep 17 16:01:56 2012
@@ -281,7 +281,7 @@ public class PhraseQuery extends Query {
ArrayUtil.mergeSort(postingsFreqs);
}
- if (slop == 0) { // optimize exact case
+ if (slop == 0) { // optimize exact case
ExactPhraseScorer s = new ExactPhraseScorer(this, postingsFreqs, similarity.exactSimScorer(stats, context));
if (s.noDocs) {
return null;
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/payloads/MinPayloadFunction.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/payloads/MinPayloadFunction.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/payloads/MinPayloadFunction.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/payloads/MinPayloadFunction.java Mon Sep 17 16:01:56 2012
@@ -24,12 +24,12 @@ package org.apache.lucene.search.payload
public class MinPayloadFunction extends PayloadFunction {
@Override
- public float currentScore(int docId, String field, int start, int end, int numPayloadsSeen, float currentScore, float currentPayloadScore) {
+ public float currentScore(int docId, String field, int start, int end, int numPayloadsSeen, float currentScore, float currentPayloadScore) {
if (numPayloadsSeen == 0) {
return currentPayloadScore;
} else {
- return Math.min(currentPayloadScore, currentScore);
- }
+ return Math.min(currentPayloadScore, currentScore);
+ }
}
@Override
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/payloads/PayloadFunction.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/payloads/PayloadFunction.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/payloads/PayloadFunction.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/payloads/PayloadFunction.java Mon Sep 17 16:01:56 2012
@@ -56,10 +56,10 @@ public abstract class PayloadFunction {
public abstract float docScore(int docId, String field, int numPayloadsSeen, float payloadScore);
public Explanation explain(int docId, String field, int numPayloadsSeen, float payloadScore){
- Explanation result = new Explanation();
- result.setDescription(getClass().getSimpleName() + ".docScore()");
- result.setValue(docScore(docId, field, numPayloadsSeen, payloadScore));
- return result;
+ Explanation result = new Explanation();
+ result.setDescription(getClass().getSimpleName() + ".docScore()");
+ result.setValue(docScore(docId, field, numPayloadsSeen, payloadScore));
+ return result;
};
@Override
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/payloads/PayloadNearQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/payloads/PayloadNearQuery.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/payloads/PayloadNearQuery.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/payloads/PayloadNearQuery.java Mon Sep 17 16:01:56 2012
@@ -257,7 +257,7 @@ public class PayloadNearQuery extends Sp
getPayloads(spansArr);
more = spans.next();
} while (more && (doc == spans.doc()));
- return true;
+ return true;
}
@Override
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/spans/NearSpansOrdered.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/spans/NearSpansOrdered.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/spans/NearSpansOrdered.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/spans/NearSpansOrdered.java Mon Sep 17 16:01:56 2012
@@ -117,7 +117,7 @@ public class NearSpansOrdered extends Sp
public int end() { return matchEnd; }
public Spans[] getSubSpans() {
- return subSpans;
+ return subSpans;
}
// TODO: Remove warning after API has been finalized
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/spans/NearSpansUnordered.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/spans/NearSpansUnordered.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/spans/NearSpansUnordered.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/spans/NearSpansUnordered.java Mon Sep 17 16:01:56 2012
@@ -151,7 +151,7 @@ public class NearSpansUnordered extends
}
}
public Spans[] getSubSpans() {
- return subSpans;
+ return subSpans;
}
@Override
public boolean next() throws IOException {
@@ -286,7 +286,7 @@ public class NearSpansUnordered extends
}
private void addToList(SpansCell cell) {
- if (last != null) { // add next to end of list
+ if (last != null) { // add next to end of list
last.next = cell;
} else
first = cell;
@@ -295,7 +295,7 @@ public class NearSpansUnordered extends
}
private void firstToLast() {
- last.next = first; // move first to end of list
+ last.next = first; // move first to end of list
last = first;
first = first.next;
last.next = null;
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/spans/SpanNearQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/spans/SpanNearQuery.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/spans/SpanNearQuery.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/spans/SpanNearQuery.java Mon Sep 17 16:01:56 2012
@@ -92,9 +92,9 @@ public class SpanNearQuery extends SpanQ
@Override
public void extractTerms(Set<Term> terms) {
- for (final SpanQuery clause : clauses) {
- clause.extractTerms(terms);
- }
+ for (final SpanQuery clause : clauses) {
+ clause.extractTerms(terms);
+ }
}
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/spans/SpanPositionCheckQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/spans/SpanPositionCheckQuery.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/spans/SpanPositionCheckQuery.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/spans/SpanPositionCheckQuery.java Mon Sep 17 16:01:56 2012
@@ -57,7 +57,7 @@ public abstract class SpanPositionCheckQ
@Override
public void extractTerms(Set<Term> terms) {
- match.extractTerms(terms);
+ match.extractTerms(terms);
}
/**
@@ -186,4 +186,4 @@ public abstract class SpanPositionCheckQ
}
}
-}
\ No newline at end of file
+}
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/spans/Spans.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/spans/Spans.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/spans/Spans.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/search/spans/Spans.java Mon Sep 17 16:01:56 2012
@@ -34,7 +34,7 @@ public abstract class Spans {
* boolean skipTo(int target) {
* do {
* if (!next())
- * return false;
+ * return false;
* } while (target > doc());
* return true;
* }
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/BufferedIndexInput.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/BufferedIndexInput.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/BufferedIndexInput.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/BufferedIndexInput.java Mon Sep 17 16:01:56 2012
@@ -41,9 +41,9 @@ public abstract class BufferedIndexInput
protected byte[] buffer;
- private long bufferStart = 0; // position in file of buffer
- private int bufferLength = 0; // end of valid bytes
- private int bufferPosition = 0; // next byte to read
+ private long bufferStart = 0; // position in file of buffer
+ private int bufferLength = 0; // end of valid bytes
+ private int bufferPosition = 0; // next byte to read
@Override
public final byte readByte() throws IOException {
@@ -259,7 +259,7 @@ public abstract class BufferedIndexInput
private void refill() throws IOException {
long start = bufferStart + bufferPosition;
long end = start + bufferSize;
- if (end > length()) // don't read past EOF
+ if (end > length()) // don't read past EOF
end = length();
int newLength = (int)(end - start);
if (newLength <= 0)
@@ -294,7 +294,7 @@ public abstract class BufferedIndexInput
else {
bufferStart = pos;
bufferPosition = 0;
- bufferLength = 0; // trigger refill() on read()
+ bufferLength = 0; // trigger refill() on read()
seekInternal(pos);
}
}
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/Lock.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/Lock.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/Lock.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/store/Lock.java Mon Sep 17 16:01:56 2012
@@ -135,7 +135,7 @@ public abstract class Lock {
return doBody();
} finally {
if (locked)
- lock.release();
+ lock.release();
}
}
}
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/Constants.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/Constants.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/Constants.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/Constants.java Mon Sep 17 16:01:56 2012
@@ -26,7 +26,7 @@ import org.apache.lucene.LucenePackage;
**/
public final class Constants {
- private Constants() {} // can't construct
+ private Constants() {} // can't construct
/** JVM vendor info. */
public static final String JVM_VENDOR = System.getProperty("java.vm.vendor");
Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/PriorityQueue.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/PriorityQueue.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/PriorityQueue.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/PriorityQueue.java Mon Sep 17 16:01:56 2012
@@ -177,11 +177,11 @@ public abstract class PriorityQueue<T> {
time. */
public final T pop() {
if (size > 0) {
- T result = heap[1]; // save first value
- heap[1] = heap[size]; // move last to first
- heap[size] = null; // permit GC of objects
+ T result = heap[1]; // save first value
+ heap[1] = heap[size]; // move last to first
+ heap[size] = null; // permit GC of objects
size--;
- downHeap(); // adjust heap
+ downHeap(); // adjust heap
return result;
} else
return null;
@@ -226,26 +226,26 @@ public abstract class PriorityQueue<T> {
private final void upHeap() {
int i = size;
- T node = heap[i]; // save bottom node
+ T node = heap[i]; // save bottom node
int j = i >>> 1;
while (j > 0 && lessThan(node, heap[j])) {
- heap[i] = heap[j]; // shift parents down
+ heap[i] = heap[j]; // shift parents down
i = j;
j = j >>> 1;
}
- heap[i] = node; // install saved node
+ heap[i] = node; // install saved node
}
private final void downHeap() {
int i = 1;
- T node = heap[i]; // save top node
- int j = i << 1; // find smaller child
+ T node = heap[i]; // save top node
+ int j = i << 1; // find smaller child
int k = j + 1;
if (k <= size && lessThan(heap[k], heap[j])) {
j = k;
}
while (j <= size && lessThan(heap[j], node)) {
- heap[i] = heap[j]; // shift up child
+ heap[i] = heap[j]; // shift up child
i = j;
j = i << 1;
k = j + 1;
@@ -253,7 +253,7 @@ public abstract class PriorityQueue<T> {
j = k;
}
}
- heap[i] = node; // install saved node
+ heap[i] = node; // install saved node
}
/** This method returns the internal heap array as Object[].
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestLongPostings.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestLongPostings.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestLongPostings.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestLongPostings.java Mon Sep 17 16:01:56 2012
@@ -111,26 +111,26 @@ public class TestLongPostings extends Lu
}
final IndexReader r;
- final IndexWriterConfig iwc = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()))
- .setOpenMode(IndexWriterConfig.OpenMode.CREATE)
- .setMergePolicy(newLogMergePolicy());
- iwc.setRAMBufferSizeMB(16.0 + 16.0 * random().nextDouble());
- iwc.setMaxBufferedDocs(-1);
- final RandomIndexWriter riw = new RandomIndexWriter(random(), dir, iwc);
-
- for(int idx=0;idx<NUM_DOCS;idx++) {
- final Document doc = new Document();
- String s = isS1.get(idx) ? s1 : s2;
- final Field f = newTextField("field", s, Field.Store.NO);
- final int count = _TestUtil.nextInt(random(), 1, 4);
- for(int ct=0;ct<count;ct++) {
- doc.add(f);
- }
- riw.addDocument(doc);
- }
-
- r = riw.getReader();
- riw.close();
+ final IndexWriterConfig iwc = newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random()))
+ .setOpenMode(IndexWriterConfig.OpenMode.CREATE)
+ .setMergePolicy(newLogMergePolicy());
+ iwc.setRAMBufferSizeMB(16.0 + 16.0 * random().nextDouble());
+ iwc.setMaxBufferedDocs(-1);
+ final RandomIndexWriter riw = new RandomIndexWriter(random(), dir, iwc);
+
+ for(int idx=0;idx<NUM_DOCS;idx++) {
+ final Document doc = new Document();
+ String s = isS1.get(idx) ? s1 : s2;
+ final Field f = newTextField("field", s, Field.Store.NO);
+ final int count = _TestUtil.nextInt(random(), 1, 4);
+ for(int ct=0;ct<count;ct++) {
+ doc.add(f);
+ }
+ riw.addDocument(doc);
+ }
+
+ r = riw.getReader();
+ riw.close();
/*
if (VERBOSE) {
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestParallelReaderEmptyIndex.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestParallelReaderEmptyIndex.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestParallelReaderEmptyIndex.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestParallelReaderEmptyIndex.java Mon Sep 17 16:01:56 2012
@@ -152,7 +152,7 @@ public class TestParallelReaderEmptyInde
rd1.close();
rd2.close();
-
+
iwOut.forceMerge(1);
iwOut.close();
Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestSameTokenSamePosition.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestSameTokenSamePosition.java?rev=1386681&r1=1386680&r2=1386681&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestSameTokenSamePosition.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestSameTokenSamePosition.java Mon Sep 17 16:01:56 2012
@@ -78,7 +78,7 @@ final class BugReproTokenStream extends
offsetAtt.setOffset(starts[nextTokenIndex], ends[nextTokenIndex]);
posIncAtt.setPositionIncrement(incs[nextTokenIndex]);
nextTokenIndex++;
- return true;
+ return true;
} else {
return false;
}