com.futurexpert.xpert.xretrieve
Class ElementInfo

java.lang.Object
  |
  +--com.futurexpert.xpert.xretrieve.ElementInfo


public class ElementInfo
extends java.lang.Object
ElementInfo class has the information of the retrieved element. It is defined as:

public class ElementInfo {
	...
	public int score;
	...
}
When you issue an XPQL query, You will get a Vector of ElementInfo objects as the result of evaluation. Then you can get the element content by calling getElement(ElementInfo ei) or the head information by calling getElement(ElementInfo ei, int length). At the same time, you can get the score of the element against the given query. You can do this with a sample like:

Vector result = xr.evaluate(XPQLquery);
int i = 0;
while(i < result.size()) {
	ElementInfo ei = (ElementInfo) result.elementAt(i);
	int score = ei.score;
	System.out.println("score : " + score);
	String content = xr.getElement(ei);
	System.out.println("content: \n " + content);
	i++;
}
The score in an ElementInfo object is an integer value that represents the similarity of the query and the element. Note that the score is always 1 except the query has "contains()" or "in()" function. If you use a "contains()" or "in()" function inside a predicate, the score represents the similarity based upon the number of occurrences of the words. If the functions contain just one word, such as "//SECTION[contains(PARA, "XML")]" or "//SECTION[ in("XML", PARA)]", the score is exactly the number of occurrences of the word appearing in the condition node. For instance, with the previous query, if you get a score 3, then it means that PARA elements of //SECTION has three occurrences of "XML". Note that even though the "//SECTION" has another occurrence of "XML" outside PARA, they do not count.
 
 


   

Field Summary

public int score

Score means the similarity value of the element against the given query.