pylucene 3.5.0-3
[pylucene.git] / lucene-java-3.5.0 / lucene / contrib / queryparser / src / java / org / apache / lucene / queryParser / core / config / package.html
1 <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
2 <!--
3  Licensed to the Apache Software Foundation (ASF) under one or more
4  contributor license agreements.  See the NOTICE file distributed with
5  this work for additional information regarding copyright ownership.
6  The ASF licenses this file to You under the Apache License, Version 2.0
7  (the "License"); you may not use this file except in compliance with
8  the License.  You may obtain a copy of the License at
9
10      http://www.apache.org/licenses/LICENSE-2.0
11
12  Unless required by applicable law or agreed to in writing, software
13  distributed under the License is distributed on an "AS IS" BASIS,
14  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  See the License for the specific language governing permissions and
16  limitations under the License.
17 -->
18 <html>
19 <head>
20    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
21 </head>
22 <body>
23
24 Contains the base classes used to configure the query processing
25
26 <h2>Query Configuration Interfaces</h2>
27 <p>
28 The package <tt>org.apache.lucene.queryParser.core.config</tt> contains query configuration handler
29 abstract class that all config handlers should extend.
30 </p>
31 <p>
32 See {@link org.apache.lucene.queryParser.standard.config.StandardQueryConfigHandler} for a reference
33 implementation.
34 </p>
35 <p>
36 The {@link org.apache.lucene.queryParser.core.config.QueryConfigHandler} and {@link org.apache.lucene.queryParser.core.config.FieldConfig} are used in the processors to access config
37 information in a flexible and independent way.
38 See {@link org.apache.lucene.queryParser.standard.processors.ParametricRangeQueryNodeProcessor} for a 
39 reference implementation.
40 </p>
41 <p>
42 Since version 3.4, the configuration API has changed. It no longer uses {@link org.apache.lucene.util.Attribute} objects to configure
43 a query parser. Instead, it uses {@link org.apache.lucene.queryParser.core.config.ConfigurationKey} objects to set any configuration
44 to a {@link org.apache.lucene.queryParser.core.config.QueryConfigHandler}. For now, both configuration APIs are working, however, 
45 they cannot be used at the same time. So if you start moving your code to the new API, move it completely or keep using the old API.
46 </p>
47 <p>
48 Here is an example about how the new configuration API works:
49  <blockquote> 
50  <pre>
51
52 ...
53 // this constant will be the key to get and set your configuration. This should be unique in your application.
54 final public static {@link org.apache.lucene.queryParser.core.config.ConfigurationKey}<{@link java.text.NumberFormat}> MY_CONFIG = {@link org.apache.lucene.queryParser.core.config.ConfigurationKey}.newInstance();
55 ...
56 // make sure to use your unique key instance to set and get your configuration
57 queryConfigHandler.set(MY_CONFIG, {@link java.text.NumberFormat}.getInstance());
58 {@link java.text.NumberFormat} numberFormat = queryConfigHandler.get(MY_CONFIG);
59 ...
60  </blockquote> 
61  </pre>
62 </p>
63 </body>
64 </html
65