keyword search - change attribute ordering, cleanup escaping (now done in BB), do not write selector attribute (should go to gen info)

This commit is contained in:
adam-m 2012-03-23 12:06:46 -04:00
parent dd6222da75
commit 8f101145e2
2 changed files with 8 additions and 11 deletions

View File

@ -131,10 +131,7 @@ public class KeywordSearchUtil {
//TODO escaping should be handled by blackboard
public static String escapeForBlackBoard(String text) {
try {
//text = text.replaceAll("\\\\'", URLEncoder.encode("\\'", "UTF-8"));
text = text.replaceAll("'", URLEncoder.encode("'", "UTF-8"));
//text = text.replaceAll("\"", URLEncoder.encode("\"", "UTF-8"));
//text = text.replaceAll("\\\\", URLEncoder.encode("\\", "UTF-8"));
} catch (UnsupportedEncodingException ex) {
}
return text;

View File

@ -195,12 +195,9 @@ public class TermComponentQuery implements KeywordSearchQuery {
continue;
}
//regex keyword, escape and store
attributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_KEYWORD_REGEXP.getTypeID(), MODULE_NAME, "", KeywordSearchUtil.escapeForBlackBoard(termsQuery)));
//regex match
final String regexMatchEscaped = KeywordSearchUtil.escapeForBlackBoard(regexMatch);
attributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_KEYWORD.getTypeID(), MODULE_NAME, "", regexMatchEscaped));
attributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_KEYWORD.getTypeID(), MODULE_NAME, "", regexMatch));
//list
if (listName == null) {
listName = "";
@ -208,17 +205,20 @@ public class TermComponentQuery implements KeywordSearchQuery {
attributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_KEYWORD_SET.getTypeID(), MODULE_NAME, "", listName));
//preview
attributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_KEYWORD_PREVIEW.getTypeID(), MODULE_NAME, "", KeywordSearchUtil.escapeForBlackBoard(snippet)));
attributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_KEYWORD_PREVIEW.getTypeID(), MODULE_NAME, "", snippet));
//regex keyword
attributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_KEYWORD_REGEXP.getTypeID(), MODULE_NAME, "", termsQuery));
//selector
//selector TODO move to general info artifact
/*
if (keywordQuery != null) {
BlackboardAttribute.ATTRIBUTE_TYPE selType = keywordQuery.getType();
if (selType != null) {
BlackboardAttribute selAttr = new BlackboardAttribute(selType.getTypeID(), MODULE_NAME, "", regexMatchEscaped);
BlackboardAttribute selAttr = new BlackboardAttribute(selType.getTypeID(), MODULE_NAME, "", regexMatch);
attributes.add(selAttr);
}
}
} */
try {
bba.addAttributes(attributes);