* @param result
*/
private Sequence exactMatch(XQueryContext context, String[] terms, NodeSet result) {
TextToken token;
final NodeSet r = new ExtArrayNodeSet();
final Tokenizer tok = context.getBroker().getTextEngine().getTokenizer();
//Define search phrase for matches
String matchTerm = "";
for (int k = 0; k < terms.length ; k++) {
matchTerm = matchTerm + terms[k];
if (k != terms.length - 1)
{matchTerm = matchTerm + "\\W*";}
}
//Iterate on results
for (final NodeProxy current : result) {
final Vector<NodeId> matchNodeIDs = new Vector<NodeId>();
//Get first match
Match nextMatch = current.getMatches();
//Remove previously found matches on current
current.setMatches(null);
//Iterate on attach matches, with unicity of related nodeproxy gid
String term;
while(nextMatch != null) {
final NodeId nodeId= nextMatch.getNodeId();
//If current node id has not been previously processed
if (!matchNodeIDs.contains(nodeId)) {
final NodeProxy mcurrent = new NodeProxy(current.getDocument(), nodeId);
Match match = null;
int firstOffset = -1;
matchNodeIDs.add(nodeId);
final String value = mcurrent.getNodeValue();
tok.setText(value);
int j = 0;
if (j < terms.length)
{term = terms[j];}
else
{break;}
int frequency = 0;
while ((token = tok.nextToken()) != null) {
final String word = token.getText().toLowerCase();
if (word.equalsIgnoreCase(term)) {
j++;
if (j == terms.length) {
//All terms found