Hi, I'm getting an ArrayIndexOutOfBoundsException within the highlighter: java.lang.ArrayIndexOutOfBoundsException: 50 at org.apache.lucene.search.highlight.TokenGroup.addToken(TokenGroup.java:47) at org.apache.lucene.search.highlight.Highlighter.getBestDocFragments(Highlighter.java:184) at org.apache.lucene.search.highlight.Highlighter.getBestFragments(Highlighter.java:101) at org.apache.lucene.search.highlight.Highlighter.getBestFragments(Highlighter.java:363)
It was working fine but I was having trouble getting highlights for phrases. I was advised to make sure that I was using the same analyzer as when I indexed. I made that change and I'm now getting the exception. The reason I'm getting the exception now, I'm sure, is that I have synonym capability in my application and when I use the synonym feature I exceed TokenGroup.MAX_NUM_TOKENS_PER_GROUP. I've made a fix in my implementation. Here it is: void addToken(Token token, float score) { if(numTokens < MAX_NUM_TOKENS_PER_GROUP) // new line { if(numTokens == 0){ startOffset = token.startOffset(); endOffset = token.endOffset(); } else{ startOffset = Math.min(startOffset, token.startOffset()); endOffset = Math.max(endOffset, token.endOffset()); } tokens[numTokens] = token; // place where the exception was occuring. scores[numTokens] = score; numTokens++; } // new line } Cheers, Andrew --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]