Thumbnail file hits. Based on a patch from D Bera
[beagle.git] / beagled / Lucene.Net / Search / BooleanClause.cs
blob0ccdea9272ea8e9d00bf107d3442e17aefe1967b
1 /*
2 * Copyright 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.
16 using System;
17 namespace Lucene.Net.Search
19 /// <summary>A clause in a BooleanQuery. </summary>
20 [Serializable]
21 public class BooleanClause
23 /// <summary>The query whose matching documents are combined by the boolean query. </summary>
24 public Query query;
25 /// <summary>If true, documents documents which <i>do not</i>
26 /// match this sub-query will <i>not</i> match the boolean query.
27 /// </summary>
28 public bool required = false;
29 /// <summary>If true, documents documents which <i>do</i>
30 /// match this sub-query will <i>not</i> match the boolean query.
31 /// </summary>
32 public bool prohibited = false;
34 /// <summary>Constructs a BooleanClause with query <code>q</code>, required
35 /// <code>r</code> and prohibited <code>p</code>.
36 /// </summary>
37 public BooleanClause(Query q, bool r, bool p)
39 query = q;
40 required = r;
41 prohibited = p;
44 /// <summary>Returns true iff <code>o</code> is equal to this. </summary>
45 public override bool Equals(System.Object o)
47 if (!(o is BooleanClause))
48 return false;
49 BooleanClause other = (BooleanClause) o;
50 return this.query.Equals(other.query) && (this.required == other.required) && (this.prohibited == other.prohibited);
53 /// <summary>Returns a hash code value for this object.</summary>
54 public override int GetHashCode()
56 return query.GetHashCode() ^ (this.required?1:0) ^ (this.prohibited?2:0);