~ubuntu-branches/ubuntu/jaunty/beagle/jaunty-security

« back to all changes in this revision

Viewing changes to beagled/Lucene.Net/Search/PhraseQuery.cs

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Ebner
  • Date: 2008-05-04 00:31:32 UTC
  • mfrom: (1.1.21 upstream)
  • Revision ID: james.westby@ubuntu.com-20080504003132-2tkm5o8moo5952ri
Tags: 0.3.7-2ubuntu1
 * Merge from Debian unstable. (LP: #225746) Remaining Ubuntu changes:
  - debian/control:
    + Rename ice{weasel,dove}-beagle to {mozilla,thunderbird}-beagle and
      and update the dependencies accordingly.
    + Change Maintainer to Ubuntu Mono Team.
  - debian/rules:
    + Install the mozilla-beagle and thunderbird-beagle extensions.
  - ice{dove,weasel}.dirs:
    + Renamed to {mozilla,thunderbird}-beagle.dirs.
    + Fixed paths to point to usr/lib/{firefox,thunderbird}

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
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
 
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
7
8
 * 
8
9
 * http://www.apache.org/licenses/LICENSE-2.0
9
10
 * 
15
16
 */
16
17
 
17
18
using System;
18
 
using IndexReader = Lucene.Net.Index.IndexReader;
 
19
 
19
20
using Term = Lucene.Net.Index.Term;
20
21
using TermPositions = Lucene.Net.Index.TermPositions;
 
22
using IndexReader = Lucene.Net.Index.IndexReader;
21
23
using ToStringUtils = Lucene.Net.Util.ToStringUtils;
22
24
 
23
25
namespace Lucene.Net.Search
81
83
                /// or phrases with gaps (e.g. in connection with stopwords).
82
84
                /// 
83
85
                /// </summary>
84
 
                /// <param name="term">
 
86
                /// <param name="">term
85
87
                /// </param>
86
 
                /// <param name="position">
 
88
                /// <param name="">position
87
89
                /// </param>
88
90
                public virtual void  Add(Term term, int position)
89
91
                {
247
249
                                
248
250
                                Explanation fieldNormExpl = new Explanation();
249
251
                                byte[] fieldNorms = reader.Norms(Enclosing_Instance.field);
250
 
                                float fieldNorm = fieldNorms != null?Similarity.DecodeNorm(fieldNorms[doc]):0.0f;
 
252
                                float fieldNorm = fieldNorms != null ? Similarity.DecodeNorm(fieldNorms[doc]) : 0.0f;
251
253
                                fieldNormExpl.SetValue(fieldNorm);
252
254
                                fieldNormExpl.SetDescription("fieldNorm(field=" + Enclosing_Instance.field + ", doc=" + doc + ")");
253
255
                                fieldExpl.AddDetail(fieldNormExpl);
279
281
                        return new PhraseWeight(this, searcher);
280
282
                }
281
283
                
282
 
                /// <seealso cref="Lucene.Net.search.Query.ExtractTerms(java.util.Set)">
 
284
                /// <seealso cref="Lucene.Net.Search.Query#ExtractTerms(java.util.Set)">
283
285
                /// </seealso>
284
286
                public override void  ExtractTerms(System.Collections.Hashtable queryTerms)
285
287
                {
286
 
                        foreach (Term term in terms)
287
 
                        {
288
 
                                queryTerms.Add(term, term);
289
 
                        }
290
 
                }
 
288
            foreach (Term term in terms)
 
289
            {
 
290
                if (queryTerms.Contains(term) == false)
 
291
                {
 
292
                    queryTerms.Add(term, term);
 
293
                }
 
294
            }
 
295
        }
291
296
                
292
297
                /// <summary>Prints a user-readable version of this query. </summary>
293
298
                public override System.String ToString(System.String f)
319
324
                        return buffer.ToString();
320
325
                }
321
326
                
322
 
                /// <summary>Returns true iff <code>o</code> is equal to this. </summary>
323
 
                public  override bool Equals(System.Object o)
324
 
                {
325
 
                        if (!(o is PhraseQuery))
326
 
                                return false;
327
 
                        PhraseQuery other = (PhraseQuery) o;
 
327
        /// <summary>Returns true iff <code>o</code> is equal to this. </summary>
 
328
        public  override bool Equals(System.Object o)
 
329
        {
 
330
            if (!(o is PhraseQuery))
 
331
                return false;
 
332
            PhraseQuery other = (PhraseQuery) o;
328
333
            return (this.GetBoost() == other.GetBoost()) && 
329
334
                (this.slop == other.slop) && 
330
335
                this.terms.Equals(other.terms) && 
331
336
                this.positions.Equals(other.positions);
332
 
                }
 
337
        }
333
338
                
334
 
                /// <summary>Returns a hash code value for this object.</summary>
335
 
                public override int GetHashCode()
336
 
                {
337
 
                        return BitConverter.ToInt32(BitConverter.GetBytes(GetBoost()), 0) ^ slop ^ terms.GetHashCode() ^ positions.GetHashCode();
338
 
                }
339
 
        }
 
339
        /// <summary>Returns a hash code value for this object.</summary>
 
340
        public override int GetHashCode()
 
341
        {
 
342
            return BitConverter.ToInt32(BitConverter.GetBytes(GetBoost()), 0) ^ slop ^ terms.GetHashCode() ^ positions.GetHashCode();
 
343
        }
 
344
    }
340
345
}
 
 
b'\\ No newline at end of file'