r111290 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111289‎ | r111290 | r111291 >
Date:10:51, 12 February 2012
Author:oren
Status:deferred
Tags:
Comment:
replaced deprecated next() override to next(Token nextToken) with a reusable Token - which gives significant speed gains
Modified paths:
  • /trunk/lucene-search-3/src/main/java/org/wikimedia/lsearch/analyzers/AcronymFilter.java (modified) (history)

Diff [purge]

Index: trunk/lucene-search-3/src/main/java/org/wikimedia/lsearch/analyzers/AcronymFilter.java
@@ -16,21 +16,21 @@
1717 super(input);
1818 }
1919
20 - @Override
21 - public Token next() throws IOException {
 20+ @Override
 21+ public Token next(Token nextToken) throws IOException {
2222 if(buffered != null){
23 - Token t = buffered;
 23+ nextToken = buffered;
2424 buffered = null;
25 - return t;
 25+ return nextToken;
2626 }
27 - Token t = input.next();
28 - if(t == null)
 27+ nextToken = input.next();
 28+ if(nextToken == null)
2929 return null;
30 - if(t.termText().contains(".") && !isNumber(t.termText())){
31 - buffered = new Token(t.termText().replace(".",""),t.startOffset(),t.endOffset(),t.type());
 30+ if(nextToken.termText().contains(".") && !isNumber(nextToken.termText())){
 31+ buffered = new Token(nextToken.termText().replace(".",""),nextToken.startOffset(),nextToken.endOffset(),nextToken.type());
3232 buffered.setPositionIncrement(0);
3333 }
34 - return t;
 34+ return nextToken;
3535 }
3636
3737 protected boolean isNumber(String str){

Status & tagging log