~slub.team/goobi-indexserver/3.x

« back to all changes in this revision

Viewing changes to lucene/contrib/xml-query-parser/src/java/org/apache/lucene/xmlparser/builders/RangeFilterBuilder.java

  • Committer: Sebastian Meyer
  • Date: 2012-08-03 09:12:40 UTC
  • Revision ID: sebastian.meyer@slub-dresden.de-20120803091240-x6861b0vabq1xror
Remove Lucene and Solr source code and add patches instead
Fix Bug #985487: Auto-suggestion for the search interface

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Created on 25-Jan-2006
3
 
 */
4
 
package org.apache.lucene.xmlparser.builders;
5
 
 
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;
12
 
/**
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
19
 
 *
20
 
 *     http://www.apache.org/licenses/LICENSE-2.0
21
 
 *
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.
27
 
 */
28
 
 
29
 
 
30
 
/**
31
 
 * 
32
 
 */
33
 
public class RangeFilterBuilder implements FilterBuilder {
34
 
 
35
 
 
36
 
        public Filter getFilter(Element e) throws ParserException {
37
 
                
38
 
                String fieldName=DOMUtils.getAttributeWithInheritance(e,"fieldName");
39
 
                
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);
45
 
        }
46
 
 
47
 
}