Author: unico Date: Tue Aug 9 04:38:28 2005 New Revision: 231021 URL: http://svn.apache.org/viewcvs?rev=231021&view=rev Log: fix bug 36046, improve performance in case of empty <where/>, thanks to Max Pfingsthorn (m.pfingsthorn at hippo dot nl)
Added: jakarta/slide/trunk/src/stores/org/apache/slide/index/lucene/expressions/EmptyExpression.java Modified: jakarta/slide/trunk/src/stores/org/apache/slide/index/lucene/LuceneExpressionFactory.java Modified: jakarta/slide/trunk/src/stores/org/apache/slide/index/lucene/LuceneExpressionFactory.java URL: http://svn.apache.org/viewcvs/jakarta/slide/trunk/src/stores/org/apache/slide/index/lucene/LuceneExpressionFactory.java?rev=231021&r1=231020&r2=231021&view=diff ============================================================================== --- jakarta/slide/trunk/src/stores/org/apache/slide/index/lucene/LuceneExpressionFactory.java (original) +++ jakarta/slide/trunk/src/stores/org/apache/slide/index/lucene/LuceneExpressionFactory.java Tue Aug 9 04:38:28 2005 @@ -33,6 +33,7 @@ import org.apache.slide.index.lucene.expressions.ContainsExpression; import org.apache.slide.index.lucene.expressions.EqExpression; import org.apache.slide.index.lucene.expressions.GtExpression; +import org.apache.slide.index.lucene.expressions.EmptyExpression; import org.apache.slide.index.lucene.expressions.IsCollectionExpression; import org.apache.slide.index.lucene.expressions.IsDefinedExpression; import org.apache.slide.index.lucene.expressions.IsPrincipalExpression; @@ -64,6 +65,11 @@ public LuceneExpressionFactory(Index index) { this.index = index; } + + public Index getIndex() + { + return this.index; + } public IBasicExpression createMergeExpression (String mergeOperator, String namespace, @@ -138,7 +144,7 @@ IBasicExpression result = null; if (element == null) { - return super.createExpression(element); + result = new EmptyExpression(this.index); } else { String namespace = element.getNamespace().getURI(); if (namespace.equals (NodeProperty.NamespaceCache.DEFAULT_URI)) { @@ -284,12 +290,12 @@ } } if (operator.equals(Literals.PROPCONTAINS)) { - if (configuration.isStringProperty(namespace, name)) { + if (configuration.isStringProperty(namespace, name) || configuration.isTextProperty(namespace, name)) { return new PropcontainsExpression(this.index, e, false); } } if (operator.equals(Literals.NOT_PROPCONTAINS)) { - if (configuration.isStringProperty(namespace, name)) { + if (configuration.isStringProperty(namespace, name) || configuration.isTextProperty(namespace, name)) { return new PropcontainsExpression(this.index, e, true); } } Added: jakarta/slide/trunk/src/stores/org/apache/slide/index/lucene/expressions/EmptyExpression.java URL: http://svn.apache.org/viewcvs/jakarta/slide/trunk/src/stores/org/apache/slide/index/lucene/expressions/EmptyExpression.java?rev=231021&view=auto ============================================================================== --- jakarta/slide/trunk/src/stores/org/apache/slide/index/lucene/expressions/EmptyExpression.java (added) +++ jakarta/slide/trunk/src/stores/org/apache/slide/index/lucene/expressions/EmptyExpression.java Tue Aug 9 04:38:28 2005 @@ -0,0 +1,32 @@ +/* + * Copyright 1999-2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package org.apache.slide.index.lucene.expressions; + +import org.apache.slide.index.lucene.Index; + + +/** + * Implements an empty expression + */ +public class EmptyExpression extends AbstractLuceneExpression { + + public EmptyExpression(Index index) { + super(index); + setQuery(null); + } + +} --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]