[jsword-svn] bibledesktop/java/main/org/crosswire/bibledesktop/book s

jswordcvs at crosswire.org jswordcvs at crosswire.org
Sun Apr 24 18:22:37 MST 2005


Update of /cvs/jsword/bibledesktop/java/main/org/crosswire/bibledesktop/book
In directory www.crosswire.org:/tmp/cvs-serv23090/java/main/org/crosswire/bibledesktop/book

Modified Files:
	Msg.properties AdvancedSearchPane.java 
	AdvancedSearchPane.properties 
Log Message:
Re-implemented the search language to use lucene syntax with range and blur as extensions.

Index: Msg.properties
===================================================================
RCS file: /cvs/jsword/bibledesktop/java/main/org/crosswire/bibledesktop/book/Msg.properties,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** Msg.properties	11 Apr 2005 11:26:29 -0000	1.14
--- Msg.properties	25 Apr 2005 01:22:35 -0000	1.15
***************
*** 27,34 ****
  DisplaySelectPane.HelpTitle=Search Quick Help
  DisplaySelectPane.HelpText=<html><b>Search Tips.</b><br\>\
! 	You can use / to join phrases, for example "<code>balaam / balak</code>" finds passages containing Balak OR Balaam<br\>\
! 	Using + requires both words, e.g. "<code>aaron + moses</code>" finds passages containing both Aaron AND Moses<br\>\
! 	Using a - removes words from the result e.g. "<code>lord - jesus</code>" is passages containing Lord BUT NOT Jesus<br\>\
! 	Using ~2 widens the passage by 2 verses either side on any match. So "<code>perez ~1 + amminadab</code>" finds<br\>\
  	verses containting Amminadab within 1 verse of mention of Perez.
  DisplaySelectPane.Bible=Bible:
--- 27,34 ----
  DisplaySelectPane.HelpTitle=Search Quick Help
  DisplaySelectPane.HelpText=<html><b>Search Tips.</b><br\>\
! 	You can use || to join phrases, for example "<code>balaam || balak</code>" finds passages containing Balak OR Balaam<br\>\
! 	Using && requires both words, e.g. "<code>aaron && moses</code>" finds passages containing both Aaron AND Moses<br\>\
! 	Using a ! removes words from the result e.g. "<code>lord ! jesus</code>" is passages containing Lord BUT NOT Jesus<br\>\
! 	Using ~2 widens the passage by 2 verses either side on any match. So "<code>amminadab ~1 perez</code>" finds<br\>\
  	verses containting Amminadab within 1 verse of mention of Perez.
  DisplaySelectPane.Bible=Bible:

Index: AdvancedSearchPane.properties
===================================================================
RCS file: /cvs/jsword/bibledesktop/java/main/org/crosswire/bibledesktop/book/AdvancedSearchPane.properties,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** AdvancedSearchPane.properties	11 Apr 2005 11:26:29 -0000	1.2
--- AdvancedSearchPane.properties	25 Apr 2005 01:22:35 -0000	1.3
***************
*** 5,8 ****
--- 5,10 ----
  Includes.Name=Includes these words:
  Excludes.Name=Excludes all these words:
+ Spell.Name=Something like this spelling:
+ StartsWith.Name=Includes words starting with:
  
  HeadRank.Name:Prioritize the found verses

Index: AdvancedSearchPane.java
===================================================================
RCS file: /cvs/jsword/bibledesktop/java/main/org/crosswire/bibledesktop/book/AdvancedSearchPane.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** AdvancedSearchPane.java	11 Apr 2005 11:26:29 -0000	1.6
--- AdvancedSearchPane.java	25 Apr 2005 01:22:35 -0000	1.7
***************
*** 37,47 ****
  import org.crosswire.common.swing.ActionFactory;
  import org.crosswire.common.swing.GuiUtil;
