import BxClient, BxData _account = "csharp_unittest" _password = "******" _domain = "" _languages = ['en'] _isDev = False _isDelta = False _logs = [] _print = True bxData = BxData.BxData(BxClient.BxClient(_account, _password, _domain), _languages, _isDev, _isDelta) try: _productFile = '../sample_data/products.csv' _itemIdColumn = 'id' _customerFile = '../sample_data/customers.csv' _customerIdColumn = 'customer_id' bxData.addMainCSVItemFile(_productFile, _itemIdColumn) _customerSourceKey = bxData.addMainCSVCustomerFile(_customerFile, _customerIdColumn) if _isDelta == False: bxData.addSourceStringField(_customerSourceKey, "country", "country") bxData.addSourceStringField(_customerSourceKey, "zip", "zip") _logs.append("publish the data specifications") bxData.pushDataSpecifications() _logs.append("publish the api owner changes") bxData.publishChanges()
import BxClient import BxSearchRequest import pprint _account = "csharp_unittest" _password = "******" _domain = "" _logs = [] _print = True #Create the Boxalino Client SDK instance #N.B.: you should not create several instances of BxClient on the same page, make sure to save it in a static variable and to re-use it. bxClient = BxClient.BxClient(_account, _password, _domain) try: _language = "en" # // a valid language code (e.g.: "en", "fr", "de", "it", ...) _queryText = "women" # // a search query to be completed _hitCount = 10 #; //a maximum number of search result to return in one page #//create search request bxRequest = BxSearchRequest.BxSearchRequest(_language, _queryText, _hitCount) #//add the request bxClient.addRequest(bxRequest) #//make the query to Boxalino server and get back the response for all requests bxResponse = bxClient.getResponse() if _print: print "<pre>"
import BxClient import BxAutocompleteRequest import BxFacets _account = "csharp_unittest" _password = "******" _domain = "" _logs = [] _print = True _isDev = False _host = "cdn.bx-cloud.com" #Create the Boxalino Client SDK instance #N.B.: you should not create several instances of BxClient on the same page, make sure to save it in a static variable and to re-use it. bxClient = BxClient.BxClient(_account, _password, _domain, _isDev, _host) try: _language = "en" # // a valid language code (e.g.: "en", "fr", "de", "it", ...) _queryText = "whit" # // a search query to be completed _textualSuggestionsHitCount = 10 # //a maximum number of search textual suggestions to return in one page #//create search request bxRequest = BxAutocompleteRequest.BxAutocompleteRequest( _language, _queryText, _textualSuggestionsHitCount) bxSearchRequest = bxRequest.getBxSearchRequest() _facets = BxFacets.BxFacets() _facets.addCategoryFacet() bxSearchRequest.setFacets(_facets) #//set the request
import BxData ,BxClient _account = "boxalino_automated_tests" _password = "******" _domain = "" _languages = [] _languages.append('en') _isDev = False _isDelta = False _logs = [] _print = True BxClient.BxClient.LOAD_CLASSES bxData = BxData.BxData(BxClient.BxClient(_account, _password, _domain), _languages, _isDev,_isDelta) try: #/** #* Publish choices #*/ #//your choie configuration can be generated in 3 possible ways: dev (using dev data), prod (using prod data as on your live web-site), prod-test (using prod data but not affecting your live web-site) _isTest = False _logs.append("force the publish of your choices configuration: it does it either for dev or prod (above parameter) and, if isDev is false, you can do it in prod or prod-test<br>") bxData.publishChoices(_isTest) #/** #* Prepare corpus index #*/ _logs.append("force the preparation of a corpus index based on all the terms of the last data you sent ==> you need to have published your data before and you will need to publish them again that the corpus is sent to the index<br>") bxData.prepareCorpusIndex() #/** #* Prepare autocomplete index #*/
import BxClient import BxRequest import BxSearchRequest account = "csharp_unittest" password = "******" domain = "" logs = [] _print = True #Create the Boxalino Client SDK instance #N.B.: you should not create several instances of BxClient on the same page, make sure to save it in a static variable and to re-use it. bxClient = BxClient.BxClient(account, password, domain) try : language = "en" # // a valid language code (e.g.: "en", "fr", "de", "it", ...) queryText = "women pack" # // a search query to be completed hitCount = 10 # //a maximum number of search result to return in one page #//create search request bxRequest = BxSearchRequest.BxSearchRequest(language, queryText, hitCount) #BxRequest.BxRequest.setQueryText( queryText) #//add the request bxClient.addRequest(bxRequest) #print bxClient.getThriftChoiceRequest() #//make the query to Boxalino server and get back the response for all requests bxResponse = bxClient.getResponse() #//check if the system has generated sub phrases results if bxResponse.areThereSubPhrases(): logs.append("No results found for all words in " +queryText + ", but following partial matches were found:<br\>")