MtasPreAnalyzedField.java.html
5.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>MtasPreAnalyzedField.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">MTAS</a> > <a href="index.source.html" class="el_package">mtas.solr.schema</a> > <span class="el_source">MtasPreAnalyzedField.java</span></div><h1>MtasPreAnalyzedField.java</h1><pre class="source lang-java linenums">package mtas.solr.schema;
import java.io.IOException;
import java.util.Map;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.Analyzer.TokenStreamComponents;
import org.apache.lucene.index.IndexableField;
import org.apache.solr.schema.IndexSchema;
import org.apache.solr.schema.JsonPreAnalyzedParser;
import org.apache.solr.schema.PreAnalyzedField;
import org.apache.solr.schema.SchemaField;
/**
* The Class MtasPreAnalyzedField.
*/
<span class="fc" id="L17">public class MtasPreAnalyzedField extends PreAnalyzedField {</span>
/** The follow index analyzer. */
private final static String FOLLOW_INDEX_ANALYZER = "followIndexAnalyzer";
/** The default configuration. */
private final static String DEFAULT_CONFIGURATION = "defaultConfiguration";
/** The configuration from field. */
private final static String CONFIGURATION_FROM_FIELD = "configurationFromField";
/** The set number of tokens. */
private final static String SET_NUMBER_OF_TOKENS = "setNumberOfTokens";
/** The set number of positions. */
private final static String SET_NUMBER_OF_POSITIONS = "setNumberOfPositions";
/** The set size. */
private final static String SET_SIZE = "setSize";
/** The set error. */
private final static String SET_ERROR = "setError";
/** The set prefix. */
private final static String SET_PREFIX = "setPrefix";
/** The follow index analyzer. */
<span class="fc" id="L44"> public String followIndexAnalyzer = null;</span>
/** The default configuration. */
<span class="fc" id="L47"> public String defaultConfiguration = null;</span>
/** The configuration from field. */
<span class="fc" id="L50"> public String configurationFromField = null;</span>
/** The set number of tokens. */
<span class="fc" id="L53"> public String setNumberOfTokens = null;</span>
/** The set number of positions. */
<span class="fc" id="L56"> public String setNumberOfPositions = null;</span>
/** The set size. */
<span class="fc" id="L59"> public String setSize = null;</span>
/** The set error. */
<span class="fc" id="L62"> public String setError = null;</span>
/** The set prefix. */
<span class="fc" id="L65"> public String setPrefix = null;</span>
/*
* (non-Javadoc)
*
* @see org.apache.solr.schema.PreAnalyzedField#init(org.apache.solr.schema.
* IndexSchema, java.util.Map)
*/
@Override
public void init(IndexSchema schema, Map<String, String> args) {
<span class="fc" id="L75"> args.put(PARSER_IMPL, MtasPreAnalyzedParser.class.getName());</span>
<span class="fc" id="L76"> super.init(schema, args);</span>
<span class="fc" id="L77"> }</span>
/*
* (non-Javadoc)
*
* @see org.apache.solr.schema.FieldType#setArgs(org.apache.solr.schema.
* IndexSchema, java.util.Map)
*/
@Override
protected void setArgs(IndexSchema schema, Map<String, String> args) {
<span class="fc" id="L87"> followIndexAnalyzer = args.get(FOLLOW_INDEX_ANALYZER);</span>
<span class="fc" id="L88"> defaultConfiguration = args.get(DEFAULT_CONFIGURATION);</span>
<span class="fc" id="L89"> configurationFromField = args.get(CONFIGURATION_FROM_FIELD);</span>
<span class="fc" id="L90"> setNumberOfTokens = args.get(SET_NUMBER_OF_TOKENS);</span>
<span class="fc" id="L91"> setNumberOfPositions = args.get(SET_NUMBER_OF_POSITIONS);</span>
<span class="fc" id="L92"> setSize = args.get(SET_SIZE);</span>
<span class="fc" id="L93"> setError = args.get(SET_ERROR);</span>
<span class="fc" id="L94"> setPrefix = args.get(SET_PREFIX);</span>
<span class="pc bpc" id="L95" title="1 of 2 branches missed."> if (followIndexAnalyzer == null) {</span>
<span class="nc" id="L96"> throw new RuntimeException("No " + FOLLOW_INDEX_ANALYZER</span>
<span class="nc" id="L97"> + " for fieldType " + this.getTypeName());</span>
}
<span class="fc" id="L99"> args.remove(FOLLOW_INDEX_ANALYZER);</span>
<span class="fc" id="L100"> args.remove(DEFAULT_CONFIGURATION);</span>
<span class="fc" id="L101"> args.remove(CONFIGURATION_FROM_FIELD);</span>
<span class="fc" id="L102"> args.remove(SET_NUMBER_OF_TOKENS);</span>
<span class="fc" id="L103"> args.remove(SET_NUMBER_OF_POSITIONS);</span>
<span class="fc" id="L104"> args.remove(SET_SIZE);</span>
<span class="fc" id="L105"> args.remove(SET_ERROR);</span>
<span class="fc" id="L106"> args.remove(SET_PREFIX);</span>
<span class="fc" id="L107"> super.setArgs(schema, args);</span>
<span class="fc" id="L108"> }</span>
}
</pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.7.9.201702052155</span></div></body></html>