lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Muir <rcm...@gmail.com>
Subject Re: svn commit: r817643 - /lucene/solr/trunk/src/test/org/apache/solr/analysis/TestMultiWordSynonyms.java
Date Sun, 30 Jan 2011 14:09:39 GMT
Shalin, did you intend to add the Apache License to this file?

On Tue, Sep 22, 2009 at 9:02 AM,  <shalin@apache.org> wrote:
> Author: shalin
> Date: Tue Sep 22 13:02:39 2009
> New Revision: 817643
>
> URL: http://svn.apache.org/viewvc?rev=817643&view=rev
> Log:
> Added test for multi word synonyms
>
> Added:
>    lucene/solr/trunk/src/test/org/apache/solr/analysis/TestMultiWordSynonyms.java  
(with props)
>
> Added: lucene/solr/trunk/src/test/org/apache/solr/analysis/TestMultiWordSynonyms.java
> URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/test/org/apache/solr/analysis/TestMultiWordSynonyms.java?rev=817643&view=auto
> ==============================================================================
> --- lucene/solr/trunk/src/test/org/apache/solr/analysis/TestMultiWordSynonyms.java (added)
> +++ lucene/solr/trunk/src/test/org/apache/solr/analysis/TestMultiWordSynonyms.java Tue
Sep 22 13:02:39 2009
> @@ -0,0 +1,37 @@
> +package org.apache.solr.analysis;
> +
> +import org.apache.lucene.analysis.WhitespaceTokenizer;
> +import org.apache.lucene.analysis.tokenattributes.TermAttribute;
> +import org.junit.Assert;
> +import org.junit.Test;
> +
> +import java.io.IOException;
> +import java.io.StringReader;
> +import java.util.ArrayList;
> +import java.util.Arrays;
> +import java.util.List;
> +
> +/**
> + * @version $Id$
> + * @since solr 1.4
> + */
> +public class TestMultiWordSynonyms {
> +
> +  @Test
> +  public void testMultiWordSynonmys() throws IOException {
> +    List<String> rules = new ArrayList<String>();
> +    rules.add("a b c,d");
> +    SynonymMap synMap = new SynonymMap(true);
> +    SynonymFilterFactory.parseRules(rules, synMap, "=>", ",", true, null);
> +
> +    SynonymFilter ts = new SynonymFilter(new WhitespaceTokenizer(new StringReader("a
e")), synMap);
> +    TermAttribute termAtt = (TermAttribute) ts.getAttribute(TermAttribute.class);
> +
> +    ts.reset();
> +    List<String> tokens = new ArrayList<String>();
> +    while (ts.incrementToken()) tokens.add(termAtt.term());
> +
> +    // This fails because ["e","e"] is the value of the token stream
> +    Assert.assertEquals(Arrays.asList("a", "e"), tokens);
> +  }
> +}
>
> Propchange: lucene/solr/trunk/src/test/org/apache/solr/analysis/TestMultiWordSynonyms.java
> ------------------------------------------------------------------------------
>    svn:eol-style = native
>
> Propchange: lucene/solr/trunk/src/test/org/apache/solr/analysis/TestMultiWordSynonyms.java
> ------------------------------------------------------------------------------
>    svn:keywords = Date Author Id Revision HeadURL
>
>
>

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


Mime
View raw message