Whenever I post a new topic or edit a message with a \r or \n in it
it is not correctly parsed by the
pattern matcher
\jforum\dao\generic\GenericSearchIndexerDAO.java around line 90
Pattern pattern = Pattern.compile("[\\.\\\\\\/~^&\\(\\)-_+=!@#$%\"\'\\[\\]\\{\\}?<:>,*\n\r\t��A��F��G��B��C��H��I��]��^��u��v��y��z��X��K��E]");
this.setAutoGeneratedKeysQuery(SystemGlobals.getSql("SearchModel.lastGeneratedWordId"));
int minWordSize = SystemGlobals.getIntValue(ConfigKeys.SEARCH_MIN_WORD_SIZE);
// Process all posts
for (Iterator iter = posts.iterator(); iter.hasNext(); ) {
Post post = (Post)iter.next();
existingAssociation.setInt(2, post.getId());
wordToPost.setInt(1, post.getId());
String str = post.getText() + " " + post.getSubject();
str = pattern.matcher(str).replaceAll(" ");
// Do these separately pattern matcher doesn't seem to find them
str = str.replaceAll("\t", " ");
str = str.replaceAll("\r", " ");
str = str.replaceAll("\n", " ");
System.out.println(str);
I had to replace them singlely so search would work on term that were after \r\n
I could not get the pattern matcher to work for those caharcters
the above patch worsk maybe someone else can match the correct pattern?
[originally posted on jforum.net by mqjoe1]