! import org.crosswire.common.util.StringUtil;
! import org.crosswire.jsword.book.search.parse.IndexSearcher;
! import org.crosswire.jsword.book.search.parse.PassageLeftParamWord;
! import org.crosswire.jsword.book.search.parse.PassageRightParamWord;
! import org.crosswire.jsword.book.search.parse.PhraseParamWord;
! import org.crosswire.jsword.book.search.parse.RemoveCommandWord;
! import org.crosswire.jsword.book.search.parse.RetainCommandWord;
  
  /**
--- 37,41 ----
  import org.crosswire.common.swing.ActionFactory;
  import org.crosswire.common.swing.GuiUtil;
! import org.crosswire.jsword.book.search.SearchType;
  
  /**
***************
*** 115,118 ****
--- 109,122 ----
          lblExcludes.setLabelFor(txtExcludes);
  
+         txtSpell = new JTextField();
+         txtSpell.getDocument().addDocumentListener(this);
+         lblSpell = actions.createJLabel(SPELL);
+         lblSpell.setLabelFor(txtSpell);
+ 
+         txtStartsWith = new JTextField();
+         txtStartsWith.getDocument().addDocumentListener(this);
+         lblStartsWith = actions.createJLabel(STARTS_WITH);
+         lblStartsWith.setLabelFor(txtStartsWith);
+ 
          chkRank = new JCheckBox(actions.getAction(HEAD_RANK));
          chkRank.setBackground(headBG);
***************
*** 235,238 ****
--- 239,246 ----
          this.add(lblExcludes, new GridBagConstraints(0, ++gridy, 1, 1, 0.0, 0.0, GridBagConstraints.EAST,   GridBagConstraints.NONE,       new Insets(0, 0, 0, 0), 0, 0));
          this.add(txtExcludes, new GridBagConstraints(1,   gridy, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(2, 5, 2, 5), 0, 0));
+         this.add(lblSpell,    new GridBagConstraints(0, ++gridy, 1, 1, 0.0, 0.0, GridBagConstraints.EAST,   GridBagConstraints.NONE,       new Insets(0, 0, 0, 0), 0, 0));
+         this.add(txtSpell,    new GridBagConstraints(1,   gridy, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(2, 5, 2, 5), 0, 0));
+         this.add(lblStartsWith, new GridBagConstraints(0, ++gridy, 1, 1, 0.0, 0.0, GridBagConstraints.EAST,   GridBagConstraints.NONE,       new Insets(0, 0, 0, 0), 0, 0));
+         this.add(txtStartsWith, new GridBagConstraints(1,   gridy, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(2, 5, 2, 5), 0, 0));
          this.add(chkRank,     new GridBagConstraints(0, ++gridy, 3, 1, 0.0, 0.0, GridBagConstraints.WEST,   GridBagConstraints.HORIZONTAL, new Insets(2, 2, 2, 2), 0, 0));
          this.add(lblRank,     new GridBagConstraints(0, ++gridy, 1, 1, 0.0, 0.0, GridBagConstraints.EAST,   GridBagConstraints.NONE,       new Insets(0, 0, 0, 0), 0, 0));
***************
*** 475,484 ****
      private void updateSearchString()
      {
-         String quote = IndexSearcher.getPreferredSyntax(PhraseParamWord.class);
-         String plus = IndexSearcher.getPreferredSyntax(RetainCommandWord.class);
-         String minus = IndexSearcher.getPreferredSyntax(RemoveCommandWord.class);
-         String open = IndexSearcher.getPreferredSyntax(PassageLeftParamWord.class);
-         String close = IndexSearcher.getPreferredSyntax(PassageRightParamWord.class);
- 
          StringBuffer search = new StringBuffer();
  
--- 483,486 ----
***************
*** 491,498 ****
              }
  
!             search.append(plus);
!             search.append(open);
!             search.append(restrict);
!             search.append(close);
          }
  
--- 493,497 ----
              }
  
!             search.append(SearchType.RANGE.decorate(restrict));
          }
  
***************
*** 500,507 ****
          if (phrase != null && phrase.trim().length() > 0)
          {
  
!             search.append(quote);
!             search.append(phrase);
!             search.append(quote);
          }
  
--- 499,508 ----
          if (phrase != null && phrase.trim().length() > 0)
          {
+             if (search.length() != 0)
+             {
+                 search.append(SPACE);
+             }
  
!             search.append(SearchType.PHRASE.decorate(phrase));
          }
  
***************
*** 514,521 ****
              }
  
!             String[] words = includes.split(SPACE);
! 
!             search.append(plus);
!             search.append(StringUtil.join(words, SPACE + plus));
          }
  
--- 515,519 ----
              }
  
!             search.append(SearchType.ALL_WORDS.decorate(includes));
          }
  
***************
*** 528,535 ****
              }
  
!             String[] words = excludes.split(SPACE);
  
!             search.append(minus);
!             search.append(StringUtil.join(words, SPACE + minus));
          }
  
--- 526,552 ----
              }
  
!             search.append(SearchType.NOT_WORDS.decorate(excludes));
!         }
  
!         String spell = txtSpell.getText();
!         if (spell != null && spell.trim().length() > 0)
!         {
!             if (search.length() != 0)
!             {
!                 search.append(SPACE);
!             }
! 
!             search.append(SearchType.SPELL_WORDS.decorate(spell));
!         }
! 
!         String startsWith = txtStartsWith.getText();
!         if (startsWith != null && startsWith.trim().length() > 0)
!         {
!             if (search.length() != 0)
!             {
!                 search.append(SPACE);
!             }
! 
!             search.append(SearchType.START_WORDS.decorate(startsWith));
          }
  
***************
*** 608,611 ****
--- 625,630 ----
      private static final String INCLUDES = "Includes"; //$NON-NLS-1$
      private static final String EXCLUDES = "Excludes"; //$NON-NLS-1$
+     private static final String SPELL = "Spell"; //$NON-NLS-1$
+     private static final String STARTS_WITH = "StartsWith"; //$NON-NLS-1$
      private static final String PRESETS = "Presets"; //$NON-NLS-1$
      private static final String RESTRICT_SELECT = "RestrictSelect"; //$NON-NLS-1$
***************
*** 661,664 ****
--- 680,687 ----
      private JLabel lblExcludes;
      private JTextField txtExcludes;
+     private JLabel lblSpell;
+     private JTextField txtSpell;
+     private JLabel lblStartsWith;
+     private JTextField txtStartsWith;
      private JLabel lblHeading;
      private JCheckBox chkRank;



More information about the jsword-svn mailing list