001: /*
002: Licensed to the Apache Software Foundation (ASF) under one or more
003: contributor license agreements. See the NOTICE file distributed with
004: this work for additional information regarding copyright ownership.
005: The ASF licenses this file to You under the Apache License, Version 2.0
006: (the "License"); you may not use this file except in compliance with
007: the License. You may obtain a copy of the License at
008:
009: http://www.apache.org/licenses/LICENSE-2.0
010:
011: Unless required by applicable law or agreed to in writing, software
012: distributed under the License is distributed on an "AS IS" BASIS,
013: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: See the License for the specific language governing permissions and
015: limitations under the License.
016: */
017:
018: package org.apache.cocoon.bean.query;
019:
020: import org.apache.lucene.analysis.Analyzer;
021: import org.apache.lucene.search.Query;
022:
023: /**
024: * The interface of a criterion bean.
025: * <p>
026: * This component defines an interface for searching.
027: * The idea is to abstract the process of searching into a Bean to be manipulated by CForms.
028: * </p>
029: *
030: * @version CVS $Id: SimpleLuceneCriterion.java 433543 2006-08-22 06:22:54Z crossley $
031: */
032: public interface SimpleLuceneCriterion {
033:
034: /**
035: * The ANY_FIELD name of this bean.
036: * <p>
037: * The value representing a query on any field in the index.
038: * ie. <code>any</code>
039: * </p>
040: */
041: public static final String ANY_FIELD = "any";
042:
043: /**
044: * The ANY_MATCH name of this bean.
045: * <p>
046: * The value representing a match on any of the terms in this criterion.
047: * ie. <code>any</code>
048: * </p>
049: */
050: public static final String ANY_MATCH = "any";
051:
052: /**
053: * The ALL_MATCH name of this bean.
054: * <p>
055: * The value representing a match on all of the terms in this criterion.
056: * ie. <code>all</code>
057: * </p>
058: */
059: public static final String ALL_MATCH = "all";
060:
061: /**
062: * The LIKE_MATCH name of this bean.
063: * <p>
064: * The value representing a fuzzy match on any of the terms in this criterion.
065: * ie. <code>like</code>
066: * </p>
067: */
068: public static final String LIKE_MATCH = "like";
069:
070: /**
071: * The NOT_MATCH name of this bean.
072: * <p>
073: * The value representing a prohibition on any of the terms in this criterion.
074: * ie. <code>like</code>
075: * </p>
076: */
077: public static final String NOT_MATCH = "not";
078:
079: /**
080: * The PHRASE_MATCH name of this bean.
081: * <p>
082: * The value representing a phrase match using all of the terms in this criterion.
083: * ie. <code>like</code>
084: * </p>
085: */
086: public static final String PHRASE_MATCH = "phrase";
087:
088: /**
089: * Gets the <code>org.apache.lucene.search.Query</code> from the Criterion
090: * <p>
091: * The analyzer specifies which <code>org.apache.lucene.analysis.Analyzer</code> to use for this search
092: * </p>
093: *
094: * @param analyzer The <code>org.apache.lucene.analysis.Analyzer</code> to use to extract the Terms from this Criterion
095: */
096: public Query getQuery(Analyzer analyzer);
097:
098: /**
099: * Gets the prohibited status from the Criterion
100: */
101: public boolean isProhibited();
102:
103: }
|