Hi,
I recently submitted bug 31174 regarding the incomplete implementation of org.apache.lucene.search.Occur for remote use.
Attached is a revised class with the fix. It is currently implemented as an inner class of BooleanClause, but I separated it out for clarity. Can someone inform me of the correct protocol and/or facilities for offering further patches?
Thanks, Todd VanderVeen
/** * Copyright 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.lucene.search;
import java.io.ObjectStreamException; import java.io.Serializable; public final class Occur implements Serializable { private int id; private String name; private static final int MUST_ID = 0; private static final int MUST_NOT_ID = 1; private static final int SHOULD_ID = 2; /** Disallow public instantiation */ private Occur(int id, String name) { this.id = id; this.name = name; } public String toString() { return name; } /** * Use this operator for terms that <i>must </i> appear in the matching * documents. */ public static final Occur MUST = new Occur(MUST_ID, "Occur.MUST"); /** * Use this operator for terms of which <i>should </i> appear in the matching * documents. * * <p> * For a BooleanQuery with two <code>SHOULD</code> subqueries, at least one * of the queries must appear in the matching documents. * <p> */ public static final Occur SHOULD = new Occur(SHOULD_ID, "Occur.SHOULD"); /** * Use this operator for terms that <i>must not </i> appear in the matching * documents. * * <p> * Note that it is not possible to search for queries that only consist of a * <code>MUST_NOT</code> query. * </p> */ public static final Occur MUST_NOT = new Occur(MUST_NOT_ID, "Occur.MUST_NOT"); /** * Resolves the deserialized instance to the local reference for accurate * .equals() and == comparisons. * * @return a reference to Occur as resolved in the local VM. * @throws ObjectStreamException */ private Object readResolve() throws ObjectStreamException { int id = ((Occur) this).id; switch (id) { case MUST_ID : return Occur.MUST; case MUST_NOT_ID : return Occur.MUST_NOT; default : return Occur.SHOULD; } } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]