LUCENE-3019: fix unexpected color tags for FVH

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1170908 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Koji Sekiguchi 2011-09-15 00:49:45 +00:00
parent 527bcf67b1
commit 5f9c4235dc
2 changed files with 5 additions and 2 deletions

View File

@ -90,6 +90,8 @@ Bug Fixes
* LUCENE-3417: DictionaryCompoundWordFilter did not properly add tokens from the * LUCENE-3417: DictionaryCompoundWordFilter did not properly add tokens from the
end compound word. (Njal Karevoll via Robert Muir) end compound word. (Njal Karevoll via Robert Muir)
* LUCENE-3019: Fix unexpected color tags for FastVectorHighlighter. (Koji Sekiguchi)
======================= Lucene 3.4.0 ================ ======================= Lucene 3.4.0 ================
New Features New Features

View File

@ -17,6 +17,7 @@ package org.apache.lucene.search.vectorhighlight;
*/ */
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
@ -59,7 +60,7 @@ public class FieldQuery {
FieldQuery( Query query, IndexReader reader, boolean phraseHighlight, boolean fieldMatch ) throws IOException { FieldQuery( Query query, IndexReader reader, boolean phraseHighlight, boolean fieldMatch ) throws IOException {
this.fieldMatch = fieldMatch; this.fieldMatch = fieldMatch;
Set<Query> flatQueries = new HashSet<Query>(); List<Query> flatQueries = new ArrayList<Query>();
flatten( query, reader, flatQueries ); flatten( query, reader, flatQueries );
saveTerms( flatQueries, reader ); saveTerms( flatQueries, reader );
Collection<Query> expandQueries = expand( flatQueries ); Collection<Query> expandQueries = expand( flatQueries );
@ -132,7 +133,7 @@ public class FieldQuery {
* => expandQueries={a,"b c","c d","b c d"} * => expandQueries={a,"b c","c d","b c d"}
*/ */
Collection<Query> expand( Collection<Query> flatQueries ){ Collection<Query> expand( Collection<Query> flatQueries ){
Set<Query> expandQueries = new HashSet<Query>(); List<Query> expandQueries = new ArrayList<Query>();
for( Iterator<Query> i = flatQueries.iterator(); i.hasNext(); ){ for( Iterator<Query> i = flatQueries.iterator(); i.hasNext(); ){
Query query = i.next(); Query query = i.next();
i.remove(); i.remove();