~mixxxdevelopers/mixxx/features_search

« back to all changes in this revision

Viewing changes to mixxx/lib/clucene-2.3.3.4/src/contribs-lib/CLucene/highlighter/HighlightScorer.h

  • Committer: RJ Ryan
  • Date: 2011-05-27 23:54:08 UTC
  • Revision ID: rryan@mit.edu-20110527235408-kepzw0zdxdhngsqr
Add clucene-2.3.3.4 to lib/

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * Copyright 2002-2004 The Apache Software Foundation
 
3
 *
 
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
 
7
 *
 
8
 *     http://www.apache.org/licenses/LICENSE-2.0
 
9
 *
 
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.
 
15
 */
 
16
 
 
17
#ifndef _lucene_search_highlight_highlighterscorer_
 
18
#define _lucene_search_highlight_highlighterscorer_
 
19
 
 
20
 
 
21
CL_CLASS_DEF(analysis, Token)
 
22
//#include "TextFragment.h"
 
23
 
 
24
CL_NS_DEF2(search,highlight)
 
25
class TextFragment;
 
26
 
 
27
/**
 
28
 * Adds to the score for a fragment based on its tokens
 
29
 */
 
30
class CLUCENE_CONTRIBS_EXPORT HighlightScorer:LUCENE_BASE
 
31
{
 
32
public:
 
33
        virtual ~HighlightScorer(){
 
34
        }
 
35
 
 
36
        /**
 
37
         * called when a new fragment is started for consideration
 
38
         * @param newFragment
 
39
         */
 
40
        virtual void startFragment(TextFragment* newFragment) = 0;
 
41
 
 
42
        /**
 
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)
 
47
         */
 
48
        virtual float_t getTokenScore(CL_NS(analysis)::Token* token) = 0;
 
49
        
 
50
 
 
51
        /**
 
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(). 
 
55
         *
 
56
         */     
 
57
        virtual float_t getFragmentScore() = 0;
 
58
};
 
59
 
 
60
CL_NS_END2
 
61
#endif
 
62
 
 
63