Database Reference
In-Depth Information
java.lang.reflect.Field
Used to reference a static field from another class. For example, if there were
a static field named
STOPWORDS
in the class
org.something.text.Common
:
<param
name=
"stopwords"
type=
"java.lang.reflect.Field"
value=
"org.something.text.CommonStopWords"
/>
When no type is specified, the default is assumed to be
java.lang.String
.
•
value
contains the value of the parameter, using either the
<param name="a"
value="b"/>
or the
<value>a</value>
form (when
type
is a
java.util.Set
).
If the parameters need more than one value, use embedded
value
elements instead of
the
value
attribute (not both).
A simple example of changing the analyzer would be to tell Lucene that the text we're
going to index is in Dutch:
<lucene>
<analyzer
class=
"org.apache.lucene.analysis.nl.DutchAnalyzer"
/>
<text
qname=
"p"
/>
</lucene>
For a more advanced example of defining analyzers and passing parameters, we use
the ability of the standard analyzer to define a set of stopwords (as mentioned, these
are words to be ignored, like
the
,
a
,
an
, etc.). The following example changes the
default analyzer and passes it a set of stopwords in a text file:
<lucene>
<analyzer
class=
"org.apache.lucene.analysis.standard.StandardAnalyzer"
>
<param
name=
"stopwords"
type=
"java.io.File"
value=
"/usr/local/exist/webapp/WEB-INF/data/stopwords.txt"
/>
</analyzer>
<text
qname=
"p"
/>
</lucene>
Now assume you need some other element indexed also, but with a much more limi‐
ted set of stopwords. This could be accomplished by:
<lucene>
<analyzer
class=
"org.apache.lucene.analysis.standard.StandardAnalyzer"
>
<param
name=
"stopwords"
type=
"java.io.File"
value=
"/usr/local/exist/webapp/WEB-INF/data/stopwords.txt"
/>
</analyzer>
<analyzer
id=
"a2"
class=
"org.apache.lucene.analysis.standard.StandardAnalyzer"
>
<param
name=
"stopwords"
Search WWH ::
Custom Search