Assets/Watson/Scripts/Services/RetrieveAndRank/RetrieveAndRank.cs
/// <summary>
/// Return reranked results for your query. The request is similar to the Search Solr standard query parser method, but includes the ranker_id and, in the default configuration, fcselect replaces the select request handler. (https://cwiki.apache.org/confluence/display/solr/The+Standard+Query+Parser).
/// </summary>
/// <param name="callback"></param>
/// <param name="clusterID">Cluster ID.</param>
/// <param name="collectionName">The name of the collection to use.</param>
/// <param name="query">The query. Uses Solr standard query syntax.</param>
/// <param name="fl">The fields to return.</param>
/// <param name="isRankedSearch">Use ranked search instead of standard search.</param>
/// <param name="rankerID">The trained ranker to query.</param>
/// <param name="customData"></param>
/// <returns></returns>
Return reranked results for your query. The request is similar to the Search Solr standard query parser method, but includes the ranker_id and, in the default configuration, fcselect replaces the select request handler.
Return reranked results for your query . The request is similar to the Search Solr standard query parser method but includes the ranker_id and in the default configuration fcselect replaces the select request handler .
public bool Search(OnSearch callback, string clusterID, string collectionName, string query, string[] fl, bool isRankedSearch = false, string rankerID = default(string), string customData = default(string))
        {
            if (callback == null)
                throw new ArgumentNullException("callback");
            if (string.IsNullOrEmpty(clusterID))
                throw new ArgumentNullException("A clusterID is required to search!");
            if (string.IsNullOrEmpty(collectionName))
                throw new ArgumentNullException("A collectionName is required to search!");
            if (string.IsNullOrEmpty(query))
                throw new ArgumentNullException("A query is required to search!");
            if (fl == default(string[]))
                throw new ArgumentNullException("An array of filters are required to search!");
            SearchRequest req = new SearchRequest();
            req.Callback = callback;
            req.ClusterID = clusterID;
            req.CollectionName = collectionName;
            req.Query = query;
            req.Fl = fl;
            req.Data = customData;
            req.Timeout = REQUEST_TIMEOUT;
            req.Parameters["wt"] = "json";
            req.Parameters["q"] = query;
            req.Parameters["fl"] = string.Join(",", fl);
            req.OnResponse = OnSearchResponse;
            RESTConnector connector;
            if (!isRankedSearch)
                connector = RESTConnector.GetConnector(SERVICE_ID, string.Format(SERVICE_CLUSTER_COLLECTION_SELECT, clusterID, collectionName));
            else
            {
                connector = RESTConnector.GetConnector(SERVICE_ID, string.Format(SERVICE_CLUSTER_COLLECTION_FCSELECT, clusterID, collectionName));
                req.Parameters["ranker_id"] = rankerID;
            }
            if (connector == null)
                return false;
            return connector.Send(req);
        }
public bool Search ( OnSearch callback , string clusterID , string collectionName , string query , string [ ] fl , bool isRankedSearch = false , string rankerID = default ( string ) , string customData = default ( string ) ) { if ( callback == null ) throw new ArgumentNullException ( " " ) ; if ( string . IsNullOrEmpty ( clusterID ) ) throw new ArgumentNullException ( " " ) ; if ( string . IsNullOrEmpty ( collectionName ) ) throw new ArgumentNullException ( " " ) ; if ( string . IsNullOrEmpty ( query ) ) throw new ArgumentNullException ( " " ) ; if ( fl == default ( string [ ] ) ) throw new ArgumentNullException ( " " ) ; SearchRequest req = new SearchRequest ( ) ; req . Callback = callback ; req . ClusterID = clusterID ; req . CollectionName = collectionName ; req . Query = query ; req . Fl = fl ; req . Data = customData ; req . Timeout = REQUEST_TIMEOUT ; req . Parameters [ " " ] = " " ; req . Parameters [ " " ] = query ; req . Parameters [ " " ] = string . Join ( " " , fl ) ; req . OnResponse = OnSearchResponse ; RESTConnector connector ; if ( ! isRankedSearch ) connector = RESTConnector . GetConnector ( SERVICE_ID , string . Format ( SERVICE_CLUSTER_COLLECTION_SELECT , clusterID , collectionName ) ) ; else { connector = RESTConnector . GetConnector ( SERVICE_ID , string . Format ( SERVICE_CLUSTER_COLLECTION_FCSELECT , clusterID , collectionName ) ) ; req . Parameters [ " " ] = rankerID ; } if ( connector == null ) return false ; return connector . Send ( req ) ; }
Return reranked results for your query.
Return reranked results for your query .
None
callback
OnSearch
None
clusterID
string
None
collectionName
string
The name of the collection to use.
The name of the collection to use .
query
string
The query. Uses Solr standard query syntax.
The query . Uses Solr standard query syntax .
fl
string[]
The fields to return.
The fields to return .
isRankedSearch
bool
Use ranked search instead of standard search.
Use ranked search instead of standard search .
rankerID
string
The trained ranker to query.
The trained ranker to query .
customData
string
None