• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Searching Bug

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, although I already made a slightly different patch (among with a huge performance optimization to the seach classes).

Thanks anyway!

Rafael
[originally posted on jforum.net by Rafael Steil]
 
You know it is dark times when the trees riot. I think this tiny ad is their leader:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic