Class that wraps a set of query options to be used when executing a CrownPeak.SearchG2.PlainSearch or a CrownPeak.SearchG2.Search{T} on a CrownPeak SearchG2 collection.
예제 #1
0
        protected void Query(string text, int start, FilterQueryCollection filterQueries = null)
        {
            var search = new Search<MyResult>(new Settings("www.crownpeak.com"));
            QueryOptions options = new QueryOptions()
            {
                Highlighting = false,
                Start = 0,
                Rows = 100000,
                SpellCheck = false,
                OrderBy = new[] { new SortOrder("date", CrownPeak.SearchG2.Query.SortDirection.Desc) },
                // Language = "en"
            };
            var cpResults = search.Execute(text, options);

            rptItems.DataSource = cpResults;
            rptItems.DataBind();
        }
예제 #2
0
 /// <summary>
 /// Execute a Suggest search that returns the results that start the specified query text,
 /// using a specified set of <see cref="QueryOptions"/>
 /// </summary>
 /// <param name="q">The query string to execute. See 
 /// <see href="https://wiki.apache.org/solr/SolrQuerySyntax"/>.</param>
 /// <param name="options">The <see cref="QueryOptions"/> to use for this query.</param>
 /// <returns><see cref="SuggestionCollection"/></returns>
 public SuggestionCollection Execute(string q, QueryOptions options)
 {
     return Execute(q, options.SolrOptions);
 }
 /// <summary>
 /// Execute a search that returns the results that match the specified query text,
 /// using a specified set of <see cref="QueryOptions"/>.
 /// </summary>
 /// <param name="q">The query string to execute. See 
 /// <see href="https://wiki.apache.org/solr/SolrQuerySyntax"/>.</param>
 /// <param name="options">The <see cref="QueryOptions"/> to use for this query.</param>
 /// <returns><see cref="PlainResultCollection"/></returns>
 public PlainResultCollection Execute(string q, QueryOptions options)
 {
     try
     {
         return new PlainResultCollection(Solr.Query(q, options.SolrOptions), options.Start);
     }
     catch (Exception ex)
     {
         Utils.ThrowException(ex);
         return null;
     }
 }