You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Uwe Schindler (JIRA)" <ji...@apache.org> on 2011/01/25 20:47:43 UTC

[jira] Resolved: (LUCENE-1438) StandardTokenizer splits host names with hyphens into multiple tokens

     [ https://issues.apache.org/jira/browse/LUCENE-1438?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Uwe Schindler resolved LUCENE-1438.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 3.1

In 3.1 there will be a replacement for the obsolete StandardTokenizer (the deprecated old one is now called ClassicTokenizer): LUCENE-2167, LUCENE-2763

StandardTokenizer as of Lucene 3.1 does not handle host names alltogether; instead you can use UAX29URLEmailTokenizer instead (also in standard package).

> StandardTokenizer splits host names with hyphens into multiple tokens
> ---------------------------------------------------------------------
>
>                 Key: LUCENE-1438
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1438
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: contrib/analyzers
>    Affects Versions: 2.4
>            Reporter: Robert Newson
>             Fix For: 3.1
>
>
> StandardTokenizer does not recognize host names with hyphens as a single HOST token. Specifically "www.m-w.com" is tokenized as "www.m" and "w.com", both of "<HOST>" type.
> StandardTokenizer should instead output a single HOST token for "www.m-w.com", since hyphens are a legitimate character in DNS host names.
> We've a local fix to the grammar file which also required us to significantly simplify the NUM type to get the behavior we needed for host names.
> here's a junit test for the desired behavior;
> 	public void testWithHyphens() throws Exception {
> 		final String host = "www.m-w.com";
> 		final StandardTokenizer tokenizer = new StandardTokenizer(
> 				new StringReader(host));
> 		final Token token = new Token();
> 		tokenizer.next(token);
> 		assertEquals("<HOST>", token.type());
> 		assertEquals("www.m-w.com", token.term());
> 	}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org