[jsword-svn] jsword/java/jsword/org/crosswire/jsword/book/search/lucene s

jswordcvs at crosswire.org jswordcvs at crosswire.org
Sun May 8 18:29:09 MST 2005


Update of /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/search/lucene
In directory www.crosswire.org:/tmp/cvs-serv6194/java/jsword/org/crosswire/jsword/book/search/lucene

Modified Files:
	LuceneIndex.java ExtendedLuceneSyntax.java AndQuery.java 
	AndNotQuery.java QueryBuilder.java BlurQuery.java OrQuery.java 
Added Files:
	AbstractBinaryQuery.java 
Removed Files:
	LuceneThesarus.java BinaryQuery.java 
Log Message:
Moved unused code to limbo.
Upgraded support-tools: checkstyle, pmd and findbugs to most recent.
Addressed over 100 issues reported by findbugs and checkstyle.
Resulted in major refactoring of GBFFilter.
Net result is that code size is significantly smaller.

--- NEW FILE: AbstractBinaryQuery.java ---
package org.crosswire.jsword.book.search.lucene;

/**
 * A binary token has a left token and right token.
 * 
 * <p><table border='1' cellPadding='3' cellSpacing='0'>
 * <tr><td bgColor='white' class='TableRowColor'><font size='-7'>
 *
 * Distribution Licence:<br />
 * JSword is free software; you can redistribute it
 * and/or modify it under the terms of the GNU General Public License,
 * version 2 as published by the Free Software Foundation.<br />
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.<br />
 * The License is available on the internet
 * <a href='http://www.gnu.org/copyleft/gpl.html'>here</a>, or by writing to:
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 * MA 02111-1307, USA<br />
 * The copyright to this program is held by it's authors.
 * </font></td></tr></table>
 * @see gnu.gpl.Licence
 * @author DM Smith [ dmsmith555 at yahoo dot com]
 * @version $Id: AbstractBinaryQuery.java,v 1.1 2005/05/09 01:29:07 dmsmith Exp $
 */
public abstract class AbstractBinaryQuery implements Query
{

    /**
     * 
     */
    public AbstractBinaryQuery(Query theLeftToken, Query theRightToken)
    {
        leftToken = theLeftToken;
        rightToken = theRightToken;
    }

    /**
     * @return Returns the leftToken.
     */
    public Query getLeftToken()
    {
        return leftToken;
    }

    /**
     * @return Returns the rightToken.
     */
    public Query getRightToken()
    {
        return rightToken;
    }

    private Query leftToken;
    private Query rightToken;
}

--- LuceneThesarus.java DELETED ---

Index: BlurQuery.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/search/lucene/BlurQuery.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** BlurQuery.java	2 May 2005 01:29:32 -0000	1.2
--- BlurQuery.java	9 May 2005 01:29:07 -0000	1.3
***************
*** 30,34 ****
   * @version $Id$
   */
! public class BlurQuery extends BinaryQuery
  {
  
--- 30,34 ----
   * @version $Id$
   */
! public class BlurQuery extends AbstractBinaryQuery
  {
  

Index: LuceneIndex.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/search/lucene/LuceneIndex.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** LuceneIndex.java	3 May 2005 02:21:19 -0000	1.18
--- LuceneIndex.java	9 May 2005 01:29:07 -0000	1.19
***************
*** 33,36 ****
--- 33,37 ----
  import org.crosswire.jsword.book.search.SearchModifier;
  import org.crosswire.jsword.book.search.basic.AbstractIndex;
+ import org.crosswire.jsword.passage.AbstractPassage;
  import org.crosswire.jsword.passage.BibleInfo;
  import org.crosswire.jsword.passage.Key;
***************
*** 187,190 ****
--- 188,193 ----
                  {
                      PassageTally tally = new PassageTally();
+                     tally.raiseEventSuppresion();
+                     tally.raiseNormalizeProtection();
                      results = tally;
                      for (int i = 0; i < hits.length(); i++)
***************
*** 195,202 ****
--- 198,216 ----
                          tally.add(verse, score);
                      }
+                     tally.lowerNormalizeProtection();
+                     tally.lowerEventSuppresionAndTest();
                  }
                  else
                  {
                      results = book.createEmptyKeyList();
+                     // If we have an abstract passage,
+                     // make sure it does not try to fire change events.
+                     AbstractPassage passage = null;
+                     if (results instanceof AbstractPassage)
+                     {
+                         passage = (AbstractPassage) results;
+                         passage.raiseEventSuppresion();
+                         passage.raiseNormalizeProtection();
+                     }
                      for (int i = 0; i < hits.length(); i++)
                      {
***************
*** 204,208 ****
                          results.addAll(verse);
                      }
! 
                  }
              }
