swishej
Class IndexFile

java.lang.Object
  |
  +--swishej.IndexFile

class IndexFile
extends java.lang.Object

Representation of SWISH-E index file


Field Summary
(package private)  FileHash fh
          Table to remember file information.
(package private)  java.util.Hashtable fn
          Table of file names.
(package private)  java.lang.String header
          Index file header.
(package private) static java.lang.String ifheader
          SWISH-E file header.
(package private) static java.lang.String indexchars
          File offset mapping.
(package private)  int maxfilenum
          Highest short file number of index.
(package private)  MetaHash mh
          Table of meta words.
(package private)  int[] offsets
          Table of file offsets.
(package private)  Reader rd
          Reference for reading index from file or URL.
(package private)  StopHash sh
          Table of stop words.
(package private)  boolean stemming
          Indicator for word stemming.
(package private) static java.lang.String stheader
          Line marking word stemming info.
(package private)  boolean valid
          Indicator for index' validity.
 
Constructor Summary
(package private) IndexFile(Reader rd)
          Creates and reads index file representation.
 
Method Summary
(package private)  int decodefilenum(int num)
          Decode short file number from given result number.
(package private)  java.lang.String[] dumpWords(java.lang.String initial)
          Dump keywords given initial into String array.
(package private)  boolean findWord(java.lang.String word)
          Lookup word and position index pointer accordingly.
(package private)  ResultList getfileinfo(java.lang.String word, int meta)
          Lookup word and make ResultList of it
(package private)  void getIndexFilenum()
          Determine number of files in index
(package private)  java.lang.String getmatchword(java.lang.String prefix, boolean first)
          Match words against given prefix
(package private)  java.lang.String lookupfile(int filenum)
          Lookup file given result number and return file description
(package private)  void readFileOffsets()
          Read file long numbers (= offsets) from index into file table
(package private)  void readMetaNames()
          Read meta words from index
(package private)  void readOffsets()
          Read offsets right after file header
(package private)  void readStopwords()
          Read stop words from index into stop word table
(package private) static char toLowerCase(char ch)
          Own toLowerCase static method, does NOT convert non-ASCII characters to lower case.
(package private) static java.lang.String toLowerCase(java.lang.String string)
          Own toLowerCase static method, does NOT convert non-ASCII characters to lower case.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

indexchars

static java.lang.String indexchars
File offset mapping.

ifheader

static final java.lang.String ifheader
SWISH-E file header.

stheader

static final java.lang.String stheader
Line marking word stemming info.

rd

Reader rd
Reference for reading index from file or URL.

offsets

int[] offsets
Table of file offsets.

maxfilenum

int maxfilenum
Highest short file number of index.

valid

boolean valid
Indicator for index' validity.

stemming

boolean stemming
Indicator for word stemming.

fh

FileHash fh
Table to remember file information.

sh

StopHash sh
Table of stop words.

mh

MetaHash mh
Table of meta words.

fn

java.util.Hashtable fn
Table of file names.

header

java.lang.String header
Index file header.
Constructor Detail

IndexFile

IndexFile(Reader rd)
    throws java.io.IOException
Creates and reads index file representation.
Parameters:
rd - Reader for reading file or URL.
Throws:
java.io.IOException - if file is invalid or unreadable
Method Detail

toLowerCase

static java.lang.String toLowerCase(java.lang.String string)
Own toLowerCase static method, does NOT convert non-ASCII characters to lower case.
Parameters:
string - string to be converted
Returns:
string with all ASCII characters recoded to lower case

toLowerCase

static char toLowerCase(char ch)
Own toLowerCase static method, does NOT convert non-ASCII characters to lower case.
Parameters:
ch - character to be converted
Returns:
character recoded to lower case if ASCII

readOffsets

void readOffsets()
           throws java.io.IOException
Read offsets right after file header
Throws:
java.io.IOException - on read error

getIndexFilenum

void getIndexFilenum()
               throws java.io.IOException
Determine number of files in index
Throws:
java.io.IOException - on read error

readStopwords

void readStopwords()
             throws java.io.IOException
Read stop words from index into stop word table
Throws:
java.io.IOException - on read error

readFileOffsets

void readFileOffsets()
               throws java.io.IOException
Read file long numbers (= offsets) from index into file table
Throws:
java.io.IOException - on read error

readMetaNames

void readMetaNames()
             throws java.io.IOException
Read meta words from index
Throws:
java.io.IOException - on read error

decodefilenum

int decodefilenum(int num)
Decode short file number from given result number.
Parameters:
num - number from search result
Returns:
short file number

lookupfile

java.lang.String lookupfile(int filenum)
Lookup file given result number and return file description
Parameters:
num - number from search result
Returns:
File information or null.

findWord

boolean findWord(java.lang.String word)
Lookup word and position index pointer accordingly.
Parameters:
word - word to be found
Returns:
true if word found, false otherwise

getfileinfo

ResultList getfileinfo(java.lang.String word,
                       int meta)
Lookup word and make ResultList of it
Parameters:
word - word to be found
meta - meta number to be considered
Returns:
new ResultList or null if not found

getmatchword

java.lang.String getmatchword(java.lang.String prefix,
                              boolean first)
Match words against given prefix
Parameters:
prefix - word prefix
first - true for first match
Returns:
word or null if not found

dumpWords

java.lang.String[] dumpWords(java.lang.String initial)
Dump keywords given initial into String array.
Parameters:
initial - String giving the initial character
Returns:
String[] containing words or null


Contact: Christian.Werner@t-online.de