org.mydm.search
Class SimpleSearch

java.lang.Object
  extended byorg.mydm.search.SimpleSearch
All Implemented Interfaces:
java.lang.Runnable, Search

public class SimpleSearch
extends java.lang.Object
implements Search, java.lang.Runnable

Simple Search.

Simple Search will search all the metadata elements of all EDocuments of all collections.

Simple Search will also provide the case insensitive search over the metadata. Currently the search uses the XPATH as a query service to the database (XML Database).

The XPATH engine is case sensitive, that means if we are looking for a word "Chemistry" then it will only give the results where it find the word "Chemistry" with capital letter "C". This is not acceptable to a typical search enigne.

The workaround is to capture all the metadata of EDocument and save them as lower case text. So when the search is performed the search string (query string) is converted in to lower case and searched on the lower case complete metadata text.

Database The main collections are container in "md" (/db/md)

The database contains collection named "mdftext" which contains documents (single document per a collection from "md").

Simple Search will search all the documents in this "mdftext" collection.

Advantages of this workaround are

Note: currently we use only XPATH 1.0 (XPATH 2.0 and XQuery are not yet supported)

Usage:
String searchterm = "chemical physics";
SimpleSearch ss = new SimpleSearch(searchterm);
SearchResListenerImpl sreslistner = new SearchResListener();
ss.performSearch(srlistener);

Until we say ss.performSearch() the search won't be started. performSearch() will run as a thread. The results found will be notified to the SearchResListener Object (sreslistener).


Constructor Summary
SimpleSearch()
          Constructor
SimpleSearch(java.lang.String searchstring)
          Constructor
 
Method Summary
 void addListener(SearchResListener srl)
          Adds the Listener to the set of listeners
 SearchResListener performSearch()
          Performs the search and returns a reference to SearchResListener object.
 void performSearch(SearchResListener slistener)
          Performs the search in a new thread.
 void removeListener(SearchResListener srl)
          Removed the listener from the set of listeners.
 void run()
           
 boolean status()
          Gives the status of the search.
 void stop()
          Stops the Searching thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleSearch

public SimpleSearch()
Constructor


SimpleSearch

public SimpleSearch(java.lang.String searchstring)
Constructor

Parameters:
searchstring - search string.
Method Detail

performSearch

public void performSearch(SearchResListener slistener)
                   throws MyDMException
Description copied from interface: Search
Performs the search in a new thread. Search Results are notified to the listener object passed.

Specified by:
performSearch in interface Search
Parameters:
slistener - SearchResListener
Throws:
MyDMException

performSearch

public SearchResListener performSearch()
                                throws MyDMException
Description copied from interface: Search
Performs the search and returns a reference to SearchResListener object.

Specified by:
performSearch in interface Search
Returns:
searchreslistener object
Throws:
MyDMException

status

public boolean status()
Description copied from interface: Search
Gives the status of the search. returns true if the search thread is still running. returns falase if the search thread is not running.

Specified by:
status in interface Search
Returns:
true or false.

stop

public void stop()
Description copied from interface: Search
Stops the Searching thread.

Specified by:
stop in interface Search

addListener

public void addListener(SearchResListener srl)
Description copied from interface: Search
Adds the Listener to the set of listeners

Specified by:
addListener in interface Search
Parameters:
srl - SearchResListener

removeListener

public void removeListener(SearchResListener srl)
Description copied from interface: Search
Removed the listener from the set of listeners.

Specified by:
removeListener in interface Search
Parameters:
srl -

run

public void run()
Specified by:
run in interface java.lang.Runnable