FAQ
hi


My app can find the document but cannot highlight the keywords.


ComplexPhraseQueryParser parser = new ComplexPhraseQueryParser(Version.LUCENE_30, "contents", analyzer);
Query query = parser.parse("\"(great~) sum*\"");
QueryScorer scorer = new QueryScorer(query);


Looks like its because the query coming in is a ComplexPhraseQuery and the Highlighter doesn't current know how to handle that type.


So how to fix the problem???

Search Discussions

  • Ahmet Arslan at Mar 15, 2011 at 10:26 pm

    --- On Tue, 3/15/11, Cescy wrote:

    From: Cescy <ee07b381@gmail.com>
    Subject: About ComplexPhraseQueryParser highlight prob
    To: "java-user" <java-user@lucene.apache.org>
    Date: Tuesday, March 15, 2011, 11:44 PM
    hi


    My app can find the document but cannot highlight the
    keywords.


    ComplexPhraseQueryParser parser = new
    ComplexPhraseQueryParser(Version.LUCENE_30, "contents",
    analyzer);
    Query query = parser.parse("\"(great~) sum*\"");
    QueryScorer scorer = new QueryScorer(query);


    Looks like its because the query coming in is a
    ComplexPhraseQuery and the Highlighter doesn't current know
    how to handle that type.
    You can re-write your query, and use this query (in highlighting) instead.

    Query rewritedQuery = getQuery().rewrite(getSearcher().getReader());




    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedMar 15, '11 at 9:46p
activeMar 15, '11 at 10:26p
posts2
users2
websitelucene.apache.org

2 users in discussion

Cescy: 1 post Ahmet Arslan: 1 post

People

Translate

site design / logo © 2022 Grokbase