Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.crosswire.jsword.book.search.parse
Class IndexSearcher

    java.lang.Object
      org.crosswire.jsword.book.search.parse.IndexSearcher

All Implemented Interfaces:
  Searcher

    public class IndexSearcher

extends Object
implements Searcher

The central interface to all searching. Functionality the I invisage includes:

- A simple search syntax that goes something like this.
  - aaron, moses (verses containing aaron and moses. Can also use & or +)
  - aaron/moses (verses containing aaron or moses. Can also use |)
  - aaron - moses (verses containing aaron but not moses)
  - aaron ~5 , moses (verses with aaron within 5 verses of moses)
  - soundslike aaron (verses with words that sound like aaron. Can also use sl ...)
  - thesaurus happy (verses with words that mean happy. Can also use th ...)
  - grammar have (words like has have had and so on. Can also use gr ...)
- The ability to add soundslike type extensions.

Distribution Licence: 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. 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. The License is available on the internet here, or by writing to: Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA The copyright to this program is held by it's authors.

Version:
  $Id: IndexSearcher.java,v 1.6 2005/03/25 04:02:52 dmsmith Exp $
Author:
  Joe Walker [joe at eireneh dot com]
See Also:
  `Licence`

Field Summary
`private Map` | `commands` The commands that we know about
`private Index` | `index` The index
`private static Logger` | `log` The log stream
`private static String` | `PACKAGE_NAME` To distinguish command mappings from preferred mappings in Word.properties
`private static Map` | `preferredMap` The cache of preferred symbols for the words
`private Iterator` | `wit` While the answer is being worked out ...
`private static Map` | `wordMap` The cache of known words

Constructor Summary
`IndexSearcher()`

Method Summary
`protected Index` | `getIndex()` Accessor for the Bible to search.
`protected Key` | `getPassage(String[] words)` A basic version of getPassage(String[]) simply calls getPassage(String) in a loop for each word, adding the Verses to an Passage that is returned
`static String` | `getPreferredSyntax(Class command)` Accessor for the cached list of known special lookup words
`protected Map` | `getSearchMap()` Accessor for the available SearchWords.
`static Map` | `getWordMap()` Accessor for the cached list of known special lookup words
`void` | `init(Index newindex)` Setup the index that this parser can use to do word level searches
`Key` | `iteratePassage()`
`String` | `iterateWord()`
`protected Iterator` | `iterator()` Most Words need to access parameters, this method allows them access to the Searcher's own Enumerator.
`protected Key` | `search(List matches)` Take a search string and decipher it into a Passage.
`Key` | `search(String search)` Take a search string and decipher it into a Passage.
`protected void` | `setSearchMap(Map commands)` Accessor for the available SearchWords.
`protected Key` | `wordSearch(String sought)` Take a search string and decipher it into a Passage.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### PACKAGE_NAME

    private static final String PACKAGE_NAME

  To distinguish command mappings from preferred mappings in Word.properties

  See Also:
    Constant Field Values

### log

    private static final Logger log

  The log stream

### wordMap

    private static Map wordMap

  The cache of known words

### preferredMap

    private static Map preferredMap

  The cache of preferred symbols for the words

### commands

    private Map commands

  The commands that we know about

### wit

    private Iterator wit

  While the answer is being worked out ...

### index

    private Index index

  The index

Constructor Detail

### IndexSearcher

    public IndexSearcher()

Method Detail

### init

    public void init(Index newindex)

  Description copied from interface: `Searcher`
  Setup the index that this parser can use to do word level searches

  Specified by:
    `init` in interface `Searcher`
  Parameters:
    `newindex` - The Index to query for words

### search

    public Key search(String search)
               throws BookException

  Description copied from interface: `Searcher`
  Take a search string and decipher it into a Passage.

  Specified by:
    `search` in interface `Searcher`
  Parameters:
    `search` - The string to be searched for
  Returns:
    The matching verses
  Throws:
    `BookException`

### wordSearch

    protected Key wordSearch(String sought)
                      throws BookException

  Take a search string and decipher it into a Passage.

  Parameters:
    `sought` - The string to be searched for
  Returns:
    The matching verses
  Throws:
    `BookException`

### search

    protected Key search(List matches)
                  throws BookException

  Take a search string and decipher it into a Passage.

  Returns:
    The matching verses
  Throws:
    `BookException`

### getPassage

    protected Key getPassage(String[] words)
                      throws BookException

  A basic version of getPassage(String[]) simply calls getPassage(String) in a loop for each word, adding the Verses to an Passage that is returned

  Parameters:
    `words` - The words to search for
  Returns:
    The Passage
  Throws:
    `BookException` - If anything goes wrong with this method

### getIndex

    protected Index getIndex()

  Accessor for the Bible to search.

  Returns:
    The current Bible

### getSearchMap

    protected Map getSearchMap()

  Accessor for the available SearchWords. This is probably the same as from Options.getSearchHashtable() but just in case anyone has been playing around with it...

  Returns:
    The Word Hashtable

### setSearchMap

    protected void setSearchMap(Map commands)

  Accessor for the available SearchWords. This is probably the same as from Options.getSearchHashtable() but just in case anyone has been playing around with it...

### iterator

    protected Iterator iterator()

  Most Words need to access parameters, this method allows them access to the Searcher's own Enumerator. Use with care, and only if you are a Word taking part in the current search.

  Returns:
    The current Iterator

### iteratePassage

    public Key iteratePassage()
                       throws BookException

  Throws:
    `BookException`

### iterateWord

    public String iterateWord()
                       throws BookException

  Throws:
    `BookException`

### getWordMap

    public static Map getWordMap()

  Accessor for the cached list of known special lookup words

### getPreferredSyntax

    public static String getPreferredSyntax(Class command)

  Accessor for the cached list of known special lookup words

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Copyright ? 2003-2004
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD