r52504 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r52503‎ | r52504 | r52505 >
Date:11:19, 28 June 2009
Author:rainman
Status:deferred
Tags:
Comment:
Nicer logging and fix rare highlighting bug
Modified paths:
  • /branches/lucene-search-2.1/src/org/wikimedia/lsearch/highlight/Highlight.java (modified) (history)
  • /branches/lucene-search-2.1/src/org/wikimedia/lsearch/interoperability/RMIMessengerClient.java (modified) (history)
  • /branches/lucene-search-2.1/src/org/wikimedia/lsearch/search/SearchEngine.java (modified) (history)

Diff [purge]

Index: branches/lucene-search-2.1/src/org/wikimedia/lsearch/interoperability/RMIMessengerClient.java
@@ -246,7 +246,7 @@
247247 return r.getTerms(dbrole,wildcard,exactCase);
248248 } catch(Exception e){
249249 recheckRemote(dbrole,host);
250 - e.printStackTrace();
 250+ log.warn("Exception getting terms for wildcard="+wildcard+" on host="+host, e);
251251 return new ArrayList<String>();
252252 }
253253 }
@@ -256,8 +256,8 @@
257257 RMIMessenger r = messengerFromCache(host);
258258 return r.highlight(hits,dbrole,terms,df,maxDoc,words,exactCase,sortByPhrases,alwaysIncludeFirst);
259259 } catch(Exception e){
260 - recheckRemote(dbrole,host);
261 - e.printStackTrace();
 260+ log.warn("Exception highligthing words="+words+" on host="+host, e);
 261+ recheckRemote(dbrole,host);
262262 return new Highlight.ResultSet(new HashMap<String,HighlightResult>(),new HashSet<String>(),new HashSet<String>(),false,0,new HashSet<String>(),false);
263263 }
264264 }
@@ -271,7 +271,6 @@
272272 log.warn("Cannot find title host for "+dbrole,e);
273273 return new SearchResults();
274274 }
275 - e.printStackTrace();
276275 recheckRemote(dbrole,host);
277276 SearchResults res = new SearchResults();
278277 res.setErrorMsg("Error searching titles: "+e.getMessage());
Index: branches/lucene-search-2.1/src/org/wikimedia/lsearch/search/SearchEngine.java
@@ -920,6 +920,8 @@
921921 logRequest(iid,"search",searchterm, q, numhits, searchStart, s);
922922
923923 int size = min(limit+offset,MAXOFFSET,numhits) - offset;
 924+ if( size < 0 )
 925+ size = 0;
924926 int[] docids = new int[size];
925927 float[] scores = new float[size];
926928 // fetch documents
Index: branches/lucene-search-2.1/src/org/wikimedia/lsearch/highlight/Highlight.java
@@ -658,7 +658,7 @@
659659 phraseScore = phraseWeight;
660660 phraseStart = phraseIndex;
661661 phraseCount = 1;
662 - } else if(inx != null && lastInx != null){
 662+ } else if(inx != null && lastInx != null && phraseStart != -1){
663663 if(lastInx + 1 != inx){
664664 // end of last phrase, begin of new
665665 addToScore(fs,boostPhrase(phraseScore,phraseCount),phraseStart,phraseIndex,phraseCount);

Status & tagging log