/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 1.3.25
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

namespace clucene.net {

using System;
using System.Runtime.InteropServices;

public class Searcher : Searchable {
  private HandleRef swigCPtr;

  internal Searcher(IntPtr cPtr, bool cMemoryOwn) : base(libCLcsharpPINVOKE.SearcherUpcast(cPtr), cMemoryOwn) {
    swigCPtr = new HandleRef(this, cPtr);
  }

  internal static HandleRef getCPtr(Searcher obj) {
    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
  }

  ~Searcher() {
    Dispose();
  }

  public override void Dispose() {
    if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
      swigCMemOwn = false;
      libCLcsharpPINVOKE.delete_Searcher(swigCPtr);
    }
    swigCPtr = new HandleRef(null, IntPtr.Zero);
    GC.SuppressFinalize(this);
    base.Dispose();
  }

  public Hits search(Query query) {
    IntPtr cPtr = libCLcsharpPINVOKE.Searcher_search__SWIG_0(swigCPtr, Query.getCPtr(query));
    Hits ret = (cPtr == IntPtr.Zero) ? null : new Hits(cPtr, true);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public Hits search(Query query, Filter filter) {
    IntPtr cPtr = libCLcsharpPINVOKE.Searcher_search__SWIG_1(swigCPtr, Query.getCPtr(query), Filter.getCPtr(filter));
    Hits ret = (cPtr == IntPtr.Zero) ? null : new Hits(cPtr, true);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public Hits search(Query query, Sort sort) {
    IntPtr cPtr = libCLcsharpPINVOKE.Searcher_search__SWIG_2(swigCPtr, Query.getCPtr(query), Sort.getCPtr(sort));
    Hits ret = (cPtr == IntPtr.Zero) ? null : new Hits(cPtr, true);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public Hits search(Query query, Filter filter, Sort sort) {
    IntPtr cPtr = libCLcsharpPINVOKE.Searcher_search__SWIG_3(swigCPtr, Query.getCPtr(query), Filter.getCPtr(filter), Sort.getCPtr(sort));
    Hits ret = (cPtr == IntPtr.Zero) ? null : new Hits(cPtr, true);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public void setSimilarity(Similarity similarity) {
    libCLcsharpPINVOKE.Searcher_setSimilarity(swigCPtr, Similarity.getCPtr(similarity));
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public Similarity getSimilarity() {
    IntPtr cPtr = libCLcsharpPINVOKE.Searcher_getSimilarity(swigCPtr);
    Similarity ret = (cPtr == IntPtr.Zero) ? null : new Similarity(cPtr, false);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

}

}
