Lucene.Net  3.0.3
Lucene.Net is a port of the Lucene search engine library, written in C# and targeted at .NET runtime users.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Pages
PayloadFunction.cs
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 using System;
19 
20 namespace Lucene.Net.Search.Payloads
21 {
22 
23 
24  /// <summary> An abstract class that defines a way for Payload*Query instances
25  /// to transform the cumulative effects of payload scores for a document.
26  ///
27  /// </summary>
28  /// <seealso cref="Lucene.Net.Search.Payloads.PayloadTermQuery"> for more information
29  ///
30  /// <p/>
31  /// This class and its derivations are experimental and subject to change
32  ///
33  ///
34  /// </seealso>
35  [Serializable]
36  public abstract class PayloadFunction
37  {
38 
39  /// <summary> Calculate the score up to this point for this doc and field</summary>
40  /// <param name="docId">The current doc
41  /// </param>
42  /// <param name="field">The field
43  /// </param>
44  /// <param name="start">The start position of the matching Span
45  /// </param>
46  /// <param name="end">The end position of the matching Span
47  /// </param>
48  /// <param name="numPayloadsSeen">The number of payloads seen so far
49  /// </param>
50  /// <param name="currentScore">The current score so far
51  /// </param>
52  /// <param name="currentPayloadScore">The score for the current payload
53  /// </param>
54  /// <returns> The new current Score
55  ///
56  /// </returns>
57  /// <seealso cref="Lucene.Net.Search.Spans.Spans">
58  /// </seealso>
59  public abstract float CurrentScore(int docId, System.String field, int start, int end, int numPayloadsSeen, float currentScore, float currentPayloadScore);
60 
61  /// <summary> Calculate the final score for all the payloads seen so far for this doc/field</summary>
62  /// <param name="docId">The current doc
63  /// </param>
64  /// <param name="field">The current field
65  /// </param>
66  /// <param name="numPayloadsSeen">The total number of payloads seen on this document
67  /// </param>
68  /// <param name="payloadScore">The raw score for those payloads
69  /// </param>
70  /// <returns> The final score for the payloads
71  /// </returns>
72  public abstract float DocScore(int docId, System.String field, int numPayloadsSeen, float payloadScore);
73 
74  abstract public override int GetHashCode();
75 
76  abstract public override bool Equals(System.Object o);
77  }
78 }