You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by mi...@apache.org on 2009/07/09 15:06:52 UTC
svn commit: r792542 [2/3] - in /lucene/java/trunk: ./ contrib/
contrib/fast-vector-highlighter/ contrib/fast-vector-highlighter/src/
contrib/fast-vector-highlighter/src/java/
contrib/fast-vector-highlighter/src/java/org/
contrib/fast-vector-highlighter...
Propchange: lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/AbstractTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/FieldPhraseListTest.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/FieldPhraseListTest.java?rev=792542&view=auto
==============================================================================
--- lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/FieldPhraseListTest.java (added)
+++ lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/FieldPhraseListTest.java Thu Jul 9 13:06:51 2009
@@ -0,0 +1,182 @@
+package org.apache.lucene.search.vectorhighlight;
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.lucene.search.BooleanQuery;
+import org.apache.lucene.search.BooleanClause.Occur;
+
+public class FieldPhraseListTest extends AbstractTestCase {
+
+ public void test1TermIndex() throws Exception {
+ make1d1fIndex( "a" );
+
+ FieldQuery fq = new FieldQuery( tq( "a" ), true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ FieldPhraseList fpl = new FieldPhraseList( stack, fq );
+ assertEquals( 1, fpl.phraseList.size() );
+ assertEquals( "a(1.0)((0,1))", fpl.phraseList.get( 0 ).toString() );
+
+ fq = new FieldQuery( tq( "b" ), true, true );
+ stack = new FieldTermStack( reader, 0, F, fq );
+ fpl = new FieldPhraseList( stack, fq );
+ assertEquals( 0, fpl.phraseList.size() );
+ }
+
+ public void test2TermsIndex() throws Exception {
+ make1d1fIndex( "a a" );
+
+ FieldQuery fq = new FieldQuery( tq( "a" ), true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ FieldPhraseList fpl = new FieldPhraseList( stack, fq );
+ assertEquals( 2, fpl.phraseList.size() );
+ assertEquals( "a(1.0)((0,1))", fpl.phraseList.get( 0 ).toString() );
+ assertEquals( "a(1.0)((2,3))", fpl.phraseList.get( 1 ).toString() );
+ }
+
+ public void test1PhraseIndex() throws Exception {
+ make1d1fIndex( "a b" );
+
+ FieldQuery fq = new FieldQuery( pqF( "a", "b" ), true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ FieldPhraseList fpl = new FieldPhraseList( stack, fq );
+ assertEquals( 1, fpl.phraseList.size() );
+ assertEquals( "ab(1.0)((0,3))", fpl.phraseList.get( 0 ).toString() );
+
+ fq = new FieldQuery( tq( "b" ), true, true );
+ stack = new FieldTermStack( reader, 0, F, fq );
+ fpl = new FieldPhraseList( stack, fq );
+ assertEquals( 1, fpl.phraseList.size() );
+ assertEquals( "b(1.0)((2,3))", fpl.phraseList.get( 0 ).toString() );
+ }
+
+ public void test1PhraseIndexB() throws Exception {
+ // 01 12 23 34 45 56 67 78 (offsets)
+ // bb|bb|ba|ac|cb|ba|ab|bc
+ // 0 1 2 3 4 5 6 7 (positions)
+ make1d1fIndexB( "bbbacbabc" );
+
+ FieldQuery fq = new FieldQuery( pqF( "ba", "ac" ), true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ FieldPhraseList fpl = new FieldPhraseList( stack, fq );
+ assertEquals( 1, fpl.phraseList.size() );
+ assertEquals( "baac(1.0)((2,5))", fpl.phraseList.get( 0 ).toString() );
+ }
+
+ public void test2Terms1PhraseIndex() throws Exception {
+ make1d1fIndex( "c a a b" );
+
+ // phraseHighlight = true
+ FieldQuery fq = new FieldQuery( pqF( "a", "b" ), true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ FieldPhraseList fpl = new FieldPhraseList( stack, fq );
+ assertEquals( 1, fpl.phraseList.size() );
+ assertEquals( "ab(1.0)((4,7))", fpl.phraseList.get( 0 ).toString() );
+
+ // phraseHighlight = false
+ fq = new FieldQuery( pqF( "a", "b" ), false, true );
+ stack = new FieldTermStack( reader, 0, F, fq );
+ fpl = new FieldPhraseList( stack, fq );
+ assertEquals( 2, fpl.phraseList.size() );
+ assertEquals( "a(1.0)((2,3))", fpl.phraseList.get( 0 ).toString() );
+ assertEquals( "ab(1.0)((4,7))", fpl.phraseList.get( 1 ).toString() );
+ }
+
+ public void testPhraseSlop() throws Exception {
+ make1d1fIndex( "c a a b c" );
+
+ FieldQuery fq = new FieldQuery( pqF( 2F, 1, "a", "c" ), true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ FieldPhraseList fpl = new FieldPhraseList( stack, fq );
+ assertEquals( 1, fpl.phraseList.size() );
+ assertEquals( "ac(2.0)((4,5)(8,9))", fpl.phraseList.get( 0 ).toString() );
+ assertEquals( 4, fpl.phraseList.get( 0 ).getStartOffset() );
+ assertEquals( 9, fpl.phraseList.get( 0 ).getEndOffset() );
+ }
+
+ public void test2PhrasesOverlap() throws Exception {
+ make1d1fIndex( "d a b c d" );
+
+ BooleanQuery query = new BooleanQuery();
+ query.add( pqF( "a", "b" ), Occur.SHOULD );
+ query.add( pqF( "b", "c" ), Occur.SHOULD );
+ FieldQuery fq = new FieldQuery( query, true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ FieldPhraseList fpl = new FieldPhraseList( stack, fq );
+ assertEquals( 1, fpl.phraseList.size() );
+ assertEquals( "abc(1.0)((2,7))", fpl.phraseList.get( 0 ).toString() );
+ }
+
+ public void test3TermsPhrase() throws Exception {
+ make1d1fIndex( "d a b a b c d" );
+
+ FieldQuery fq = new FieldQuery( pqF( "a", "b", "c" ), true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ FieldPhraseList fpl = new FieldPhraseList( stack, fq );
+ assertEquals( 1, fpl.phraseList.size() );
+ assertEquals( "abc(1.0)((6,11))", fpl.phraseList.get( 0 ).toString() );
+ }
+
+ public void testSearchLongestPhrase() throws Exception {
+ make1d1fIndex( "d a b d c a b c" );
+
+ BooleanQuery query = new BooleanQuery();
+ query.add( pqF( "a", "b" ), Occur.SHOULD );
+ query.add( pqF( "a", "b", "c" ), Occur.SHOULD );
+ FieldQuery fq = new FieldQuery( query, true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ FieldPhraseList fpl = new FieldPhraseList( stack, fq );
+ assertEquals( 2, fpl.phraseList.size() );
+ assertEquals( "ab(1.0)((2,5))", fpl.phraseList.get( 0 ).toString() );
+ assertEquals( "abc(1.0)((10,15))", fpl.phraseList.get( 1 ).toString() );
+ }
+
+ public void test1PhraseShortMV() throws Exception {
+ makeIndexShortMV();
+
+ FieldQuery fq = new FieldQuery( tq( "d" ), true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ FieldPhraseList fpl = new FieldPhraseList( stack, fq );
+ assertEquals( 1, fpl.phraseList.size() );
+ assertEquals( "d(1.0)((6,7))", fpl.phraseList.get( 0 ).toString() );
+ }
+
+ public void test1PhraseLongMV() throws Exception {
+ makeIndexLongMV();
+
+ FieldQuery fq = new FieldQuery( pqF( "search", "engines" ), true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ FieldPhraseList fpl = new FieldPhraseList( stack, fq );
+ assertEquals( 2, fpl.phraseList.size() );
+ assertEquals( "searchengines(1.0)((102,116))", fpl.phraseList.get( 0 ).toString() );
+ assertEquals( "searchengines(1.0)((157,171))", fpl.phraseList.get( 1 ).toString() );
+ }
+/*
+ * ----------------------------------
+ * THIS TEST DEPENDS ON LUCENE-1448
+ * UNCOMMENT WHEN IT IS COMMITTED.
+ * ----------------------------------
+ public void test1PhraseLongMVB() throws Exception {
+ makeIndexLongMVB();
+
+ FieldQuery fq = new FieldQuery( pqF( "sp", "pe", "ee", "ed" ), true, true ); // "speed" -(2gram)-> "sp","pe","ee","ed"
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ FieldPhraseList fpl = new FieldPhraseList( stack, fq );
+ assertEquals( 1, fpl.phraseList.size() );
+ assertEquals( "sppeeeed(1.0)((88,93))", fpl.phraseList.get( 0 ).toString() );
+ }
+*/
+}
Propchange: lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/FieldPhraseListTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/FieldQueryTest.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/FieldQueryTest.java?rev=792542&view=auto
==============================================================================
--- lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/FieldQueryTest.java (added)
+++ lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/FieldQueryTest.java Thu Jul 9 13:06:51 2009
@@ -0,0 +1,822 @@
+package org.apache.lucene.search.vectorhighlight;
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.lucene.search.BooleanQuery;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.search.BooleanClause.Occur;
+import org.apache.lucene.search.vectorhighlight.FieldQuery.QueryPhraseMap;
+import org.apache.lucene.search.vectorhighlight.FieldTermStack.TermInfo;
+
+public class FieldQueryTest extends AbstractTestCase {
+
+ public void testFlattenBoolean() throws Exception {
+ Query query = paW.parse( "A AND B OR C NOT (D AND E)" );
+ FieldQuery fq = new FieldQuery( query, true, true );
+ Set<Query> flatQueries = new HashSet<Query>();
+ fq.flatten( query, flatQueries );
+ assertCollectionQueries( flatQueries, tq( "A" ), tq( "B" ), tq( "C" ) );
+ }
+
+ public void testFlattenTermAndPhrase() throws Exception {
+ Query query = paW.parse( "A AND \"B C\"" );
+ FieldQuery fq = new FieldQuery( query, true, true );
+ Set<Query> flatQueries = new HashSet<Query>();
+ fq.flatten( query, flatQueries );
+ assertCollectionQueries( flatQueries, tq( "A" ), pqF( "B", "C" ) );
+ }
+
+ public void testFlattenTermAndPhrase2gram() throws Exception {
+ Query query = paB.parse( "AA AND BCD OR EFGH" );
+ FieldQuery fq = new FieldQuery( query, true, true );
+ Set<Query> flatQueries = new HashSet<Query>();
+ fq.flatten( query, flatQueries );
+ assertCollectionQueries( flatQueries, tq( "AA" ), pqF( "BC", "CD" ), pqF( "EF", "FG", "GH" ) );
+ }
+
+ public void testFlatten1TermPhrase() throws Exception {
+ Query query = pqF( "A" );
+ FieldQuery fq = new FieldQuery( query, true, true );
+ Set<Query> flatQueries = new HashSet<Query>();
+ fq.flatten( query, flatQueries );
+ assertCollectionQueries( flatQueries, tq( "A" ) );
+ }
+
+ public void testExpand() throws Exception {
+ Query dummy = pqF( "DUMMY" );
+ FieldQuery fq = new FieldQuery( dummy, true, true );
+
+ // "a b","b c" => "a b","b c","a b c"
+ Set<Query> flatQueries = new HashSet<Query>();
+ flatQueries.add( pqF( "a", "b" ) );
+ flatQueries.add( pqF( "b", "c" ) );
+ assertCollectionQueries( fq.expand( flatQueries ),
+ pqF( "a", "b" ), pqF( "b", "c" ), pqF( "a", "b", "c" ) );
+
+ // "a b","b c d" => "a b","b c d","a b c d"
+ flatQueries = new HashSet<Query>();
+ flatQueries.add( pqF( "a", "b" ) );
+ flatQueries.add( pqF( "b", "c", "d" ) );
+ assertCollectionQueries( fq.expand( flatQueries ),
+ pqF( "a", "b" ), pqF( "b", "c", "d" ), pqF( "a", "b", "c", "d" ) );
+
+ // "a b c","b c d" => "a b c","b c d","a b c d"
+ flatQueries = new HashSet<Query>();
+ flatQueries.add( pqF( "a", "b", "c" ) );
+ flatQueries.add( pqF( "b", "c", "d" ) );
+ assertCollectionQueries( fq.expand( flatQueries ),
+ pqF( "a", "b", "c" ), pqF( "b", "c", "d" ), pqF( "a", "b", "c", "d" ) );
+
+ // "a b c","c d e" => "a b c","c d e","a b c d e"
+ flatQueries = new HashSet<Query>();
+ flatQueries.add( pqF( "a", "b", "c" ) );
+ flatQueries.add( pqF( "c", "d", "e" ) );
+ assertCollectionQueries( fq.expand( flatQueries ),
+ pqF( "a", "b", "c" ), pqF( "c", "d", "e" ), pqF( "a", "b", "c", "d", "e" ) );
+
+ // "a b b","b c" => "a b b","b c","a b b c"
+ flatQueries = new HashSet<Query>();
+ flatQueries.add( pqF( "a", "b", "b" ) );
+ flatQueries.add( pqF( "b", "c" ) );
+ assertCollectionQueries( fq.expand( flatQueries ),
+ pqF( "a", "b", "b" ), pqF( "b", "c" ), pqF( "a", "b", "b", "c" ) );
+
+ // "a b","b a" => "a b","b a","a b a", "b a b"
+ flatQueries = new HashSet<Query>();
+ flatQueries.add( pqF( "a", "b" ) );
+ flatQueries.add( pqF( "b", "a" ) );
+ assertCollectionQueries( fq.expand( flatQueries ),
+ pqF( "a", "b" ), pqF( "b", "a" ), pqF( "a", "b", "a" ), pqF( "b", "a", "b" ) );
+
+ // "a b","a b c" => "a b","a b c"
+ flatQueries = new HashSet<Query>();
+ flatQueries.add( pqF( "a", "b" ) );
+ flatQueries.add( pqF( "a", "b", "c" ) );
+ assertCollectionQueries( fq.expand( flatQueries ),
+ pqF( "a", "b" ), pqF( "a", "b", "c" ) );
+ }
+
+ public void testNoExpand() throws Exception {
+ Query dummy = pqF( "DUMMY" );
+ FieldQuery fq = new FieldQuery( dummy, true, true );
+
+ // "a b","c d" => "a b","c d"
+ Set<Query> flatQueries = new HashSet<Query>();
+ flatQueries.add( pqF( "a", "b" ) );
+ flatQueries.add( pqF( "c", "d" ) );
+ assertCollectionQueries( fq.expand( flatQueries ),
+ pqF( "a", "b" ), pqF( "c", "d" ) );
+
+ // "a","a b" => "a", "a b"
+ flatQueries = new HashSet<Query>();
+ flatQueries.add( tq( "a" ) );
+ flatQueries.add( pqF( "a", "b" ) );
+ assertCollectionQueries( fq.expand( flatQueries ),
+ tq( "a" ), pqF( "a", "b" ) );
+
+ // "a b","b" => "a b", "b"
+ flatQueries = new HashSet<Query>();
+ flatQueries.add( pqF( "a", "b" ) );
+ flatQueries.add( tq( "b" ) );
+ assertCollectionQueries( fq.expand( flatQueries ),
+ pqF( "a", "b" ), tq( "b" ) );
+
+ // "a b c","b c" => "a b c","b c"
+ flatQueries = new HashSet<Query>();
+ flatQueries.add( pqF( "a", "b", "c" ) );
+ flatQueries.add( pqF( "b", "c" ) );
+ assertCollectionQueries( fq.expand( flatQueries ),
+ pqF( "a", "b", "c" ), pqF( "b", "c" ) );
+
+ // "a b","a b c" => "a b","a b c"
+ flatQueries = new HashSet<Query>();
+ flatQueries.add( pqF( "a", "b" ) );
+ flatQueries.add( pqF( "a", "b", "c" ) );
+ assertCollectionQueries( fq.expand( flatQueries ),
+ pqF( "a", "b" ), pqF( "a", "b", "c" ) );
+
+ // "a b c","b d e" => "a b c","b d e"
+ flatQueries = new HashSet<Query>();
+ flatQueries.add( pqF( "a", "b", "c" ) );
+ flatQueries.add( pqF( "b", "d", "e" ) );
+ assertCollectionQueries( fq.expand( flatQueries ),
+ pqF( "a", "b", "c" ), pqF( "b", "d", "e" ) );
+ }
+
+ public void testExpandNotFieldMatch() throws Exception {
+ Query dummy = pqF( "DUMMY" );
+ FieldQuery fq = new FieldQuery( dummy, true, false );
+
+ // f1:"a b",f2:"b c" => f1:"a b",f2:"b c",f1:"a b c"
+ Set<Query> flatQueries = new HashSet<Query>();
+ flatQueries.add( pq( F1, "a", "b" ) );
+ flatQueries.add( pq( F2, "b", "c" ) );
+ assertCollectionQueries( fq.expand( flatQueries ),
+ pq( F1, "a", "b" ), pq( F2, "b", "c" ), pq( F1, "a", "b", "c" ) );
+ }
+
+ public void testGetFieldTermMap() throws Exception {
+ Query query = tq( "a" );
+ FieldQuery fq = new FieldQuery( query, true, true );
+
+ QueryPhraseMap pqm = fq.getFieldTermMap( F, "a" );
+ assertNotNull( pqm );
+ assertTrue( pqm.isTerminal() );
+
+ pqm = fq.getFieldTermMap( F, "b" );
+ assertNull( pqm );
+
+ pqm = fq.getFieldTermMap( F1, "a" );
+ assertNull( pqm );
+ }
+
+ public void testGetRootMap() throws Exception {
+ Query dummy = pqF( "DUMMY" );
+ FieldQuery fq = new FieldQuery( dummy, true, true );
+
+ QueryPhraseMap rootMap1 = fq.getRootMap( tq( "a" ) );
+ QueryPhraseMap rootMap2 = fq.getRootMap( tq( "a" ) );
+ assertTrue( rootMap1 == rootMap2 );
+ QueryPhraseMap rootMap3 = fq.getRootMap( tq( "b" ) );
+ assertTrue( rootMap1 == rootMap3 );
+ QueryPhraseMap rootMap4 = fq.getRootMap( tq( F1, "b" ) );
+ assertFalse( rootMap4 == rootMap3 );
+ }
+
+ public void testGetRootMapNotFieldMatch() throws Exception {
+ Query dummy = pqF( "DUMMY" );
+ FieldQuery fq = new FieldQuery( dummy, true, false );
+
+ QueryPhraseMap rootMap1 = fq.getRootMap( tq( "a" ) );
+ QueryPhraseMap rootMap2 = fq.getRootMap( tq( "a" ) );
+ assertTrue( rootMap1 == rootMap2 );
+ QueryPhraseMap rootMap3 = fq.getRootMap( tq( "b" ) );
+ assertTrue( rootMap1 == rootMap3 );
+ QueryPhraseMap rootMap4 = fq.getRootMap( tq( F1, "b" ) );
+ assertTrue( rootMap4 == rootMap3 );
+ }
+
+ public void testGetTermSet() throws Exception {
+ Query query = paW.parse( "A AND B OR x:C NOT (D AND E)" );
+ FieldQuery fq = new FieldQuery( query, true, true );
+ assertEquals( 2, fq.termSetMap.size() );
+ Set<String> termSet = fq.getTermSet( F );
+ assertEquals( 2, termSet.size() );
+ assertTrue( termSet.contains( "A" ) );
+ assertTrue( termSet.contains( "B" ) );
+ termSet = fq.getTermSet( "x" );
+ assertEquals( 1, termSet.size() );
+ assertTrue( termSet.contains( "C" ) );
+ termSet = fq.getTermSet( "y" );
+ assertNull( termSet );
+ }
+
+ public void testQueryPhraseMap1Term() throws Exception {
+ Query query = tq( "a" );
+
+ // phraseHighlight = true, fieldMatch = true
+ FieldQuery fq = new FieldQuery( query, true, true );
+ Map<String, QueryPhraseMap> map = fq.rootMaps;
+ assertEquals( 1, map.size() );
+ assertNull( map.get( null ) );
+ assertNotNull( map.get( F ) );
+ QueryPhraseMap qpm = map.get( F );
+ assertEquals( 1, qpm.subMap.size() );
+ assertTrue( qpm.subMap.get( "a" ) != null );
+ assertTrue( qpm.subMap.get( "a" ).terminal );
+ assertEquals( 1F, qpm.subMap.get( "a" ).boost );
+
+ // phraseHighlight = true, fieldMatch = false
+ fq = new FieldQuery( query, true, false );
+ map = fq.rootMaps;
+ assertEquals( 1, map.size() );
+ assertNull( map.get( F ) );
+ assertNotNull( map.get( null ) );
+ qpm = map.get( null );
+ assertEquals( 1, qpm.subMap.size() );
+ assertTrue( qpm.subMap.get( "a" ) != null );
+ assertTrue( qpm.subMap.get( "a" ).terminal );
+ assertEquals( 1F, qpm.subMap.get( "a" ).boost );
+
+ // phraseHighlight = false, fieldMatch = true
+ fq = new FieldQuery( query, false, true );
+ map = fq.rootMaps;
+ assertEquals( 1, map.size() );
+ assertNull( map.get( null ) );
+ assertNotNull( map.get( F ) );
+ qpm = map.get( F );
+ assertEquals( 1, qpm.subMap.size() );
+ assertTrue( qpm.subMap.get( "a" ) != null );
+ assertTrue( qpm.subMap.get( "a" ).terminal );
+ assertEquals( 1F, qpm.subMap.get( "a" ).boost );
+
+ // phraseHighlight = false, fieldMatch = false
+ fq = new FieldQuery( query, false, false );
+ map = fq.rootMaps;
+ assertEquals( 1, map.size() );
+ assertNull( map.get( F ) );
+ assertNotNull( map.get( null ) );
+ qpm = map.get( null );
+ assertEquals( 1, qpm.subMap.size() );
+ assertTrue( qpm.subMap.get( "a" ) != null );
+ assertTrue( qpm.subMap.get( "a" ).terminal );
+ assertEquals( 1F, qpm.subMap.get( "a" ).boost );
+
+ // boost != 1
+ query = tq( 2, "a" );
+ fq = new FieldQuery( query, true, true );
+ map = fq.rootMaps;
+ qpm = map.get( F );
+ assertEquals( 2F, qpm.subMap.get( "a" ).boost );
+ }
+
+ public void testQueryPhraseMap1Phrase() throws Exception {
+ Query query = pqF( "a", "b" );
+
+ // phraseHighlight = true, fieldMatch = true
+ FieldQuery fq = new FieldQuery( query, true, true );
+ Map<String, QueryPhraseMap> map = fq.rootMaps;
+ assertEquals( 1, map.size() );
+ assertNull( map.get( null ) );
+ assertNotNull( map.get( F ) );
+ QueryPhraseMap qpm = map.get( F );
+ assertEquals( 1, qpm.subMap.size() );
+ assertNotNull( qpm.subMap.get( "a" ) );
+ QueryPhraseMap qpm2 = qpm.subMap.get( "a" );
+ assertFalse( qpm2.terminal );
+ assertEquals( 1, qpm2.subMap.size() );
+ assertNotNull( qpm2.subMap.get( "b" ) );
+ QueryPhraseMap qpm3 = qpm2.subMap.get( "b" );
+ assertTrue( qpm3.terminal );
+ assertEquals( 1F, qpm3.boost );
+
+ // phraseHighlight = true, fieldMatch = false
+ fq = new FieldQuery( query, true, false );
+ map = fq.rootMaps;
+ assertEquals( 1, map.size() );
+ assertNull( map.get( F ) );
+ assertNotNull( map.get( null ) );
+ qpm = map.get( null );
+ assertEquals( 1, qpm.subMap.size() );
+ assertNotNull( qpm.subMap.get( "a" ) );
+ qpm2 = qpm.subMap.get( "a" );
+ assertFalse( qpm2.terminal );
+ assertEquals( 1, qpm2.subMap.size() );
+ assertNotNull( qpm2.subMap.get( "b" ) );
+ qpm3 = qpm2.subMap.get( "b" );
+ assertTrue( qpm3.terminal );
+ assertEquals( 1F, qpm3.boost );
+
+ // phraseHighlight = false, fieldMatch = true
+ fq = new FieldQuery( query, false, true );
+ map = fq.rootMaps;
+ assertEquals( 1, map.size() );
+ assertNull( map.get( null ) );
+ assertNotNull( map.get( F ) );
+ qpm = map.get( F );
+ assertEquals( 2, qpm.subMap.size() );
+ assertNotNull( qpm.subMap.get( "a" ) );
+ qpm2 = qpm.subMap.get( "a" );
+ assertTrue( qpm2.terminal );
+ assertEquals( 1F, qpm2.boost );
+ assertEquals( 1, qpm2.subMap.size() );
+ assertNotNull( qpm2.subMap.get( "b" ) );
+ qpm3 = qpm2.subMap.get( "b" );
+ assertTrue( qpm3.terminal );
+ assertEquals( 1F, qpm3.boost );
+
+ assertNotNull( qpm.subMap.get( "b" ) );
+ qpm2 = qpm.subMap.get( "b" );
+ assertTrue( qpm2.terminal );
+ assertEquals( 1F, qpm2.boost );
+
+ // phraseHighlight = false, fieldMatch = false
+ fq = new FieldQuery( query, false, false );
+ map = fq.rootMaps;
+ assertEquals( 1, map.size() );
+ assertNull( map.get( F ) );
+ assertNotNull( map.get( null ) );
+ qpm = map.get( null );
+ assertEquals( 2, qpm.subMap.size() );
+ assertNotNull( qpm.subMap.get( "a" ) );
+ qpm2 = qpm.subMap.get( "a" );
+ assertTrue( qpm2.terminal );
+ assertEquals( 1F, qpm2.boost );
+ assertEquals( 1, qpm2.subMap.size() );
+ assertNotNull( qpm2.subMap.get( "b" ) );
+ qpm3 = qpm2.subMap.get( "b" );
+ assertTrue( qpm3.terminal );
+ assertEquals( 1F, qpm3.boost );
+
+ assertNotNull( qpm.subMap.get( "b" ) );
+ qpm2 = qpm.subMap.get( "b" );
+ assertTrue( qpm2.terminal );
+ assertEquals( 1F, qpm2.boost );
+
+ // boost != 1
+ query = pqF( 2, "a", "b" );
+ // phraseHighlight = false, fieldMatch = false
+ fq = new FieldQuery( query, false, false );
+ map = fq.rootMaps;
+ qpm = map.get( null );
+ qpm2 = qpm.subMap.get( "a" );
+ assertEquals( 2F, qpm2.boost );
+ qpm3 = qpm2.subMap.get( "b" );
+ assertEquals( 2F, qpm3.boost );
+ qpm2 = qpm.subMap.get( "b" );
+ assertEquals( 2F, qpm2.boost );
+ }
+
+ public void testQueryPhraseMap1PhraseAnother() throws Exception {
+ Query query = pqF( "search", "engines" );
+
+ // phraseHighlight = true, fieldMatch = true
+ FieldQuery fq = new FieldQuery( query, true, true );
+ Map<String, QueryPhraseMap> map = fq.rootMaps;
+ assertEquals( 1, map.size() );
+ assertNull( map.get( null ) );
+ assertNotNull( map.get( F ) );
+ QueryPhraseMap qpm = map.get( F );
+ assertEquals( 1, qpm.subMap.size() );
+ assertNotNull( qpm.subMap.get( "search" ) );
+ QueryPhraseMap qpm2 = qpm.subMap.get( "search" );
+ assertFalse( qpm2.terminal );
+ assertEquals( 1, qpm2.subMap.size() );
+ assertNotNull( qpm2.subMap.get( "engines" ) );
+ QueryPhraseMap qpm3 = qpm2.subMap.get( "engines" );
+ assertTrue( qpm3.terminal );
+ assertEquals( 1F, qpm3.boost );
+ }
+
+ public void testQueryPhraseMap2Phrases() throws Exception {
+ BooleanQuery query = new BooleanQuery();
+ query.add( pqF( "a", "b" ), Occur.SHOULD );
+ query.add( pqF( 2, "c", "d" ), Occur.SHOULD );
+
+ // phraseHighlight = true, fieldMatch = true
+ FieldQuery fq = new FieldQuery( query, true, true );
+ Map<String, QueryPhraseMap> map = fq.rootMaps;
+ assertEquals( 1, map.size() );
+ assertNull( map.get( null ) );
+ assertNotNull( map.get( F ) );
+ QueryPhraseMap qpm = map.get( F );
+ assertEquals( 2, qpm.subMap.size() );
+
+ // "a b"
+ assertNotNull( qpm.subMap.get( "a" ) );
+ QueryPhraseMap qpm2 = qpm.subMap.get( "a" );
+ assertFalse( qpm2.terminal );
+ assertEquals( 1, qpm2.subMap.size() );
+ assertNotNull( qpm2.subMap.get( "b" ) );
+ QueryPhraseMap qpm3 = qpm2.subMap.get( "b" );
+ assertTrue( qpm3.terminal );
+ assertEquals( 1F, qpm3.boost );
+
+ // "c d"^2
+ assertNotNull( qpm.subMap.get( "c" ) );
+ qpm2 = qpm.subMap.get( "c" );
+ assertFalse( qpm2.terminal );
+ assertEquals( 1, qpm2.subMap.size() );
+ assertNotNull( qpm2.subMap.get( "d" ) );
+ qpm3 = qpm2.subMap.get( "d" );
+ assertTrue( qpm3.terminal );
+ assertEquals( 2F, qpm3.boost );
+ }
+
+ public void testQueryPhraseMap2PhrasesFields() throws Exception {
+ BooleanQuery query = new BooleanQuery();
+ query.add( pq( F1, "a", "b" ), Occur.SHOULD );
+ query.add( pq( 2F, F2, "c", "d" ), Occur.SHOULD );
+
+ // phraseHighlight = true, fieldMatch = true
+ FieldQuery fq = new FieldQuery( query, true, true );
+ Map<String, QueryPhraseMap> map = fq.rootMaps;
+ assertEquals( 2, map.size() );
+ assertNull( map.get( null ) );
+
+ // "a b"
+ assertNotNull( map.get( F1 ) );
+ QueryPhraseMap qpm = map.get( F1 );
+ assertEquals( 1, qpm.subMap.size() );
+ assertNotNull( qpm.subMap.get( "a" ) );
+ QueryPhraseMap qpm2 = qpm.subMap.get( "a" );
+ assertFalse( qpm2.terminal );
+ assertEquals( 1, qpm2.subMap.size() );
+ assertNotNull( qpm2.subMap.get( "b" ) );
+ QueryPhraseMap qpm3 = qpm2.subMap.get( "b" );
+ assertTrue( qpm3.terminal );
+ assertEquals( 1F, qpm3.boost );
+
+ // "c d"^2
+ assertNotNull( map.get( F2 ) );
+ qpm = map.get( F2 );
+ assertEquals( 1, qpm.subMap.size() );
+ assertNotNull( qpm.subMap.get( "c" ) );
+ qpm2 = qpm.subMap.get( "c" );
+ assertFalse( qpm2.terminal );
+ assertEquals( 1, qpm2.subMap.size() );
+ assertNotNull( qpm2.subMap.get( "d" ) );
+ qpm3 = qpm2.subMap.get( "d" );
+ assertTrue( qpm3.terminal );
+ assertEquals( 2F, qpm3.boost );
+
+ // phraseHighlight = true, fieldMatch = false
+ fq = new FieldQuery( query, true, false );
+ map = fq.rootMaps;
+ assertEquals( 1, map.size() );
+ assertNull( map.get( F1 ) );
+ assertNull( map.get( F2 ) );
+ assertNotNull( map.get( null ) );
+ qpm = map.get( null );
+ assertEquals( 2, qpm.subMap.size() );
+
+ // "a b"
+ assertNotNull( qpm.subMap.get( "a" ) );
+ qpm2 = qpm.subMap.get( "a" );
+ assertFalse( qpm2.terminal );
+ assertEquals( 1, qpm2.subMap.size() );
+ assertNotNull( qpm2.subMap.get( "b" ) );
+ qpm3 = qpm2.subMap.get( "b" );
+ assertTrue( qpm3.terminal );
+ assertEquals( 1F, qpm3.boost );
+
+ // "c d"^2
+ assertNotNull( qpm.subMap.get( "c" ) );
+ qpm2 = qpm.subMap.get( "c" );
+ assertFalse( qpm2.terminal );
+ assertEquals( 1, qpm2.subMap.size() );
+ assertNotNull( qpm2.subMap.get( "d" ) );
+ qpm3 = qpm2.subMap.get( "d" );
+ assertTrue( qpm3.terminal );
+ assertEquals( 2F, qpm3.boost );
+ }
+
+ /*
+ * <t>...terminal
+ *
+ * a-b-c-<t>
+ * +-d-<t>
+ * b-c-d-<t>
+ * +-d-<t>
+ */
+ public void testQueryPhraseMapOverlapPhrases() throws Exception {
+ BooleanQuery query = new BooleanQuery();
+ query.add( pqF( "a", "b", "c" ), Occur.SHOULD );
+ query.add( pqF( 2, "b", "c", "d" ), Occur.SHOULD );
+ query.add( pqF( 3, "b", "d" ), Occur.SHOULD );
+
+ // phraseHighlight = true, fieldMatch = true
+ FieldQuery fq = new FieldQuery( query, true, true );
+ Map<String, QueryPhraseMap> map = fq.rootMaps;
+ assertEquals( 1, map.size() );
+ assertNull( map.get( null ) );
+ assertNotNull( map.get( F ) );
+ QueryPhraseMap qpm = map.get( F );
+ assertEquals( 2, qpm.subMap.size() );
+
+ // "a b c"
+ assertNotNull( qpm.subMap.get( "a" ) );
+ QueryPhraseMap qpm2 = qpm.subMap.get( "a" );
+ assertFalse( qpm2.terminal );
+ assertEquals( 1, qpm2.subMap.size() );
+ assertNotNull( qpm2.subMap.get( "b" ) );
+ QueryPhraseMap qpm3 = qpm2.subMap.get( "b" );
+ assertFalse( qpm3.terminal );
+ assertEquals( 1, qpm3.subMap.size() );
+ assertNotNull( qpm3.subMap.get( "c" ) );
+ QueryPhraseMap qpm4 = qpm3.subMap.get( "c" );
+ assertTrue( qpm4.terminal );
+ assertEquals( 1F, qpm4.boost );
+ assertNotNull( qpm4.subMap.get( "d" ) );
+ QueryPhraseMap qpm5 = qpm4.subMap.get( "d" );
+ assertTrue( qpm5.terminal );
+ assertEquals( 1F, qpm5.boost );
+
+ // "b c d"^2, "b d"^3
+ assertNotNull( qpm.subMap.get( "b" ) );
+ qpm2 = qpm.subMap.get( "b" );
+ assertFalse( qpm2.terminal );
+ assertEquals( 2, qpm2.subMap.size() );
+ assertNotNull( qpm2.subMap.get( "c" ) );
+ qpm3 = qpm2.subMap.get( "c" );
+ assertFalse( qpm3.terminal );
+ assertEquals( 1, qpm3.subMap.size() );
+ assertNotNull( qpm3.subMap.get( "d" ) );
+ qpm4 = qpm3.subMap.get( "d" );
+ assertTrue( qpm4.terminal );
+ assertEquals( 2F, qpm4.boost );
+ assertNotNull( qpm2.subMap.get( "d" ) );
+ qpm3 = qpm2.subMap.get( "d" );
+ assertTrue( qpm3.terminal );
+ assertEquals( 3F, qpm3.boost );
+ }
+
+ /*
+ * <t>...terminal
+ *
+ * a-b-<t>
+ * +-c-<t>
+ */
+ public void testQueryPhraseMapOverlapPhrases2() throws Exception {
+ BooleanQuery query = new BooleanQuery();
+ query.add( pqF( "a", "b" ), Occur.SHOULD );
+ query.add( pqF( 2, "a", "b", "c" ), Occur.SHOULD );
+
+ // phraseHighlight = true, fieldMatch = true
+ FieldQuery fq = new FieldQuery( query, true, true );
+ Map<String, QueryPhraseMap> map = fq.rootMaps;
+ assertEquals( 1, map.size() );
+ assertNull( map.get( null ) );
+ assertNotNull( map.get( F ) );
+ QueryPhraseMap qpm = map.get( F );
+ assertEquals( 1, qpm.subMap.size() );
+
+ // "a b"
+ assertNotNull( qpm.subMap.get( "a" ) );
+ QueryPhraseMap qpm2 = qpm.subMap.get( "a" );
+ assertFalse( qpm2.terminal );
+ assertEquals( 1, qpm2.subMap.size() );
+ assertNotNull( qpm2.subMap.get( "b" ) );
+ QueryPhraseMap qpm3 = qpm2.subMap.get( "b" );
+ assertTrue( qpm3.terminal );
+ assertEquals( 1F, qpm3.boost );
+
+ // "a b c"^2
+ assertEquals( 1, qpm3.subMap.size() );
+ assertNotNull( qpm3.subMap.get( "c" ) );
+ QueryPhraseMap qpm4 = qpm3.subMap.get( "c" );
+ assertTrue( qpm4.terminal );
+ assertEquals( 2F, qpm4.boost );
+ }
+
+ /*
+ * <t>...terminal
+ *
+ * a-a-a-<t>
+ * +-a-<t>
+ * +-a-<t>
+ * +-a-<t>
+ */
+ public void testQueryPhraseMapOverlapPhrases3() throws Exception {
+ BooleanQuery query = new BooleanQuery();
+ query.add( pqF( "a", "a", "a", "a" ), Occur.SHOULD );
+ query.add( pqF( 2, "a", "a", "a" ), Occur.SHOULD );
+
+ // phraseHighlight = true, fieldMatch = true
+ FieldQuery fq = new FieldQuery( query, true, true );
+ Map<String, QueryPhraseMap> map = fq.rootMaps;
+ assertEquals( 1, map.size() );
+ assertNull( map.get( null ) );
+ assertNotNull( map.get( F ) );
+ QueryPhraseMap qpm = map.get( F );
+ assertEquals( 1, qpm.subMap.size() );
+
+ // "a a a"
+ assertNotNull( qpm.subMap.get( "a" ) );
+ QueryPhraseMap qpm2 = qpm.subMap.get( "a" );
+ assertFalse( qpm2.terminal );
+ assertEquals( 1, qpm2.subMap.size() );
+ assertNotNull( qpm2.subMap.get( "a" ) );
+ QueryPhraseMap qpm3 = qpm2.subMap.get( "a" );
+ assertFalse( qpm3.terminal );
+ assertEquals( 1, qpm3.subMap.size() );
+ assertNotNull( qpm3.subMap.get( "a" ) );
+ QueryPhraseMap qpm4 = qpm3.subMap.get( "a" );
+ assertTrue( qpm4.terminal );
+
+ // "a a a a"
+ assertEquals( 1, qpm4.subMap.size() );
+ assertNotNull( qpm4.subMap.get( "a" ) );
+ QueryPhraseMap qpm5 = qpm4.subMap.get( "a" );
+ assertTrue( qpm5.terminal );
+
+ // "a a a a a"
+ assertEquals( 1, qpm5.subMap.size() );
+ assertNotNull( qpm5.subMap.get( "a" ) );
+ QueryPhraseMap qpm6 = qpm5.subMap.get( "a" );
+ assertTrue( qpm6.terminal );
+
+ // "a a a a a a"
+ assertEquals( 1, qpm6.subMap.size() );
+ assertNotNull( qpm6.subMap.get( "a" ) );
+ QueryPhraseMap qpm7 = qpm6.subMap.get( "a" );
+ assertTrue( qpm7.terminal );
+ }
+
+ public void testQueryPhraseMapOverlap2gram() throws Exception {
+ Query query = paB.parse( "abc AND bcd" );
+
+ // phraseHighlight = true, fieldMatch = true
+ FieldQuery fq = new FieldQuery( query, true, true );
+ Map<String, QueryPhraseMap> map = fq.rootMaps;
+ assertEquals( 1, map.size() );
+ assertNull( map.get( null ) );
+ assertNotNull( map.get( F ) );
+ QueryPhraseMap qpm = map.get( F );
+ assertEquals( 2, qpm.subMap.size() );
+
+ // "ab bc"
+ assertNotNull( qpm.subMap.get( "ab" ) );
+ QueryPhraseMap qpm2 = qpm.subMap.get( "ab" );
+ assertFalse( qpm2.terminal );
+ assertEquals( 1, qpm2.subMap.size() );
+ assertNotNull( qpm2.subMap.get( "bc" ) );
+ QueryPhraseMap qpm3 = qpm2.subMap.get( "bc" );
+ assertTrue( qpm3.terminal );
+ assertEquals( 1F, qpm3.boost );
+
+ // "ab bc cd"
+ assertEquals( 1, qpm3.subMap.size() );
+ assertNotNull( qpm3.subMap.get( "cd" ) );
+ QueryPhraseMap qpm4 = qpm3.subMap.get( "cd" );
+ assertTrue( qpm4.terminal );
+ assertEquals( 1F, qpm4.boost );
+
+ // "bc cd"
+ assertNotNull( qpm.subMap.get( "bc" ) );
+ qpm2 = qpm.subMap.get( "bc" );
+ assertFalse( qpm2.terminal );
+ assertEquals( 1, qpm2.subMap.size() );
+ assertNotNull( qpm2.subMap.get( "cd" ) );
+ qpm3 = qpm2.subMap.get( "cd" );
+ assertTrue( qpm3.terminal );
+ assertEquals( 1F, qpm3.boost );
+
+ // phraseHighlight = false, fieldMatch = true
+ fq = new FieldQuery( query, false, true );
+ map = fq.rootMaps;
+ assertEquals( 1, map.size() );
+ assertNull( map.get( null ) );
+ assertNotNull( map.get( F ) );
+ qpm = map.get( F );
+ assertEquals( 3, qpm.subMap.size() );
+
+ // "ab bc"
+ assertNotNull( qpm.subMap.get( "ab" ) );
+ qpm2 = qpm.subMap.get( "ab" );
+ assertTrue( qpm2.terminal );
+ assertEquals( 1F, qpm2.boost );
+ assertEquals( 1, qpm2.subMap.size() );
+ assertNotNull( qpm2.subMap.get( "bc" ) );
+ qpm3 = qpm2.subMap.get( "bc" );
+ assertTrue( qpm3.terminal );
+ assertEquals( 1F, qpm3.boost );
+
+ // "ab bc cd"
+ assertEquals( 1, qpm3.subMap.size() );
+ assertNotNull( qpm3.subMap.get( "cd" ) );
+ qpm4 = qpm3.subMap.get( "cd" );
+ assertTrue( qpm4.terminal );
+ assertEquals( 1F, qpm4.boost );
+
+ // "bc cd"
+ assertNotNull( qpm.subMap.get( "bc" ) );
+ qpm2 = qpm.subMap.get( "bc" );
+ assertTrue( qpm2.terminal );
+ assertEquals( 1F, qpm2.boost );
+ assertEquals( 1, qpm2.subMap.size() );
+ assertNotNull( qpm2.subMap.get( "cd" ) );
+ qpm3 = qpm2.subMap.get( "cd" );
+ assertTrue( qpm3.terminal );
+ assertEquals( 1F, qpm3.boost );
+
+ // "cd"
+ assertNotNull( qpm.subMap.get( "cd" ) );
+ qpm2 = qpm.subMap.get( "cd" );
+ assertTrue( qpm2.terminal );
+ assertEquals( 1F, qpm2.boost );
+ assertEquals( 0, qpm2.subMap.size() );
+ }
+
+ public void testSearchPhrase() throws Exception {
+ Query query = pqF( "a", "b", "c" );
+
+ // phraseHighlight = true, fieldMatch = true
+ FieldQuery fq = new FieldQuery( query, true, true );
+
+ // "a"
+ List<TermInfo> phraseCandidate = new ArrayList<TermInfo>();
+ phraseCandidate.add( new TermInfo( "a", 0, 1, 0 ) );
+ assertNull( fq.searchPhrase( F, phraseCandidate ) );
+ // "a b"
+ phraseCandidate.add( new TermInfo( "b", 2, 3, 1 ) );
+ assertNull( fq.searchPhrase( F, phraseCandidate ) );
+ // "a b c"
+ phraseCandidate.add( new TermInfo( "c", 4, 5, 2 ) );
+ assertNotNull( fq.searchPhrase( F, phraseCandidate ) );
+ assertNull( fq.searchPhrase( "x", phraseCandidate ) );
+
+ // phraseHighlight = true, fieldMatch = false
+ fq = new FieldQuery( query, true, false );
+
+ // "a b c"
+ assertNotNull( fq.searchPhrase( F, phraseCandidate ) );
+ assertNotNull( fq.searchPhrase( "x", phraseCandidate ) );
+
+ // phraseHighlight = false, fieldMatch = true
+ fq = new FieldQuery( query, false, true );
+
+ // "a"
+ phraseCandidate.clear();
+ phraseCandidate.add( new TermInfo( "a", 0, 1, 0 ) );
+ assertNotNull( fq.searchPhrase( F, phraseCandidate ) );
+ // "a b"
+ phraseCandidate.add( new TermInfo( "b", 2, 3, 1 ) );
+ assertNull( fq.searchPhrase( F, phraseCandidate ) );
+ // "a b c"
+ phraseCandidate.add( new TermInfo( "c", 4, 5, 2 ) );
+ assertNotNull( fq.searchPhrase( F, phraseCandidate ) );
+ assertNull( fq.searchPhrase( "x", phraseCandidate ) );
+ }
+
+ public void testSearchPhraseSlop() throws Exception {
+ // "a b c"~0
+ Query query = pqF( "a", "b", "c" );
+
+ // phraseHighlight = true, fieldMatch = true
+ FieldQuery fq = new FieldQuery( query, true, true );
+
+ // "a b c" w/ position-gap = 2
+ List<TermInfo> phraseCandidate = new ArrayList<TermInfo>();
+ phraseCandidate.add( new TermInfo( "a", 0, 1, 0 ) );
+ phraseCandidate.add( new TermInfo( "b", 2, 3, 2 ) );
+ phraseCandidate.add( new TermInfo( "c", 4, 5, 4 ) );
+ assertNull( fq.searchPhrase( F, phraseCandidate ) );
+
+ // "a b c"~1
+ query = pqF( 1F, 1, "a", "b", "c" );
+
+ // phraseHighlight = true, fieldMatch = true
+ fq = new FieldQuery( query, true, true );
+
+ // "a b c" w/ position-gap = 2
+ assertNotNull( fq.searchPhrase( F, phraseCandidate ) );
+
+ // "a b c" w/ position-gap = 3
+ phraseCandidate.clear();
+ phraseCandidate.add( new TermInfo( "a", 0, 1, 0 ) );
+ phraseCandidate.add( new TermInfo( "b", 2, 3, 3 ) );
+ phraseCandidate.add( new TermInfo( "c", 4, 5, 6 ) );
+ assertNull( fq.searchPhrase( F, phraseCandidate ) );
+ }
+}
Propchange: lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/FieldQueryTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/FieldTermStackTest.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/FieldTermStackTest.java?rev=792542&view=auto
==============================================================================
--- lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/FieldTermStackTest.java (added)
+++ lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/FieldTermStackTest.java Thu Jul 9 13:06:51 2009
@@ -0,0 +1,166 @@
+package org.apache.lucene.search.vectorhighlight;
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.lucene.search.BooleanQuery;
+import org.apache.lucene.search.BooleanClause.Occur;
+
+public class FieldTermStackTest extends AbstractTestCase {
+
+ public void test1Term() throws Exception {
+ makeIndex();
+
+ FieldQuery fq = new FieldQuery( tq( "a" ), true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ assertEquals( 6, stack.termList.size() );
+ assertEquals( "a(0,1,0)", stack.pop().toString() );
+ assertEquals( "a(2,3,1)", stack.pop().toString() );
+ assertEquals( "a(4,5,2)", stack.pop().toString() );
+ assertEquals( "a(12,13,6)", stack.pop().toString() );
+ assertEquals( "a(28,29,14)", stack.pop().toString() );
+ assertEquals( "a(32,33,16)", stack.pop().toString() );
+ }
+
+ public void test2Terms() throws Exception {
+ makeIndex();
+
+ BooleanQuery query = new BooleanQuery();
+ query.add( tq( "b" ), Occur.SHOULD );
+ query.add( tq( "c" ), Occur.SHOULD );
+ FieldQuery fq = new FieldQuery( query, true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ assertEquals( 8, stack.termList.size() );
+ assertEquals( "b(6,7,3)", stack.pop().toString() );
+ assertEquals( "b(8,9,4)", stack.pop().toString() );
+ assertEquals( "c(10,11,5)", stack.pop().toString() );
+ assertEquals( "b(14,15,7)", stack.pop().toString() );
+ assertEquals( "b(16,17,8)", stack.pop().toString() );
+ assertEquals( "c(18,19,9)", stack.pop().toString() );
+ assertEquals( "b(26,27,13)", stack.pop().toString() );
+ assertEquals( "b(30,31,15)", stack.pop().toString() );
+ }
+
+ public void test1Phrase() throws Exception {
+ makeIndex();
+
+ FieldQuery fq = new FieldQuery( pqF( "c", "d" ), true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ assertEquals( 3, stack.termList.size() );
+ assertEquals( "c(10,11,5)", stack.pop().toString() );
+ assertEquals( "c(18,19,9)", stack.pop().toString() );
+ assertEquals( "d(20,21,10)", stack.pop().toString() );
+ }
+
+ private void makeIndex() throws Exception {
+ // 111111111122222
+ // 0123456789012345678901234 (offsets)
+ // a a a b b c a b b c d e f
+ // 0 1 2 3 4 5 6 7 8 9101112 (position)
+ String value1 = "a a a b b c a b b c d e f";
+ // 222233333
+ // 678901234 (offsets)
+ // b a b a f
+ //1314151617 (position)
+ String value2 = "b a b a f";
+
+ make1dmfIndex( value1, value2 );
+ }
+
+ public void test1TermB() throws Exception {
+ makeIndexB();
+
+ FieldQuery fq = new FieldQuery( tq( "ab" ), true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ assertEquals( 2, stack.termList.size() );
+ assertEquals( "ab(2,4,2)", stack.pop().toString() );
+ assertEquals( "ab(6,8,6)", stack.pop().toString() );
+ }
+
+ public void test2TermsB() throws Exception {
+ makeIndexB();
+
+ BooleanQuery query = new BooleanQuery();
+ query.add( tq( "bc" ), Occur.SHOULD );
+ query.add( tq( "ef" ), Occur.SHOULD );
+ FieldQuery fq = new FieldQuery( query, true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ assertEquals( 3, stack.termList.size() );
+ assertEquals( "bc(4,6,4)", stack.pop().toString() );
+ assertEquals( "bc(8,10,8)", stack.pop().toString() );
+ assertEquals( "ef(11,13,11)", stack.pop().toString() );
+ }
+
+ public void test1PhraseB() throws Exception {
+ makeIndexB();
+
+ FieldQuery fq = new FieldQuery( pqF( "ab", "bb" ), true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ assertEquals( 4, stack.termList.size() );
+ assertEquals( "ab(2,4,2)", stack.pop().toString() );
+ assertEquals( "bb(3,5,3)", stack.pop().toString() );
+ assertEquals( "ab(6,8,6)", stack.pop().toString() );
+ assertEquals( "bb(7,9,7)", stack.pop().toString() );
+ }
+
+ private void makeIndexB() throws Exception {
+ // 1 11 11
+ // 01 12 23 34 45 56 67 78 89 90 01 12 (offsets)
+ // aa|aa|ab|bb|bc|ca|ab|bb|bc|cd|de|ef
+ // 0 1 2 3 4 5 6 7 8 9 10 11 (position)
+ String value = "aaabbcabbcdef";
+
+ make1dmfIndexB( value );
+ }
+
+ public void test1PhraseShortMV() throws Exception {
+ makeIndexShortMV();
+
+ FieldQuery fq = new FieldQuery( tq( "d" ), true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ assertEquals( 1, stack.termList.size() );
+ assertEquals( "d(6,7,3)", stack.pop().toString() );
+ }
+
+ public void test1PhraseLongMV() throws Exception {
+ makeIndexLongMV();
+
+ FieldQuery fq = new FieldQuery( pqF( "search", "engines" ), true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ assertEquals( 4, stack.termList.size() );
+ assertEquals( "search(102,108,14)", stack.pop().toString() );
+ assertEquals( "engines(109,116,15)", stack.pop().toString() );
+ assertEquals( "search(157,163,24)", stack.pop().toString() );
+ assertEquals( "engines(164,171,25)", stack.pop().toString() );
+ }
+/*
+ * ----------------------------------
+ * THIS TEST DEPENDS ON LUCENE-1448
+ * UNCOMMENT WHEN IT IS COMMITTED.
+ * ----------------------------------
+ public void test1PhraseMVB() throws Exception {
+ makeIndexLongMVB();
+
+ FieldQuery fq = new FieldQuery( pqF( "sp", "pe", "ee", "ed" ), true, true ); // "speed" -(2gram)-> "sp","pe","ee","ed"
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ assertEquals( 4, stack.termList.size() );
+ assertEquals( "sp(88,90,61)", stack.pop().toString() );
+ assertEquals( "pe(89,91,62)", stack.pop().toString() );
+ assertEquals( "ee(90,92,63)", stack.pop().toString() );
+ assertEquals( "ed(91,93,64)", stack.pop().toString() );
+ }
+*/
+}
Propchange: lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/FieldTermStackTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/IndexTimeSynonymTest.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/IndexTimeSynonymTest.java?rev=792542&view=auto
==============================================================================
--- lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/IndexTimeSynonymTest.java (added)
+++ lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/IndexTimeSynonymTest.java Thu Jul 9 13:06:51 2009
@@ -0,0 +1,308 @@
+package org.apache.lucene.search.vectorhighlight;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.IOException;
+import java.io.Reader;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.Token;
+import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.search.BooleanQuery;
+import org.apache.lucene.search.BooleanClause.Occur;
+
+public class IndexTimeSynonymTest extends AbstractTestCase {
+
+ public void testFieldTermStackIndex1wSearch1term() throws Exception {
+ makeIndex1w();
+
+ FieldQuery fq = new FieldQuery( tq( "Mac" ), true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ assertEquals( 1, stack.termList.size() );
+ assertEquals( "Mac(11,20,3)", stack.pop().toString() );
+ }
+
+ public void testFieldTermStackIndex1wSearch2terms() throws Exception {
+ makeIndex1w();
+
+ BooleanQuery bq = new BooleanQuery();
+ bq.add( tq( "Mac" ), Occur.SHOULD );
+ bq.add( tq( "MacBook" ), Occur.SHOULD );
+ FieldQuery fq = new FieldQuery( bq, true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ assertEquals( 2, stack.termList.size() );
+ Set<String> expectedSet = new HashSet<String>();
+ expectedSet.add( "Mac(11,20,3)" );
+ expectedSet.add( "MacBook(11,20,3)" );
+ assertTrue( expectedSet.contains( stack.pop().toString() ) );
+ assertTrue( expectedSet.contains( stack.pop().toString() ) );
+ }
+
+ public void testFieldTermStackIndex1w2wSearch1term() throws Exception {
+ makeIndex1w2w();
+
+ FieldQuery fq = new FieldQuery( tq( "pc" ), true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ assertEquals( 1, stack.termList.size() );
+ assertEquals( "pc(3,5,1)", stack.pop().toString() );
+ }
+
+ public void testFieldTermStackIndex1w2wSearch1phrase() throws Exception {
+ makeIndex1w2w();
+
+ FieldQuery fq = new FieldQuery( pqF( "personal", "computer" ), true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ assertEquals( 2, stack.termList.size() );
+ assertEquals( "personal(3,5,1)", stack.pop().toString() );
+ assertEquals( "computer(3,5,2)", stack.pop().toString() );
+ }
+
+ public void testFieldTermStackIndex1w2wSearch1partial() throws Exception {
+ makeIndex1w2w();
+
+ FieldQuery fq = new FieldQuery( tq( "computer" ), true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ assertEquals( 1, stack.termList.size() );
+ assertEquals( "computer(3,5,2)", stack.pop().toString() );
+ }
+
+ public void testFieldTermStackIndex1w2wSearch1term1phrase() throws Exception {
+ makeIndex1w2w();
+
+ BooleanQuery bq = new BooleanQuery();
+ bq.add( tq( "pc" ), Occur.SHOULD );
+ bq.add( pqF( "personal", "computer" ), Occur.SHOULD );
+ FieldQuery fq = new FieldQuery( bq, true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ assertEquals( 3, stack.termList.size() );
+ Set<String> expectedSet = new HashSet<String>();
+ expectedSet.add( "pc(3,5,1)" );
+ expectedSet.add( "personal(3,5,1)" );
+ assertTrue( expectedSet.contains( stack.pop().toString() ) );
+ assertTrue( expectedSet.contains( stack.pop().toString() ) );
+ assertEquals( "computer(3,5,2)", stack.pop().toString() );
+ }
+
+ public void testFieldTermStackIndex2w1wSearch1term() throws Exception {
+ makeIndex2w1w();
+
+ FieldQuery fq = new FieldQuery( tq( "pc" ), true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ assertEquals( 1, stack.termList.size() );
+ assertEquals( "pc(3,20,1)", stack.pop().toString() );
+ }
+
+ public void testFieldTermStackIndex2w1wSearch1phrase() throws Exception {
+ makeIndex2w1w();
+
+ FieldQuery fq = new FieldQuery( pqF( "personal", "computer" ), true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ assertEquals( 2, stack.termList.size() );
+ assertEquals( "personal(3,20,1)", stack.pop().toString() );
+ assertEquals( "computer(3,20,2)", stack.pop().toString() );
+ }
+
+ public void testFieldTermStackIndex2w1wSearch1partial() throws Exception {
+ makeIndex2w1w();
+
+ FieldQuery fq = new FieldQuery( tq( "computer" ), true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ assertEquals( 1, stack.termList.size() );
+ assertEquals( "computer(3,20,2)", stack.pop().toString() );
+ }
+
+ public void testFieldTermStackIndex2w1wSearch1term1phrase() throws Exception {
+ makeIndex2w1w();
+
+ BooleanQuery bq = new BooleanQuery();
+ bq.add( tq( "pc" ), Occur.SHOULD );
+ bq.add( pqF( "personal", "computer" ), Occur.SHOULD );
+ FieldQuery fq = new FieldQuery( bq, true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ assertEquals( 3, stack.termList.size() );
+ Set<String> expectedSet = new HashSet<String>();
+ expectedSet.add( "pc(3,20,1)" );
+ expectedSet.add( "personal(3,20,1)" );
+ assertTrue( expectedSet.contains( stack.pop().toString() ) );
+ assertTrue( expectedSet.contains( stack.pop().toString() ) );
+ assertEquals( "computer(3,20,2)", stack.pop().toString() );
+ }
+
+ public void testFieldPhraseListIndex1w2wSearch1phrase() throws Exception {
+ makeIndex1w2w();
+
+ FieldQuery fq = new FieldQuery( pqF( "personal", "computer" ), true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ FieldPhraseList fpl = new FieldPhraseList( stack, fq );
+ assertEquals( 1, fpl.phraseList.size() );
+ assertEquals( "personalcomputer(1.0)((3,5))", fpl.phraseList.get( 0 ).toString() );
+ assertEquals( 3, fpl.phraseList.get( 0 ).getStartOffset() );
+ assertEquals( 5, fpl.phraseList.get( 0 ).getEndOffset() );
+ }
+
+ public void testFieldPhraseListIndex1w2wSearch1partial() throws Exception {
+ makeIndex1w2w();
+
+ FieldQuery fq = new FieldQuery( tq( "computer" ), true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ FieldPhraseList fpl = new FieldPhraseList( stack, fq );
+ assertEquals( 1, fpl.phraseList.size() );
+ assertEquals( "computer(1.0)((3,5))", fpl.phraseList.get( 0 ).toString() );
+ assertEquals( 3, fpl.phraseList.get( 0 ).getStartOffset() );
+ assertEquals( 5, fpl.phraseList.get( 0 ).getEndOffset() );
+ }
+
+ public void testFieldPhraseListIndex1w2wSearch1term1phrase() throws Exception {
+ makeIndex1w2w();
+
+ BooleanQuery bq = new BooleanQuery();
+ bq.add( tq( "pc" ), Occur.SHOULD );
+ bq.add( pqF( "personal", "computer" ), Occur.SHOULD );
+ FieldQuery fq = new FieldQuery( bq, true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ FieldPhraseList fpl = new FieldPhraseList( stack, fq );
+ assertEquals( 1, fpl.phraseList.size() );
+ assertTrue( fpl.phraseList.get( 0 ).toString().indexOf( "(1.0)((3,5))" ) > 0 );
+ assertEquals( 3, fpl.phraseList.get( 0 ).getStartOffset() );
+ assertEquals( 5, fpl.phraseList.get( 0 ).getEndOffset() );
+ }
+
+ public void testFieldPhraseListIndex2w1wSearch1term() throws Exception {
+ makeIndex2w1w();
+
+ FieldQuery fq = new FieldQuery( tq( "pc" ), true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ FieldPhraseList fpl = new FieldPhraseList( stack, fq );
+ assertEquals( 1, fpl.phraseList.size() );
+ assertEquals( "pc(1.0)((3,20))", fpl.phraseList.get( 0 ).toString() );
+ assertEquals( 3, fpl.phraseList.get( 0 ).getStartOffset() );
+ assertEquals( 20, fpl.phraseList.get( 0 ).getEndOffset() );
+ }
+
+ public void testFieldPhraseListIndex2w1wSearch1phrase() throws Exception {
+ makeIndex2w1w();
+
+ FieldQuery fq = new FieldQuery( pqF( "personal", "computer" ), true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ FieldPhraseList fpl = new FieldPhraseList( stack, fq );
+ assertEquals( 1, fpl.phraseList.size() );
+ assertEquals( "personalcomputer(1.0)((3,20))", fpl.phraseList.get( 0 ).toString() );
+ assertEquals( 3, fpl.phraseList.get( 0 ).getStartOffset() );
+ assertEquals( 20, fpl.phraseList.get( 0 ).getEndOffset() );
+ }
+
+ public void testFieldPhraseListIndex2w1wSearch1partial() throws Exception {
+ makeIndex2w1w();
+
+ FieldQuery fq = new FieldQuery( tq( "computer" ), true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ FieldPhraseList fpl = new FieldPhraseList( stack, fq );
+ assertEquals( 1, fpl.phraseList.size() );
+ assertEquals( "computer(1.0)((3,20))", fpl.phraseList.get( 0 ).toString() );
+ assertEquals( 3, fpl.phraseList.get( 0 ).getStartOffset() );
+ assertEquals( 20, fpl.phraseList.get( 0 ).getEndOffset() );
+ }
+
+ public void testFieldPhraseListIndex2w1wSearch1term1phrase() throws Exception {
+ makeIndex2w1w();
+
+ BooleanQuery bq = new BooleanQuery();
+ bq.add( tq( "pc" ), Occur.SHOULD );
+ bq.add( pqF( "personal", "computer" ), Occur.SHOULD );
+ FieldQuery fq = new FieldQuery( bq, true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ FieldPhraseList fpl = new FieldPhraseList( stack, fq );
+ assertEquals( 1, fpl.phraseList.size() );
+ assertTrue( fpl.phraseList.get( 0 ).toString().indexOf( "(1.0)((3,20))" ) > 0 );
+ assertEquals( 3, fpl.phraseList.get( 0 ).getStartOffset() );
+ assertEquals( 20, fpl.phraseList.get( 0 ).getEndOffset() );
+ }
+
+ private void makeIndex1w() throws Exception {
+ // 11111111112
+ // 012345678901234567890
+ // I'll buy a Macintosh
+ // Mac
+ // MacBook
+ // 0 1 2 3
+ makeSynonymIndex( "I'll buy a Macintosh",
+ t("I'll",0,4),
+ t("buy",5,8),
+ t("a",9,10),
+ t("Macintosh",11,20),t("Mac",11,20,0),t("MacBook",11,20,0));
+ }
+
+ private void makeIndex1w2w() throws Exception {
+ // 1111111
+ // 01234567890123456
+ // My pc was broken
+ // personal computer
+ // 0 1 2 3
+ makeSynonymIndex( "My pc was broken",
+ t("My",0,2),
+ t("pc",3,5),t("personal",3,5,0),t("computer",3,5),
+ t("was",6,9),
+ t("broken",10,16));
+ }
+
+ private void makeIndex2w1w() throws Exception {
+ // 1111111111222222222233
+ // 01234567890123456789012345678901
+ // My personal computer was broken
+ // pc
+ // 0 1 2 3 4
+ makeSynonymIndex( "My personal computer was broken",
+ t("My",0,2),
+ t("personal",3,20),t("pc",3,20,0),t("computer",3,20),
+ t("was",21,24),
+ t("broken",25,31));
+ }
+
+ void makeSynonymIndex( String value, Token... tokens ) throws Exception {
+ Analyzer analyzer = new TokenArrayAnalyzer( tokens );
+ make1dmfIndex( analyzer, value );
+ }
+
+ public static Token t( String text, int startOffset, int endOffset ){
+ return t( text, startOffset, endOffset, 1 );
+ }
+
+ public static Token t( String text, int startOffset, int endOffset, int positionIncrement ){
+ Token token = new Token( text, startOffset, endOffset );
+ token.setPositionIncrement( positionIncrement );
+ return token;
+ }
+
+ public static class TokenArrayAnalyzer extends Analyzer {
+ Token[] tokens;
+ public TokenArrayAnalyzer( Token... tokens ){
+ this.tokens = tokens;
+ }
+ public TokenStream tokenStream(String fieldName, Reader reader) {
+ return new TokenStream(){
+ int p = 0;
+ public Token next( Token reusableToken ) throws IOException {
+ if( p >= tokens.length ) return null;
+ return tokens[p++];
+ }
+ };
+ }
+ }
+}
Propchange: lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/IndexTimeSynonymTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/ScoreOrderFragmentsBuilderTest.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/ScoreOrderFragmentsBuilderTest.java?rev=792542&view=auto
==============================================================================
--- lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/ScoreOrderFragmentsBuilderTest.java (added)
+++ lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/ScoreOrderFragmentsBuilderTest.java Thu Jul 9 13:06:51 2009
@@ -0,0 +1,43 @@
+package org.apache.lucene.search.vectorhighlight;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.lucene.search.Query;
+
+public class ScoreOrderFragmentsBuilderTest extends AbstractTestCase {
+
+ public void test3Frags() throws Exception {
+ FieldFragList ffl = ffl( "a c", "a b b b b b b b b b b b a b a b b b b b c a a b b" );
+ ScoreOrderFragmentsBuilder sofb = new ScoreOrderFragmentsBuilder();
+ String[] f = sofb.createFragments( reader, 0, F, ffl, 3 );
+ assertEquals( 3, f.length );
+ // check score order
+ assertEquals( "<b>c</b> <b>a</b> <b>a</b> b b", f[0] );
+ assertEquals( "b b <b>a</b> b <b>a</b> b b b b b ", f[1] );
+ assertEquals( "<b>a</b> b b b b b b b b b ", f[2] );
+ }
+
+ private FieldFragList ffl( String queryValue, String indexValue ) throws Exception {
+ make1d1fIndex( indexValue );
+ Query query = paW.parse( queryValue );
+ FieldQuery fq = new FieldQuery( query, true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ FieldPhraseList fpl = new FieldPhraseList( stack, fq );
+ return new SimpleFragListBuilder().createFieldFragList( fpl, 20 );
+ }
+}
Propchange: lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/ScoreOrderFragmentsBuilderTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/SimpleFragListBuilderTest.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/SimpleFragListBuilderTest.java?rev=792542&view=auto
==============================================================================
--- lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/SimpleFragListBuilderTest.java (added)
+++ lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/SimpleFragListBuilderTest.java Thu Jul 9 13:06:51 2009
@@ -0,0 +1,162 @@
+package org.apache.lucene.search.vectorhighlight;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.lucene.search.Query;
+
+public class SimpleFragListBuilderTest extends AbstractTestCase {
+
+ public void testNullFieldFragList() throws Exception {
+ SimpleFragListBuilder sflb = new SimpleFragListBuilder();
+ FieldFragList ffl = sflb.createFieldFragList( fpl( "a", "b c d" ), 100 );
+ assertEquals( 0, ffl.fragInfos.size() );
+ }
+
+ public void testTooSmallFragSize() throws Exception {
+ try{
+ SimpleFragListBuilder sflb = new SimpleFragListBuilder();
+ sflb.createFieldFragList( fpl( "a", "b c d" ), SimpleFragListBuilder.MIN_FRAG_CHAR_SIZE - 1 );
+ fail( "IllegalArgumentException must be thrown" );
+ }
+ catch ( IllegalArgumentException expected ) {
+ }
+ }
+
+ public void test1TermIndex() throws Exception {
+ SimpleFragListBuilder sflb = new SimpleFragListBuilder();
+ FieldFragList ffl = sflb.createFieldFragList( fpl( "a", "a" ), 100 );
+ assertEquals( 1, ffl.fragInfos.size() );
+ assertEquals( "subInfos=(a((0,1)))/1.0(0,100)", ffl.fragInfos.get( 0 ).toString() );
+ }
+
+ public void test2TermsIndex1Frag() throws Exception {
+ SimpleFragListBuilder sflb = new SimpleFragListBuilder();
+ FieldFragList ffl = sflb.createFieldFragList( fpl( "a", "a a" ), 100 );
+ assertEquals( 1, ffl.fragInfos.size() );
+ assertEquals( "subInfos=(a((0,1))a((2,3)))/2.0(0,100)", ffl.fragInfos.get( 0 ).toString() );
+
+ ffl = sflb.createFieldFragList( fpl( "a", "a b b b b b b b b a" ), 20 );
+ assertEquals( 1, ffl.fragInfos.size() );
+ assertEquals( "subInfos=(a((0,1))a((18,19)))/2.0(0,20)", ffl.fragInfos.get( 0 ).toString() );
+
+ ffl = sflb.createFieldFragList( fpl( "a", "b b b b a b b b b a" ), 20 );
+ assertEquals( 1, ffl.fragInfos.size() );
+ assertEquals( "subInfos=(a((8,9))a((18,19)))/2.0(2,22)", ffl.fragInfos.get( 0 ).toString() );
+ }
+
+ public void test2TermsIndex2Frags() throws Exception {
+ SimpleFragListBuilder sflb = new SimpleFragListBuilder();
+ FieldFragList ffl = sflb.createFieldFragList( fpl( "a", "a b b b b b b b b b b b b b a" ), 20 );
+ assertEquals( 2, ffl.fragInfos.size() );
+ assertEquals( "subInfos=(a((0,1)))/1.0(0,20)", ffl.fragInfos.get( 0 ).toString() );
+ assertEquals( "subInfos=(a((28,29)))/1.0(22,42)", ffl.fragInfos.get( 1 ).toString() );
+
+ ffl = sflb.createFieldFragList( fpl( "a", "a b b b b b b b b b b b b a" ), 20 );
+ assertEquals( 2, ffl.fragInfos.size() );
+ assertEquals( "subInfos=(a((0,1)))/1.0(0,20)", ffl.fragInfos.get( 0 ).toString() );
+ assertEquals( "subInfos=(a((26,27)))/1.0(20,40)", ffl.fragInfos.get( 1 ).toString() );
+
+ ffl = sflb.createFieldFragList( fpl( "a", "a b b b b b b b b b a" ), 20 );
+ assertEquals( 2, ffl.fragInfos.size() );
+ assertEquals( "subInfos=(a((0,1)))/1.0(0,20)", ffl.fragInfos.get( 0 ).toString() );
+ assertEquals( "subInfos=(a((20,21)))/1.0(20,40)", ffl.fragInfos.get( 1 ).toString() );
+ }
+
+ public void test2TermsQuery() throws Exception {
+ SimpleFragListBuilder sflb = new SimpleFragListBuilder();
+ FieldFragList ffl = sflb.createFieldFragList( fpl( "a b", "c d e" ), 20 );
+ assertEquals( 0, ffl.fragInfos.size() );
+
+ ffl = sflb.createFieldFragList( fpl( "a b", "d b c" ), 20 );
+ assertEquals( 1, ffl.fragInfos.size() );
+ assertEquals( "subInfos=(b((2,3)))/1.0(0,20)", ffl.fragInfos.get( 0 ).toString() );
+
+ ffl = sflb.createFieldFragList( fpl( "a b", "a b c" ), 20 );
+ assertEquals( 1, ffl.fragInfos.size() );
+ assertEquals( "subInfos=(a((0,1))b((2,3)))/2.0(0,20)", ffl.fragInfos.get( 0 ).toString() );
+ }
+
+ public void testPhraseQuery() throws Exception {
+ SimpleFragListBuilder sflb = new SimpleFragListBuilder();
+ FieldFragList ffl = sflb.createFieldFragList( fpl( "\"a b\"", "c d e" ), 20 );
+ assertEquals( 0, ffl.fragInfos.size() );
+
+ ffl = sflb.createFieldFragList( fpl( "\"a b\"", "a c b" ), 20 );
+ assertEquals( 0, ffl.fragInfos.size() );
+
+ ffl = sflb.createFieldFragList( fpl( "\"a b\"", "a b c" ), 20 );
+ assertEquals( 1, ffl.fragInfos.size() );
+ assertEquals( "subInfos=(ab((0,3)))/1.0(0,20)", ffl.fragInfos.get( 0 ).toString() );
+ }
+
+ public void testPhraseQuerySlop() throws Exception {
+ SimpleFragListBuilder sflb = new SimpleFragListBuilder();
+ FieldFragList ffl = sflb.createFieldFragList( fpl( "\"a b\"~1", "a c b" ), 20 );
+ assertEquals( 1, ffl.fragInfos.size() );
+ assertEquals( "subInfos=(ab((0,1)(4,5)))/1.0(0,20)", ffl.fragInfos.get( 0 ).toString() );
+ }
+
+ private FieldPhraseList fpl( String queryValue, String indexValue ) throws Exception {
+ make1d1fIndex( indexValue );
+ Query query = paW.parse( queryValue );
+ FieldQuery fq = new FieldQuery( query, true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ return new FieldPhraseList( stack, fq );
+ }
+
+ public void test1PhraseShortMV() throws Exception {
+ makeIndexShortMV();
+
+ FieldQuery fq = new FieldQuery( tq( "d" ), true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ FieldPhraseList fpl = new FieldPhraseList( stack, fq );
+ SimpleFragListBuilder sflb = new SimpleFragListBuilder();
+ FieldFragList ffl = sflb.createFieldFragList( fpl, 100 );
+ assertEquals( 1, ffl.fragInfos.size() );
+ assertEquals( "subInfos=(d((6,7)))/1.0(0,100)", ffl.fragInfos.get( 0 ).toString() );
+ }
+
+ public void test1PhraseLongMV() throws Exception {
+ makeIndexLongMV();
+
+ FieldQuery fq = new FieldQuery( pqF( "search", "engines" ), true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ FieldPhraseList fpl = new FieldPhraseList( stack, fq );
+ SimpleFragListBuilder sflb = new SimpleFragListBuilder();
+ FieldFragList ffl = sflb.createFieldFragList( fpl, 100 );
+ assertEquals( 1, ffl.fragInfos.size() );
+ assertEquals( "subInfos=(searchengines((102,116))searchengines((157,171)))/2.0(96,196)", ffl.fragInfos.get( 0 ).toString() );
+ }
+/*
+ * ----------------------------------
+ * THIS TEST DEPENDS ON LUCENE-1448
+ * UNCOMMENT WHEN IT IS COMMITTED.
+ * ----------------------------------
+ public void test1PhraseLongMVB() throws Exception {
+ makeIndexLongMVB();
+
+ FieldQuery fq = new FieldQuery( pqF( "sp", "pe", "ee", "ed" ), true, true ); // "speed" -(2gram)-> "sp","pe","ee","ed"
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ FieldPhraseList fpl = new FieldPhraseList( stack, fq );
+ SimpleFragListBuilder sflb = new SimpleFragListBuilder();
+ FieldFragList ffl = sflb.createFieldFragList( fpl, 100 );
+ assertEquals( 1, ffl.fragInfos.size() );
+ assertEquals( "subInfos=(sppeeeed((88,93)))/1.0(82,182)", ffl.fragInfos.get( 0 ).toString() );
+ }
+*/
+}
Propchange: lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/SimpleFragListBuilderTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/SimpleFragmentsBuilderTest.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/SimpleFragmentsBuilderTest.java?rev=792542&view=auto
==============================================================================
--- lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/SimpleFragmentsBuilderTest.java (added)
+++ lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/SimpleFragmentsBuilderTest.java Thu Jul 9 13:06:51 2009
@@ -0,0 +1,104 @@
+package org.apache.lucene.search.vectorhighlight;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.lucene.search.Query;
+
+public class SimpleFragmentsBuilderTest extends AbstractTestCase {
+
+ public void test1TermIndex() throws Exception {
+ FieldFragList ffl = ffl( "a", "a" );
+ SimpleFragmentsBuilder sfb = new SimpleFragmentsBuilder();
+ assertEquals( "<b>a</b>", sfb.createFragment( reader, 0, F, ffl ) );
+
+ // change tags
+ sfb = new SimpleFragmentsBuilder( new String[]{ "[" }, new String[]{ "]" } );
+ assertEquals( "[a]", sfb.createFragment( reader, 0, F, ffl ) );
+ }
+
+ public void test2Frags() throws Exception {
+ FieldFragList ffl = ffl( "a", "a b b b b b b b b b b b a b a b" );
+ SimpleFragmentsBuilder sfb = new SimpleFragmentsBuilder();
+ String[] f = sfb.createFragments( reader, 0, F, ffl, 3 );
+ // 3 snippets requested, but should be 2
+ assertEquals( 2, f.length );
+ assertEquals( "<b>a</b> b b b b b b b b b ", f[0] );
+ assertEquals( "b b <b>a</b> b <b>a</b> b", f[1] );
+ }
+
+ public void test3Frags() throws Exception {
+ FieldFragList ffl = ffl( "a c", "a b b b b b b b b b b b a b a b b b b b c a a b b" );
+ SimpleFragmentsBuilder sfb = new SimpleFragmentsBuilder();
+ String[] f = sfb.createFragments( reader, 0, F, ffl, 3 );
+ assertEquals( 3, f.length );
+ assertEquals( "<b>a</b> b b b b b b b b b ", f[0] );
+ assertEquals( "b b <b>a</b> b <b>a</b> b b b b b ", f[1] );
+ assertEquals( "<b>c</b> <b>a</b> <b>a</b> b b", f[2] );
+ }
+
+ private FieldFragList ffl( String queryValue, String indexValue ) throws Exception {
+ make1d1fIndex( indexValue );
+ Query query = paW.parse( queryValue );
+ FieldQuery fq = new FieldQuery( query, true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ FieldPhraseList fpl = new FieldPhraseList( stack, fq );
+ return new SimpleFragListBuilder().createFieldFragList( fpl, 20 );
+ }
+
+ public void test1PhraseShortMV() throws Exception {
+ makeIndexShortMV();
+
+ FieldQuery fq = new FieldQuery( tq( "d" ), true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ FieldPhraseList fpl = new FieldPhraseList( stack, fq );
+ SimpleFragListBuilder sflb = new SimpleFragListBuilder();
+ FieldFragList ffl = sflb.createFieldFragList( fpl, 100 );
+ SimpleFragmentsBuilder sfb = new SimpleFragmentsBuilder();
+ assertEquals( "a b c <b>d</b> e", sfb.createFragment( reader, 0, F, ffl ) );
+ }
+
+ public void test1PhraseLongMV() throws Exception {
+ makeIndexLongMV();
+
+ FieldQuery fq = new FieldQuery( pqF( "search", "engines" ), true, true );
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ FieldPhraseList fpl = new FieldPhraseList( stack, fq );
+ SimpleFragListBuilder sflb = new SimpleFragListBuilder();
+ FieldFragList ffl = sflb.createFieldFragList( fpl, 100 );
+ SimpleFragmentsBuilder sfb = new SimpleFragmentsBuilder();
+ assertEquals( " most <b>search engines</b> use only one of these methods. Even the <b>search engines</b> that says they can use t",
+ sfb.createFragment( reader, 0, F, ffl ) );
+ }
+/*
+ * ----------------------------------
+ * THIS TEST DEPENDS ON LUCENE-1448
+ * UNCOMMENT WHEN IT IS COMMITTED.
+ * ----------------------------------
+ public void test1PhraseLongMVB() throws Exception {
+ makeIndexLongMVB();
+
+ FieldQuery fq = new FieldQuery( pqF( "sp", "pe", "ee", "ed" ), true, true ); // "speed" -(2gram)-> "sp","pe","ee","ed"
+ FieldTermStack stack = new FieldTermStack( reader, 0, F, fq );
+ FieldPhraseList fpl = new FieldPhraseList( stack, fq );
+ SimpleFragListBuilder sflb = new SimpleFragListBuilder();
+ FieldFragList ffl = sflb.createFieldFragList( fpl, 100 );
+ SimpleFragmentsBuilder sfb = new SimpleFragmentsBuilder();
+ assertEquals( "ssing <b>speed</b>, the", sfb.createFragment( reader, 0, F, ffl ) );
+ }
+*/
+}
Propchange: lucene/java/trunk/contrib/fast-vector-highlighter/src/test/org/apache/lucene/search/vectorhighlight/SimpleFragmentsBuilderTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: lucene/java/trunk/docs/benchmarks.html
URL: http://svn.apache.org/viewvc/lucene/java/trunk/docs/benchmarks.html?rev=792542&r1=792541&r2=792542&view=diff
==============================================================================
--- lucene/java/trunk/docs/benchmarks.html (original)
+++ lucene/java/trunk/docs/benchmarks.html Thu Jul 9 13:06:51 2009
@@ -50,7 +50,7 @@
+-->
<div class="searchbox">
<form action="http://search.lucidimagination.com/p:lucene" method="get" class="roundtopsmall">
-<input onFocus="getBlank (this, 'Search the site with google');" size="25" name="q" id="query" type="text" value="Search the site with google">
+<input onFocus="getBlank (this, 'Search the site with Lucene');" size="25" name="q" id="query" type="text" value="Search the site with Lucene">
<input name="Search" value="Search" type="submit">
</form>
<div style="position: relative; top: -5px; left: -10px">Powered by <a href="http://www.lucidimagination.com" style="color: #033268">Lucid Imagination</a>
@@ -142,6 +142,9 @@
<a href="api/contrib-collation/index.html">Collation</a>
</div>
<div class="menuitem">
+<a href="api/contrib-fast-vector-highlighter/index.html">Fast Vector Highlighter</a>
+</div>
+<div class="menuitem">
<a href="api/contrib-highlighter/index.html">Highlighter</a>
</div>
<div class="menuitem">
Modified: lucene/java/trunk/docs/broken-links.xml
URL: http://svn.apache.org/viewvc/lucene/java/trunk/docs/broken-links.xml?rev=792542&r1=792541&r2=792542&view=diff
==============================================================================
--- lucene/java/trunk/docs/broken-links.xml (original)
+++ lucene/java/trunk/docs/broken-links.xml Thu Jul 9 13:06:51 2009
@@ -1,14 +1,2 @@
<broken-links>
- <link message="/usr/local/apache-forrest-0.8/main/webapp/. (No such file or directory)" uri="skin/images/chapter.gif">
- <referrer uri="skin/screen.css"/>
- </link>
- <link message="/usr/local/apache-forrest-0.8/main/webapp/. (No such file or directory)" uri="skin/images/page.gif">
- <referrer uri="skin/screen.css"/>
- </link>
- <link message="/usr/local/apache-forrest-0.8/main/webapp/. (No such file or directory)" uri="skin/images/current.gif">
- <referrer uri="skin/screen.css"/>
- </link>
- <link message="/Users/grantingersoll/projects/lucene/java/clean/src/site/src/documentation/content/xdocs/images.instruction_arrow.png (No such file or directory)" uri="images/instruction_arrow.png">
- <referrer uri="skin/screen.css"/>
- </link>
</broken-links>
Modified: lucene/java/trunk/docs/contributions.html
URL: http://svn.apache.org/viewvc/lucene/java/trunk/docs/contributions.html?rev=792542&r1=792541&r2=792542&view=diff
==============================================================================
--- lucene/java/trunk/docs/contributions.html (original)
+++ lucene/java/trunk/docs/contributions.html Thu Jul 9 13:06:51 2009
@@ -52,7 +52,7 @@
+-->
<div class="searchbox">
<form action="http://search.lucidimagination.com/p:lucene" method="get" class="roundtopsmall">
-<input onFocus="getBlank (this, 'Search the site with google');" size="25" name="q" id="query" type="text" value="Search the site with google">
+<input onFocus="getBlank (this, 'Search the site with Lucene');" size="25" name="q" id="query" type="text" value="Search the site with Lucene">
<input name="Search" value="Search" type="submit">
</form>
<div style="position: relative; top: -5px; left: -10px">Powered by <a href="http://www.lucidimagination.com" style="color: #033268">Lucid Imagination</a>
@@ -144,6 +144,9 @@
<a href="api/contrib-collation/index.html">Collation</a>
</div>
<div class="menuitem">
+<a href="api/contrib-fast-vector-highlighter/index.html">Fast Vector Highlighter</a>
+</div>
+<div class="menuitem">
<a href="api/contrib-highlighter/index.html">Highlighter</a>
</div>
<div class="menuitem">
Modified: lucene/java/trunk/docs/demo.html
URL: http://svn.apache.org/viewvc/lucene/java/trunk/docs/demo.html?rev=792542&r1=792541&r2=792542&view=diff
==============================================================================
--- lucene/java/trunk/docs/demo.html (original)
+++ lucene/java/trunk/docs/demo.html Thu Jul 9 13:06:51 2009
@@ -52,7 +52,7 @@
+-->
<div class="searchbox">
<form action="http://search.lucidimagination.com/p:lucene" method="get" class="roundtopsmall">
-<input onFocus="getBlank (this, 'Search the site with google');" size="25" name="q" id="query" type="text" value="Search the site with google">
+<input onFocus="getBlank (this, 'Search the site with Lucene');" size="25" name="q" id="query" type="text" value="Search the site with Lucene">
<input name="Search" value="Search" type="submit">
</form>
<div style="position: relative; top: -5px; left: -10px">Powered by <a href="http://www.lucidimagination.com" style="color: #033268">Lucid Imagination</a>
@@ -144,6 +144,9 @@
<a href="api/contrib-collation/index.html">Collation</a>
</div>
<div class="menuitem">
+<a href="api/contrib-fast-vector-highlighter/index.html">Fast Vector Highlighter</a>
+</div>
+<div class="menuitem">
<a href="api/contrib-highlighter/index.html">Highlighter</a>
</div>
<div class="menuitem">
Modified: lucene/java/trunk/docs/demo2.html
URL: http://svn.apache.org/viewvc/lucene/java/trunk/docs/demo2.html?rev=792542&r1=792541&r2=792542&view=diff
==============================================================================
--- lucene/java/trunk/docs/demo2.html (original)
+++ lucene/java/trunk/docs/demo2.html Thu Jul 9 13:06:51 2009
@@ -52,7 +52,7 @@
+-->
<div class="searchbox">
<form action="http://search.lucidimagination.com/p:lucene" method="get" class="roundtopsmall">
-<input onFocus="getBlank (this, 'Search the site with google');" size="25" name="q" id="query" type="text" value="Search the site with google">
+<input onFocus="getBlank (this, 'Search the site with Lucene');" size="25" name="q" id="query" type="text" value="Search the site with Lucene">
<input name="Search" value="Search" type="submit">
</form>
<div style="position: relative; top: -5px; left: -10px">Powered by <a href="http://www.lucidimagination.com" style="color: #033268">Lucid Imagination</a>
@@ -144,6 +144,9 @@
<a href="api/contrib-collation/index.html">Collation</a>
</div>
<div class="menuitem">
+<a href="api/contrib-fast-vector-highlighter/index.html">Fast Vector Highlighter</a>
+</div>
+<div class="menuitem">
<a href="api/contrib-highlighter/index.html">Highlighter</a>
</div>
<div class="menuitem">
Modified: lucene/java/trunk/docs/demo3.html
URL: http://svn.apache.org/viewvc/lucene/java/trunk/docs/demo3.html?rev=792542&r1=792541&r2=792542&view=diff
==============================================================================
--- lucene/java/trunk/docs/demo3.html (original)
+++ lucene/java/trunk/docs/demo3.html Thu Jul 9 13:06:51 2009
@@ -52,7 +52,7 @@
+-->
<div class="searchbox">
<form action="http://search.lucidimagination.com/p:lucene" method="get" class="roundtopsmall">
-<input onFocus="getBlank (this, 'Search the site with google');" size="25" name="q" id="query" type="text" value="Search the site with google">
+<input onFocus="getBlank (this, 'Search the site with Lucene');" size="25" name="q" id="query" type="text" value="Search the site with Lucene">
<input name="Search" value="Search" type="submit">
</form>
<div style="position: relative; top: -5px; left: -10px">Powered by <a href="http://www.lucidimagination.com" style="color: #033268">Lucid Imagination</a>
@@ -144,6 +144,9 @@
<a href="api/contrib-collation/index.html">Collation</a>
</div>
<div class="menuitem">
+<a href="api/contrib-fast-vector-highlighter/index.html">Fast Vector Highlighter</a>
+</div>
+<div class="menuitem">
<a href="api/contrib-highlighter/index.html">Highlighter</a>
</div>
<div class="menuitem">
Modified: lucene/java/trunk/docs/demo4.html
URL: http://svn.apache.org/viewvc/lucene/java/trunk/docs/demo4.html?rev=792542&r1=792541&r2=792542&view=diff
==============================================================================
--- lucene/java/trunk/docs/demo4.html (original)
+++ lucene/java/trunk/docs/demo4.html Thu Jul 9 13:06:51 2009
@@ -52,7 +52,7 @@
+-->
<div class="searchbox">
<form action="http://search.lucidimagination.com/p:lucene" method="get" class="roundtopsmall">
-<input onFocus="getBlank (this, 'Search the site with google');" size="25" name="q" id="query" type="text" value="Search the site with google">
+<input onFocus="getBlank (this, 'Search the site with Lucene');" size="25" name="q" id="query" type="text" value="Search the site with Lucene">
<input name="Search" value="Search" type="submit">
</form>
<div style="position: relative; top: -5px; left: -10px">Powered by <a href="http://www.lucidimagination.com" style="color: #033268">Lucid Imagination</a>
@@ -144,6 +144,9 @@
<a href="api/contrib-collation/index.html">Collation</a>
</div>
<div class="menuitem">
+<a href="api/contrib-fast-vector-highlighter/index.html">Fast Vector Highlighter</a>
+</div>
+<div class="menuitem">
<a href="api/contrib-highlighter/index.html">Highlighter</a>
</div>
<div class="menuitem">
Modified: lucene/java/trunk/docs/fileformats.html
URL: http://svn.apache.org/viewvc/lucene/java/trunk/docs/fileformats.html?rev=792542&r1=792541&r2=792542&view=diff
==============================================================================
--- lucene/java/trunk/docs/fileformats.html (original)
+++ lucene/java/trunk/docs/fileformats.html Thu Jul 9 13:06:51 2009
@@ -52,7 +52,7 @@
+-->
<div class="searchbox">
<form action="http://search.lucidimagination.com/p:lucene" method="get" class="roundtopsmall">
-<input onFocus="getBlank (this, 'Search the site with google');" size="25" name="q" id="query" type="text" value="Search the site with google">
+<input onFocus="getBlank (this, 'Search the site with Lucene');" size="25" name="q" id="query" type="text" value="Search the site with Lucene">
<input name="Search" value="Search" type="submit">
</form>
<div style="position: relative; top: -5px; left: -10px">Powered by <a href="http://www.lucidimagination.com" style="color: #033268">Lucid Imagination</a>
@@ -144,6 +144,9 @@
<a href="api/contrib-collation/index.html">Collation</a>
</div>
<div class="menuitem">
+<a href="api/contrib-fast-vector-highlighter/index.html">Fast Vector Highlighter</a>
+</div>
+<div class="menuitem">
<a href="api/contrib-highlighter/index.html">Highlighter</a>
</div>
<div class="menuitem">