SearchEngine.java revision 615
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* See LICENSE.txt included in this distribution for the specific
* language governing permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at LICENSE.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Trond Norbye. All rights reserved.
* Use is subject to license terms.
*/
/**
* This is an encapsulation of the details on how to seach in the index
* database.
*
* @author Trond Norbye
*/
public class SearchEngine {
/** Message text used when logging exceptions thrown when searching. */
/**
* Holds value of property definition.
*/
private String definition;
/**
* Holds value of property file.
*/
/**
* Holds value of property freetext.
*/
/**
* Holds value of property history.
*/
/**
* Holds value of property symbol.
*/
/**
* Holds value of property indexDatabase.
*/
private final CompatibleAnalyser analyzer;
private final QueryParser qparser;
private Context sourceContext;
private HistoryContext historyContext;
private Summarizer summer;
/**
* Creates a new instance of SearchEngine
*/
public SearchEngine() {
analyzer = new CompatibleAnalyser();
}
public boolean isValidQuery() {
boolean ret;
try {
ret = true;
} catch (Exception e) {
ret = false;
}
} else {
ret = false;
}
return ret;
}
}
}
}
}
/**
* Execute a search. Before calling this function, you must set the
* appropriate seach critera with the set-functions.
*
* @return The number of hits
*/
public int search() {
try {
if (env.hasProjects()) {
// search all projects
}
} else {
// search the index database
}
} catch (Exception e) {
}
}
try {
if(sourceContext.isEmpty()) {
}
} catch (Exception e) {
}
try {
if(historyContext.isEmpty()) {
}
} catch (Exception e) {
}
}
}
}
boolean hasContext = false;
try {
}
if(sourceContext != null) {
try {
int l = 0;
try {
} finally {
r.close();
}
}
hasContext = true;
}
}
} else {
}
} catch (FileNotFoundException exp) {
}
}
if (historyContext != null) {
}
if(!hasContext) {
}
} catch (IOException e) {
} catch (ClassNotFoundException e) {
} catch (HistoryException e) {
}
}
}
/**
* Getter for property definition.
*
* @return Value of property definition.
*/
public String getDefinition() {
return this.definition;
}
/**
* Setter for property definition.
*
* @param definition New value of property definition.
*/
this.definition = definition;
}
/**
* Getter for property file.
*
* @return Value of property file.
*/
return this.file;
}
/**
* Setter for property file.
*
* @param file New value of property file.
*/
}
/**
* Getter for property freetext.
*
* @return Value of property freetext.
*/
public String getFreetext() {
return this.freetext;
}
/**
* Setter for property freetext.
*
* @param freetext New value of property freetext.
*/
}
/**
* Getter for property history.
*
* @return Value of property history.
*/
public String getHistory() {
return this.history;
}
/**
* Setter for property history.
*
* @param history New value of property history.
*/
}
/**
* Getter for property symbol.
*
* @return Value of property symbol.
*/
return this.symbol;
}
/**
* Setter for property symbol.
*
* @param symbol New value of property symbol.
*/
}
}