Package org.apache.lucene.search.vectorhighlight.FieldQuery

Examples of org.apache.lucene.search.vectorhighlight.FieldQuery.QueryPhraseMap


    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, 0);

    // "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, 0);

    // "bc cd"
    assertNotNull( qpm.subMap.get( "bc" ) );
View Full Code Here


    defgMultiTermQueryTest(new TermRangeQuery (F, "d", "e", true, true));
  }

  private void defgMultiTermQueryTest(Query query) throws IOException {
    FieldQuery fq = new FieldQuery( query, reader, true, true );
    QueryPhraseMap qpm = fq.getFieldTermMap(F, "defg");
    assertNotNull (qpm);
    assertNull (fq.getFieldTermMap(F, "dog"));
    List<TermInfo> phraseCandidate = new ArrayList<TermInfo>();
    phraseCandidate.add( new TermInfo( "defg", 0, 12, 0 ) );
    assertNotNull (fq.searchPhrase(F, phraseCandidate));
View Full Code Here

  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" );
View Full Code Here

  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 );
  }
View Full Code Here

  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 );
  }
View Full Code Here

    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 );
   
View Full Code Here

    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 );
View Full Code Here

    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 );
  }
View Full Code Here

    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" ) );
View Full Code Here

    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 ) );
View Full Code Here

TOP

Related Classes of org.apache.lucene.search.vectorhighlight.FieldQuery.QueryPhraseMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.