1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
---|
2 | <!-- |
---|
3 | Licensed to the Apache Software Foundation (ASF) under one or more |
---|
4 | contributor license agreements. See the NOTICE file distributed with |
---|
5 | this work for additional information regarding copyright ownership. |
---|
6 | The ASF licenses this file to You under the Apache License, Version 2.0 |
---|
7 | (the "License"); you may not use this file except in compliance with |
---|
8 | the License. You may obtain a copy of the License at |
---|
9 | |
---|
10 | http://www.apache.org/licenses/LICENSE-2.0 |
---|
11 | |
---|
12 | Unless required by applicable law or agreed to in writing, software |
---|
13 | distributed under the License is distributed on an "AS IS" BASIS, |
---|
14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
15 | See the License for the specific language governing permissions and |
---|
16 | limitations under the License. |
---|
17 | --> |
---|
18 | <html> |
---|
19 | <head> |
---|
20 | <title>Min Number Should Match Specification Format</title> |
---|
21 | </head> |
---|
22 | |
---|
23 | <body> |
---|
24 | <h1>Min Number Should Match Specification Format</h1> |
---|
25 | |
---|
26 | <blockquote> |
---|
27 | This document explains the format used for specifying the |
---|
28 | "Min Number Should Match" criteria of the BooleanQuery objects built by the |
---|
29 | DisMaxRequestHandler. |
---|
30 | </blockquote> |
---|
31 | |
---|
32 | |
---|
33 | <h2>Explaination of Concept: "Min Number Should Match"</h2> |
---|
34 | <div> |
---|
35 | :TODO: |
---|
36 | </div> |
---|
37 | |
---|
38 | |
---|
39 | <h2>Specification Format</h2> |
---|
40 | <div> |
---|
41 | |
---|
42 | <p>Specification strings may have the following formats...</p> |
---|
43 | |
---|
44 | <dl> |
---|
45 | |
---|
46 | <dt><code>3</code></dt> |
---|
47 | <dd>A positive integer, indicating a fixed value regardless of the |
---|
48 | number of optional clauses. |
---|
49 | </dd> |
---|
50 | |
---|
51 | <dt><code>-2</code></dt> |
---|
52 | <dd>A negative integer, indicating that the total number of optional clauses, |
---|
53 | minus this number should be mandatory. |
---|
54 | </dd> |
---|
55 | |
---|
56 | <dt><code>75%</code></dt> |
---|
57 | <dd>A percentage, indicating that this percent of the total number of |
---|
58 | optional clauses are neccessary. The number computed from the |
---|
59 | percentage is rounded down and used as the minimum. |
---|
60 | </dd> |
---|
61 | |
---|
62 | <dt><code>-25%</code></dt> |
---|
63 | <dd>A negative percentage, indicating that this percent of the total |
---|
64 | number of optional clauses can be missing. The number computed from the |
---|
65 | percentage is rounded down, before being subtracted from the total |
---|
66 | to determine the minimum. |
---|
67 | </dd> |
---|
68 | |
---|
69 | <dt><code>3<90%</code></dt> |
---|
70 | <dd>A positive integer, followed by the less-than symbol, followed |
---|
71 | by any of the previously mentioned specifiers is a conditional |
---|
72 | specification. It indicates that if the number of optional clauses is |
---|
73 | equal to (or less than) the integer, they are all required, but |
---|
74 | if it's greater then the integer, the specification applies. |
---|
75 | In this example: if there are 1 to 3 clauses they are all required, |
---|
76 | but for 4 or more clauses only 90% are required. |
---|
77 | </dd> |
---|
78 | |
---|
79 | <dt><code>2<-25% 9<-3</code></dt> |
---|
80 | <dd>Multiple conditional specifications can be seperated by spaces, |
---|
81 | each one only being valid for numbers greater then the one before it. |
---|
82 | In this example: if there are 1 or 2 clauses both are required, |
---|
83 | if there are 3-9 clauses all but 25% are requred, and if there |
---|
84 | are more then 9 clauses, all but three are required. |
---|
85 | </dd> |
---|
86 | </dl> |
---|
87 | |
---|
88 | <p> |
---|
89 | A few important notes... |
---|
90 | </p> |
---|
91 | |
---|
92 | <ul> |
---|
93 | <li> |
---|
94 | When dealing with percentages, negative values can be used to get |
---|
95 | different behavior in edge cases. 75% and -25% mean the same thing |
---|
96 | when dealing with 4 clauses, but when dealing with 5 clauses 75% means |
---|
97 | 3 are required, but -25% means 4 are required. |
---|
98 | </li> |
---|
99 | <li> |
---|
100 | If the calculations based on the specification determine that no |
---|
101 | optional clauses are needed, the usual rules about BooleanQueries |
---|
102 | still apply at search time (a BooleanQuery containing no required |
---|
103 | clauses must still match at least one optional clause) |
---|
104 | </li> |
---|
105 | <li> |
---|
106 | No matter what number the calculation arrives at, |
---|
107 | a value greater then the number of optional clauses, or a value less then |
---|
108 | 1 will never be used. (ie: no matter how low or how high the result of the |
---|
109 | calculation result is, the minimum number of required matches will never |
---|
110 | be lower then 1 or greatered then the number of clauses. |
---|
111 | </li> |
---|
112 | </ul> |
---|
113 | |
---|
114 | |
---|
115 | </div> |
---|
116 | |
---|
117 | |
---|
118 | |
---|
119 | |
---|
120 | <hr> |
---|
121 | <pre> |
---|
122 | $Id: min-should-match.html 1144761 2011-07-09 23:01:53Z sarowe $ |
---|
123 | $Source:$ |
---|
124 | </pre> |
---|
125 | |
---|
126 | </body> </html> |
---|