Example usage for org.apache.lucene.analysis.util AbstractAnalysisFactory LUCENE_MATCH_VERSION_PARAM

List of usage examples for org.apache.lucene.analysis.util AbstractAnalysisFactory LUCENE_MATCH_VERSION_PARAM

Introduction

In this page you can find the example usage for org.apache.lucene.analysis.util AbstractAnalysisFactory LUCENE_MATCH_VERSION_PARAM.

Prototype

String LUCENE_MATCH_VERSION_PARAM

To view the source code for org.apache.lucene.analysis.util AbstractAnalysisFactory LUCENE_MATCH_VERSION_PARAM.

Click Source Link

Usage

From source file:edu.cmu.lti.oaqa.annographix.solr.TokenizerParams.java

License:Apache License

/** Specifying which Lucene version we need */
private void addLuceneVersionParam() {
    mTokClassArgs.put(AbstractAnalysisFactory.LUCENE_MATCH_VERSION_PARAM, UtilConst.LUCENE_VERSION);
}

From source file:edu.cmu.lti.oaqa.bio.index.medline.annotated.query.TokenizerParams.java

License:Apache License

/** Specifying which Lucene version we need */
private void addLuceneVersionParam() {
    mTokClassArgs.put(AbstractAnalysisFactory.LUCENE_MATCH_VERSION_PARAM, UtilConstMedline.LUCENE_VERSION);
}

From source file:jp.co.mixi.rd.lucene.analysis.StandardPlusTokenizerFactoryTest.java

License:Apache License

@Test
public void testStandardPlusTokenizer() throws Exception {
    try (Reader reader = new StringReader("Wha\u0301t's this thing do?")) {
        Map<String, String> args = new HashMap<String, String>();
        args.put(AbstractAnalysisFactory.LUCENE_MATCH_VERSION_PARAM,
                BaseTokenStreamTestCase.TEST_VERSION_CURRENT.toString());
        StandardPlusTokenizerFactory factory = new StandardPlusTokenizerFactory(args);
        try (Tokenizer stream = factory.create(reader)) {
            BaseTokenStreamTestCase.assertTokenStreamContents(stream,
                    new String[] { "Wha\u0301t's", "this", "thing", "do", "?" });
        }/*  ww  w.  j a va  2  s.  c o m*/
    }
}

From source file:jp.co.mixi.rd.lucene.analysis.StandardPlusTokenizerFactoryTest.java

License:Apache License

@Test
public void testStandardPlusTokenizerMaxTokenLength() throws Exception {
    StringBuilder builder = new StringBuilder();
    for (int i = 0; i < 100; ++i) {
        builder.append("abcdefg"); // 7 * 100 = 700 char "word"
    }/*from w  w  w  . j a v a  2s  . c  o m*/
    String longWord = builder.toString();
    String content = "one two three " + longWord + " four five six";
    try (Reader reader = new StringReader(content)) {
        Map<String, String> args = new HashMap<String, String>();
        args.put("maxTokenLength", "1000");
        args.put(AbstractAnalysisFactory.LUCENE_MATCH_VERSION_PARAM,
                BaseTokenStreamTestCase.TEST_VERSION_CURRENT.toString());
        StandardPlusTokenizerFactory factory = new StandardPlusTokenizerFactory(args);
        try (Tokenizer stream = factory.create(reader)) {
            BaseTokenStreamTestCase.assertTokenStreamContents(stream,
                    new String[] { "one", "two", "three", longWord, "four", "five", "six" });
        }
    }
}

From source file:jp.co.mixi.rd.lucene.analysis.StandardPlusTokenizerFactoryTest.java

License:Apache License

@Test
public void testStandardPlusTokenizerNihongo() throws Exception {
    try (Reader reader = new StringReader("???   ? ?")) {
        Map<String, String> args = new HashMap<String, String>();
        args.put(AbstractAnalysisFactory.LUCENE_MATCH_VERSION_PARAM,
                BaseTokenStreamTestCase.TEST_VERSION_CURRENT.toString());
        StandardPlusTokenizerFactory factory = new StandardPlusTokenizerFactory(args);
        try (Tokenizer stream = factory.create(reader)) {
            BaseTokenStreamTestCase.assertTokenStreamContents(stream, new String[] { "", "?", "", "",
                    "", "", "", "", "?", "?", "?", "?" });
        }/* w w  w.  j  a va 2 s . co m*/
    }
}

From source file:jp.co.mixi.rd.lucene.analysis.StandardPlusTokenizerFactoryTest.java

License:Apache License

@Test
public void testStandardPlusTokenizerSpace() throws Exception {
    try (Reader reader = new StringReader("?\n?")) {
        Map<String, String> args = new HashMap<String, String>();
        args.put(AbstractAnalysisFactory.LUCENE_MATCH_VERSION_PARAM,
                BaseTokenStreamTestCase.TEST_VERSION_CURRENT.toString());
        StandardPlusTokenizerFactory factory = new StandardPlusTokenizerFactory(args);
        try (Tokenizer stream = factory.create(reader)) {
            BaseTokenStreamTestCase.assertTokenStreamContents(stream, new String[] { "?", "?" });
        }/*from   w  ww.  j av a 2 s  .  c  o  m*/
    }
}

From source file:jp.sf.fess.solr.plugin.util.MonitoringUtil.java

License:Apache License

public static String initBaseArgs(final Map<String, String> baseArgs, final String luceneVersion) {
    final String baseClass = baseArgs.remove(BASE_CLASS);
    baseArgs.put(CLASS, baseClass);//w w w .ja  va  2 s. c  om
    baseArgs.put(AbstractAnalysisFactory.LUCENE_MATCH_VERSION_PARAM, luceneVersion);
    return baseClass;
}

From source file:org.aksw.palmetto.corpus.lucene.SimpleAnalyzer.java

License:Open Source License

public SimpleAnalyzer(boolean lowerCase) {
    Map<String, String> parameters = new HashMap<String, String>();
    parameters.put(PatternTokenizerFactory.PATTERN, PATTERN);
    parameters.put(PatternTokenizerFactory.GROUP, "0");
    parameters.put(AbstractAnalysisFactory.LUCENE_MATCH_VERSION_PARAM, version.name());
    tokenizerFactory = new PatternTokenizerFactory(parameters);
    if (lowerCase) {
        parameters = new HashMap<String, String>();
        parameters.put(AbstractAnalysisFactory.LUCENE_MATCH_VERSION_PARAM, version.name());
        lowerCaseFilterFactory = new LowerCaseFilterFactory(parameters);
    } else {// w w w  .  j  a v  a 2  s. com
        lowerCaseFilterFactory = null;
    }
}