2
* Copyright 2002-2004 The Apache Software Foundation
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
17
#ifndef _lucene_search_highlight_highlighterscorer_
18
#define _lucene_search_highlight_highlighterscorer_
21
CL_CLASS_DEF(analysis, Token)
22
//#include "TextFragment.h"
24
CL_NS_DEF2(search,highlight)
28
* Adds to the score for a fragment based on its tokens
30
class CLUCENE_CONTRIBS_EXPORT HighlightScorer:LUCENE_BASE
33
virtual ~HighlightScorer(){
37
* called when a new fragment is started for consideration
40
virtual void startFragment(TextFragment* newFragment) = 0;
43
* Called for each token in the current fragment
44
* @param token The token to be scored
45
* @return a score which is passed to the Highlighter class to influence the mark-up of the text
46
* (this return value is NOT used to score the fragment)
48
virtual float_t getTokenScore(CL_NS(analysis)::Token* token) = 0;
52
* Called when the highlighter has no more tokens for the current fragment - the scorer returns
53
* the weighting it has derived for the most recent fragment, typically based on the tokens
54
* passed to getTokenScore().
57
virtual float_t getFragmentScore() = 0;