swishej
Class SearchImpl

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

class SearchImpl
extends java.lang.Object

Class implementing the SWISH-E search.

See Also:
SortResult, ResultList

Constructor Summary
(package private) SearchImpl()
           
 
Method Summary
(package private) static StrList expandstars(IndexFile inf, StrList wlist)
          Expand wildcards.
(package private) static StrList fixnot(StrList wl)
          Traverse StrList of keywords and reformat it for later parsing.
(package private) static int getrulenum(java.lang.String word)
          Return rule constant given word.
(package private) static boolean isbooleanrule(java.lang.String word)
          Check if given word is a boolean rule.
(package private) static boolean ismeta(java.lang.String word)
          Check if given word is a meta word for the search.
(package private) static boolean isrule(java.lang.String word)
          Check if given word is a rule.
(package private) static boolean isunaryrule(java.lang.String word)
          Check if given word is a unary rule.
(package private) static StrList mkwlist(java.lang.String words)
          Given keyword string break it in words represented by a StrList.
(package private) static ResultList operate(ResultList rl, int rulenum, java.lang.String word, int meta, int andLevel, IndexFile inf)
          Search the indexfile and accumulate results.
(package private) static ResultList parseterm(StrList wordlist, boolean parseone, int meta, IndexFile inf)
          Parse next term in keyword list and search accordingly.
(package private) static java.lang.String search(IndexFile inf, java.lang.String words, int maxhits, int structure, java.net.URL base)
          Perform keyword search.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Constructor Detail

SearchImpl

SearchImpl()
Method Detail

getrulenum

static int getrulenum(java.lang.String word)
Return rule constant given word.
Parameters:
word - word to be checked.
Returns:
rule constant, e.g. AND_RULE, OR_RULE etc.

isrule

static boolean isrule(java.lang.String word)
Check if given word is a rule.
Parameters:
word - word to be checked.
Returns:
true if word is a rule, e.g. "and", "or" etc.

isbooleanrule

static boolean isbooleanrule(java.lang.String word)
Check if given word is a boolean rule.
Parameters:
word - word to be checked.
Returns:
true if word is a binary rule, i.e. "and" or "or"

isunaryrule

static boolean isunaryrule(java.lang.String word)
Check if given word is a unary rule.
Parameters:
word - word to be checked.
Returns:
true if word is a unary rule, i.e. "not"

mkwlist

static StrList mkwlist(java.lang.String words)
Given keyword string break it in words represented by a StrList.
Parameters:
words - keyword string
Returns:
StrList of keywords

ismeta

static boolean ismeta(java.lang.String word)
Check if given word is a meta word for the search.
Parameters:
word - word to be checked
Returns:
true if word is meta word

fixnot

static StrList fixnot(StrList wl)
Traverse StrList of keywords and reformat it for later parsing.
Parameters:
wl - original keyword list
Returns:
reformatted keyword list

parseterm

static ResultList parseterm(StrList wordlist,
                            boolean parseone,
                            int meta,
                            IndexFile inf)
Parse next term in keyword list and search accordingly.
Parameters:
wordlist - keyword list
parseone - if true only one word is considered
meta - active meta word number for the search
inf - index to be searched
Returns:
ResultList of the term

operate

static ResultList operate(ResultList rl,
                          int rulenum,
                          java.lang.String word,
                          int meta,
                          int andLevel,
                          IndexFile inf)
Search the indexfile and accumulate results.
Parameters:
rl - ResultList from earlier invokations
rulenum - rule for merging results
word - current keyword to be searched
meta - active meta word number for the search
andLevel - nesting level of "and" term
inf - index to be searched
Returns:
new ResultList

expandstars

static StrList expandstars(IndexFile inf,
                           StrList wlist)
Expand wildcards.
Parameters:
word - list to be expanded
Returns:
new word list

search

static java.lang.String search(IndexFile inf,
                               java.lang.String words,
                               int maxhits,
                               int structure,
                               java.net.URL base)
Perform keyword search.
Parameters:
inf - index to be searched
words - keywords to be searched
maxhits - maximum number of hits
structure - which meta information to be considered
base - base URL or null, if not null result is HTML formatted
Returns:
search result


Contact: Christian.Werner@t-online.de