Hello Jiri,

I am grateful for you. and I want to thank you for your work the
SpanHighlightScorer is really amazing to me and it get me out of many
problems I faced.

Thank you

From: ?pl?chal Ji?? <splic...@tovek.cz>

>
> Hello Mohammad,
>
>
>
> the new queryscorer is able to rewrite the highlighting queries itself. You
> have to allow it while creating it:
>
>
>
>    // Create token stream from the text you want to be highlighted.
> fieldName is name of the field that is being highlighted
>
>    // only the relevant part of the query is used.
>
>    StringReader reader( text );
>
>    CachingTokenFilter tokenStream( analyzer.tokenStream( fieldName, &reader
> ), true );
>
>
>
>    // set bAutoRewriteQueries=true to allow rewriting highlighting queries
> and if you use only standard query objects
>
>   // use the default extractor
>
>    SpanHighlightScorer spanScorer( true );
>
>
>
>    // initialize the query scorer with the ORIGINAL query ? NOT  REWRITTEN
> one. This query
>
>    // should contain the WildCardQuery, not the ConstantScoreQuery!
>
>    spanScorer.init( query, fieldName, &tokenStream );
>
>
>
>    // reset the token stream as it has been used by the scorer and we will
> need it in the highlighter too
>
>    tokenStream.reset();
>
>
>
>    // Using the hilghlighter is the same as with the basis Highlight
> scorer:
>
>    // Instantiate it with formatter and scorer, set fragmenter and call one
> of its methos, ie. getBestFragments
>
>    SimpleFragmenter fragmenter( fragmentSize );
>
>    Highlighter highlighter( &formatter, &spanScorer );
>
>    highlighter.setTextFragmenter( &fragmenter );
>
>    TCHAR * hilited = highlighter.getBestFragments( &tokenStream, text,
> maxFragments, _T( "..." ));
>
>
>
> The query will be rewritten within the call spanScorer.init(?) Typically,
> your documents do not contain as many different words
>
> that would match your wildcard query as the whole index and so the
> probability that your query matches more than MAX CLAUSE
>
> different words is much less.
>
>
>
> Is it possible that your wildcard matches more than MAX CLAUSE different
> word in one document?
>
>
>
> Jiri
>
> Mohammad Ismael
------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
CLucene-developers mailing list
CLucene-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/clucene-developers

Reply via email to