Changeset 6689
- Timestamp:
- 10/20/15 13:15:51 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vlo/branches/vlo-3.3/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/HighlightSearchTermScriptFactory.java
r6687 r6689 19 19 import com.google.common.collect.ImmutableSet; 20 20 import java.util.Collection; 21 import org.apache.wicket.util.string.StringValue;22 21 23 22 /** … … 33 32 public String createScript(String componentSelector, final String words) { 34 33 return String.format(HIGHLIGHT_FUNCTION, 35 componentSelector, 34 componentSelector, 36 35 makeWordListArray(words), 37 36 getSearchWordClass() … … 63 62 64 63 private String sanitise(String word) { 65 return word.replaceAll("^[\\s'\"]+|[\\s'\"]+$", ""); 64 //remove everything up to first colon and strip off quotation marks and white space 65 return word.replaceAll( 66 //match beginning 67 "^(" 68 //case with colon (also strip quotes + optional whitespace after quotes) 69 + "[^:\"']+:(['\"])?" 70 //or case without colon (strip quotes and white space) 71 + "|['\"]+" 72 + ")" 73 //match end 74 + "|(" 75 //quotes 76 + "['\"]+" 77 //or boosting values 78 + "|['\"]?\\^.*" 79 + ")$", 80 //replace with empty string 81 ""); 66 82 } 67 83
Note: See TracChangeset
for help on using the changeset viewer.