--- 218,226 ----
                          results.addAll(verse);
                      }
!                     if (passage != null)
!                     {
!                         passage.lowerNormalizeProtection();
!                         passage.lowerEventSuppresionAndTest();
!                     }
                  }
              }

Index: OrQuery.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/search/lucene/OrQuery.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** OrQuery.java	2 May 2005 01:29:32 -0000	1.2
--- OrQuery.java	9 May 2005 01:29:07 -0000	1.3
***************
*** 29,33 ****
   * @version $Id$
   */
! public class OrQuery extends BinaryQuery
  {
  
--- 29,33 ----
   * @version $Id$
   */
! public class OrQuery extends AbstractBinaryQuery
  {
  

Index: ExtendedLuceneSyntax.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/search/lucene/ExtendedLuceneSyntax.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ExtendedLuceneSyntax.java	2 May 2005 01:29:32 -0000	1.2
--- ExtendedLuceneSyntax.java	9 May 2005 01:29:07 -0000	1.3
***************
*** 6,10 ****
  /**
   * ExtendedLuceneSyntax represents the extension of stock Lucene syntax
!  * with passage ranges and with blurring (searching in nearby verses)
   * 
   * <p><table border='1' cellPadding='3' cellSpacing='0'>
--- 6,10 ----
  /**
   * ExtendedLuceneSyntax represents the extension of stock Lucene syntax
!  * with passage ranges and with blurring (searching in nearby verses).
   * 
   * <p><table border='1' cellPadding='3' cellSpacing='0'>

--- BinaryQuery.java DELETED ---

Index: AndQuery.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/search/lucene/AndQuery.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** AndQuery.java	2 May 2005 01:29:32 -0000	1.2
--- AndQuery.java	9 May 2005 01:29:07 -0000	1.3
***************
*** 29,33 ****
   * @version $Id$
   */
! public class AndQuery extends BinaryQuery
  {
  
--- 29,33 ----
   * @version $Id$
   */
! public class AndQuery extends AbstractBinaryQuery
  {
  

Index: AndNotQuery.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/search/lucene/AndNotQuery.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** AndNotQuery.java	2 May 2005 01:29:32 -0000	1.2
--- AndNotQuery.java	9 May 2005 01:29:07 -0000	1.3
***************
*** 30,34 ****
   * @version $Id$
   */
! public class AndNotQuery extends BinaryQuery
  {
  
--- 30,34 ----
   * @version $Id$
   */
! public class AndNotQuery extends AbstractBinaryQuery
  {
  

Index: QueryBuilder.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/search/lucene/QueryBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** QueryBuilder.java	2 May 2005 01:29:32 -0000	1.2
--- QueryBuilder.java	9 May 2005 01:29:07 -0000	1.3
***************
*** 122,126 ****
  
      /**
!      * The pattern of a blur. ~, optionally followed by a number, representing the number of verses
       */
      private static final Pattern BLUR_PATTERN = Pattern.compile("\\s~(\\d*)?\\s"); //$NON-NLS-1$
--- 122,126 ----
  
      /**
!      * The pattern of a blur. A '~', optionally followed by a number, representing the number of verses.
       */
      private static final Pattern BLUR_PATTERN = Pattern.compile("\\s~(\\d*)?\\s"); //$NON-NLS-1$



More information about the jsword-svn mailing list