01: /*
02: * $Header$
03: * $Revision: 7957 $
04: * $Date: 2007-08-23 04:22:35 -0700 $
05: *
06: * ====================================================================
07: *
08: * Copyright 1999-2004 The Apache Software Foundation
09: *
10: * Licensed under the Apache License, Version 2.0 (the "License");
11: * you may not use this file except in compliance with the License.
12: * You may obtain a copy of the License at
13: *
14: * http://www.apache.org/licenses/LICENSE-2.0
15: *
16: * Unless required by applicable law or agreed to in writing, software
17: * distributed under the License is distributed on an "AS IS" BASIS,
18: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19: * See the License for the specific language governing permissions and
20: * limitations under the License.
21: *
22: */
23: package org.apache.slide.index.lucene.expressions;
24:
25: import org.apache.lucene.index.Term;
26: import org.apache.lucene.search.TermQuery;
27:
28: import org.apache.slide.content.NodeProperty;
29: import org.apache.slide.index.lucene.Index;
30: import org.apache.slide.index.lucene.IndexConfiguration;
31:
32: /**
33: * Implements the <code>is-version-history</code> and the <code>not-is-version-history</code>
34: * expression.
35: */
36: public class IsVersionHistoryExpression extends
37: AbstractLuceneExpression {
38: public IsVersionHistoryExpression(Index index, boolean negated) {
39: super (index);
40:
41: setQuery(new TermQuery(new Term(IndexConfiguration
42: .generateFieldName(NodeProperty.DEFAULT_NAMESPACE,
43: "version-history"), "principal")));
44:
45: if (negated) {
46: setQuery(negateQuery(getQuery()));
47: }
48: }
49: }
|