/// <summary>
    /// Searches the specified query.
    /// </summary>
    /// <param name="query">The query.</param>
    /// <param name="database">The database.</param>
    /// <returns>Returns collection of items</returns>
    public override IEnumerable<Item> Search(Query query, Database database)
    {
      Assert.ArgumentNotNull(query, "query");
      Assert.ArgumentNotNull(database, "database");

      FastQueryBuilder builder = new FastQueryBuilder(query);

      return database.SelectItems(builder.BuildResultQuery());
    }
    /// <summary>
    /// Searches the specified query.
    /// </summary>
    /// <param name="query">The query.</param>
    /// <param name="database">The database.</param>
    /// <returns>Returns collection of items</returns>
    public override IEnumerable<Item> Search(Query query, Database database)
    {
      Assert.IsNotNull(query, "query");
      Assert.IsNotNull(database, "database");

      IEnumerable<Item> result = Enumerable.Empty<Item>();

      if (this.PrimarySearchProvider != null)
      {
        result = this.PrimarySearchProvider.Search(query, database);
      }

      if (((result == null) || (!result.Any())) && (this.SecondarySearchProvider != null))
      {
        result = this.SecondarySearchProvider.Search(query, database);
      }

      return result ?? Enumerable.Empty<Item>();
    }
 /// <summary>
 /// Searches the specified query.
 /// </summary>
 /// <param name="query">The query.</param>
 /// <param name="database">The database.</param>
 /// <returns>Returns collection of items</returns>
 public abstract IEnumerable<Item> Search(Query query, Database database);
 public abstract IEnumerable<Item> Search(Query query);
    public override IEnumerable<Item> Search(Query query)
    {
      Assert.ArgumentNotNull(query, "query");

      return this.Search(query, this.Database);
    }
Example #6
0
 /// <summary>
 /// Appends the subquery.
 /// </summary>
 /// <param name="query">The query.</param>
 public void AppendSubquery(Query query)
 {
   QueryNode node = new QueryNode(query);
   this.AddNode(node);
 }
Example #7
0
    /// <summary>
    /// Determines whether the specified <see cref="Query"/> is equal to the current one.
    /// </summary>
    /// <param name="other">The <see cref="Query"/> to compare with the current one.</param>
    /// <returns>true if the specified <see cref="Query"/> is equal to the current one; otherwise, false. </returns>
    public bool Equals(Query other)
    {
      if (ReferenceEquals(null, other))
      {
        return false;
      }

      if (ReferenceEquals(this, other))
      {
        return true;
      }

      return Object.Equals(other.FirstNode, this.FirstNode) && Object.Equals(other.LastNode, this.LastNode) && Object.Equals(other.SearchRoot, this.SearchRoot);
    }
 /// <summary>
 /// Initializes a new instance of the <see cref="StringQueryBuilder"/> class.
 /// </summary>
 /// <param name="query">The query.</param>
 protected StringQueryBuilder(Query query)
 {
   this.innerQuery = query;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SitecoreQueryBuilder"/> class.
 /// </summary>
 /// <param name="query">The query.</param>
 public SitecoreQueryBuilder(Query query)
   : base(query)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FastQueryBuilder"/> class.
 /// </summary>
 /// <param name="query">The query.</param>
 public FastQueryBuilder(Query query)
   : base(query)
 {
 }