2
* Created on 25-Jan-2006
4
package org.apache.lucene.xmlparser.builders;
6
import org.apache.lucene.search.Filter;
7
import org.apache.lucene.search.TermRangeFilter;
8
import org.apache.lucene.xmlparser.DOMUtils;
9
import org.apache.lucene.xmlparser.FilterBuilder;
10
import org.apache.lucene.xmlparser.ParserException;
11
import org.w3c.dom.Element;
13
* Licensed to the Apache Software Foundation (ASF) under one or more
14
* contributor license agreements. See the NOTICE file distributed with
15
* this work for additional information regarding copyright ownership.
16
* The ASF licenses this file to You under the Apache License, Version 2.0
17
* (the "License"); you may not use this file except in compliance with
18
* the License. You may obtain a copy of the License at
20
* http://www.apache.org/licenses/LICENSE-2.0
22
* Unless required by applicable law or agreed to in writing, software
23
* distributed under the License is distributed on an "AS IS" BASIS,
24
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25
* See the License for the specific language governing permissions and
26
* limitations under the License.
33
public class RangeFilterBuilder implements FilterBuilder {
36
public Filter getFilter(Element e) throws ParserException {
38
String fieldName=DOMUtils.getAttributeWithInheritance(e,"fieldName");
40
String lowerTerm=e.getAttribute("lowerTerm");
41
String upperTerm=e.getAttribute("upperTerm");
42
boolean includeLower=DOMUtils.getAttribute(e,"includeLower",true);
43
boolean includeUpper=DOMUtils.getAttribute(e,"includeUpper",true);
44
return new TermRangeFilter(fieldName,lowerTerm,upperTerm,includeLower,includeUpper);