mirror of https://github.com/apache/lucene.git
LUCENE-1151: fix misleading javadoc comment and testcase for StandardAnalyzer
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@692634 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9e88734177
commit
6242cb3322
|
@ -45,7 +45,7 @@ public class StandardAnalyzer extends Analyzer {
|
|||
|
||||
private static boolean defaultReplaceInvalidAcronym;
|
||||
|
||||
// Default to false (fixed the bug), unless the system prop is set
|
||||
// Default to true (fixed the bug), unless the system prop is set
|
||||
static {
|
||||
final String v = System.getProperty("org.apache.lucene.analysis.standard.StandardAnalyzer.replaceInvalidAcronym");
|
||||
if (v == null || v.equals("true"))
|
||||
|
|
|
@ -132,14 +132,15 @@ public class TestStandardAnalyzer extends LuceneTestCase {
|
|||
}
|
||||
|
||||
public void testDomainNames() throws Exception {
|
||||
// Don't reuse a because we alter its state (setReplaceInvalidAcronym)
|
||||
StandardAnalyzer a2 = new StandardAnalyzer();
|
||||
// domain names
|
||||
assertAnalyzesTo(a, "www.nutch.org", new String[]{"www.nutch.org"});
|
||||
assertAnalyzesTo(a2, "www.nutch.org", new String[]{"www.nutch.org"});
|
||||
//Notice the trailing . See https://issues.apache.org/jira/browse/LUCENE-1068.
|
||||
// the following should be recognized as HOST:
|
||||
assertAnalyzesTo(a, "www.nutch.org.", new String[]{ "www.nutch.org" }, new String[] { "<HOST>" });
|
||||
((StandardAnalyzer) a).setReplaceInvalidAcronym(false);
|
||||
assertAnalyzesTo(a, "www.nutch.org.", new String[]{ "wwwnutchorg" }, new String[] { "<ACRONYM>" });
|
||||
((StandardAnalyzer) a).setReplaceInvalidAcronym(true);
|
||||
assertAnalyzesTo(a2, "www.nutch.org.", new String[]{ "www.nutch.org" }, new String[] { "<HOST>" });
|
||||
a2.setReplaceInvalidAcronym(false);
|
||||
assertAnalyzesTo(a2, "www.nutch.org.", new String[]{ "wwwnutchorg" }, new String[] { "<ACRONYM>" });
|
||||
}
|
||||
|
||||
public void testEMailAddresses() throws Exception {
|
||||
|
|
Loading…
Reference in New Issue