Using EveContext

 

Eve and EveContext contain the maxSearchBins parameter which tells the search engine how many potential index "clusters" it should examine before returning a list of search results.

 

WARNING ยท Setting this to an extremely high value forces the search engine to search every cluster. Be forewarned that this creates a very large performance hit. Do not use a high value as your default setting.

 

// open the MediaCollection and set maxSearchBins to an extremely

// high value to guarantee you'll search every bin

MediaCollection mc = Eve.newMediaCollection();

mc.open (directoryName);

EveContext context = new EveContext();

context.maxSearchBins = 999999;

 

// tell the collection to use the new parameters

mc.setContext( context );

 

// Perform the search

SearchResults results[] = mc.search( source, parameters );

 

 

Be aware that certain parameters are used at various points in the engine. As an example, if the MediaCollection resides in a relational database, the MediaCollection.open() method opens a connection to the database. Thus, to use a different password than the default in Eve.properties, you must do the following:

 

// create a MediaCollection object and context

MediaCollection mc = Eve.newMediaCollection();

EveContext context = new EveContext();

 

// set the database options

context.databaseUser = "MyUserName";

context.databasePassword = "MyPassword";

 

// tell the collection to use the new parameters

mc.setContext( context );

 

// open the mediaCollection

// note that you must still specify a path to the disk-based portions

// of the collection such as the index

mc.open( directoryPath );