I'm not entirely sure if this is a commerce or CMS query, but now I try this forum.
I'm setting up a new Episerver website with both CMS and Commerce. I'm using the latest version (9.23).
We are currently in the early stages of development, so there are still a lot of things that haven't settled yet. I know that we will use Solr as the search engine, but our business requirements may dictate that we don't want to use the query mechanism i the Episerver Solr35SearchProvider. I know that we are going to make changes, but I just don't know if it is worth making the changes in the search provider or if it is easier to start from the bottom and build our own search integration to Solr.
The CMS editors will need to be able to drag Commerce content into the CMS pages. This is possible from the Asset widget in the CMS editor. The Asset widget also have a search field, that I was hoping to be able to use to search in the Commerce content. However I can't get it to work.
I have configured the search provider in the Mediachase.search.config file in both my CMS and my Commerce Manager websites. Everyting is working on the Commerce Manager website, and when I try to search from the Commerce manager, my search provider is hit, and it queries Solr for search results.
When I try from the CMS editor, I get no search results.
I have tried setting up breakpoints in the SearchProvider, and these breakpoints get hit from the Commerce Manager, but not when I search from the CMS editor.
What am I missing? Isn't it possible to use the Commerce search providers for searching commerce content in the CMS editor? Then how can I setup commerce content search in the CMS editor?
Thank you for your help
I don't think you can search for products from Asset gadget. Each search box has its own "search area" which is corresponding to a type of search. The only places where you can search for products are the product list (the tree in the left site of Catalog UI) and in Catalog gadget, and global search.
Thank you for your reply.
I may not have used the correct words for the gadgets.
I have tried searching on this page (my local machine): http://localhost:65063/EPiServer/Commerce/Catalog. Is that the Catalog UI? I'm running locally on IIS Express with loads of breakpoints in my Search Provider, but I find no content, and no breakpoints get hit.
I have configuret my Search Provider in Mediachase.search.config on the website, but it doesn't seem to be used. Have I set it up the wrong place?
EPiServer/Commerce/Catalog is indeed Catalog UI, but there are many gadgets in that view - can you take a screenshot of the gadget you want to search in?
I have attached two screenshots. One from Commerce and one from CMS. I hope that you can make sense of what is shown.
Screenshot from CommerceUI:
Screenshot from CMS editor - Commerce view as part of the Asset gadget(?):
You should be able to search with search providers in those two gadgets. What do you have your Mediachase.Search.config? Can you post the content here?
Sure. See below.
The search provider is accessed, when I search from Commerce Manager website (same mediachase.search.config file), and if I try to search using my own code on the regular website.
I know that I have changed the name of the index specified in the "Indexers" element. I make sure that I use the correct Solr core from the Search method of the Search provider. This works from both Commerce Manager and my own code, but if I try to seach using the above gadgets, my breakpoints in the search provider is not hit.
<?xml version="1.0" encoding="utf-8"?><Mediachase.Search> <SearchProviders defaultProvider="SolarSolr35SearchProvider"> <providers> <!-- Improved SOLR Search Provider (still in development, will replace SolrSearchProvider) --> <!-- queryBuilderType - specifies class that is used to build the query --> <!-- url - URL to a solr server --> <!-- shareCores - if "true" the cores will be shared between applications meaning two different apps will reuse catalog core and store applicationName with the index --> <!-- commitWithin - the maximum latency (in milliseconds) between a batch of index updates being sent the the solr engine and the commit operation for those changes. --> <!-- maximumBatchSize - the maximum number of indexing commands sent to the solr engine per HTTP post --> <add name="SolarSolr35SearchProvider" type="SolarB2bEpiserver.DataAccess.SolrSearchProvider.SolrSearchProvider, SolarB2bEpiserver.DataAccess.SolrSearchProvider" queryBuilderType="SolarB2bEpiserver.DataAccess.SolrSearchProvider.SolrSearchQueryBuilder, SolarB2bEpiserver.DataAccess.SolrSearchProvider" url="http://DEPIDEVS007:8983/solr" shareCores="true" facetLocalizedFieldValuesOnly="true" commitWithin="10000" maximumBatchSize="50" />
Thanks for the config file. It looks correct.
The search in those two gadgets use SearchFilterHelper in Mediachase.Commerce.Website, which internally uses SearchManager, and eventually reaches the SearchProvider.
However, the search result is cached - perhaps it's the reason your breakpoint did not hit?
You can download Mediachase.Commerce.Website, which is open source, build it and debug it directly, btw.
Oh, I have already downloaded the Mediachase.Commerce.Website project, but I haven't had a look at it that much yet.
I have tried to include it in my solution, and then build and deploy it, however I get an Excepiton when I login to /episerver. See stack traces below.
As far as I can see, the MigrateWishlist function in EPiServer.Business.Commerce.HttpModules.ProfileModuleMigrateWishlist tries to access Mediachase.Commerce.Website in version 184.108.40.206. That fails because I can't version my copy of Mediachase.Commerce.Website the same way, and I can't give it the same PublicKeyToken.
I have tried to comment out any specific references to the assembly from my web.config, and I have removed references to the original assembly form my other projects.
Do you have any idear how I can work around this issue?
=== Pre-bind state information === LOG: DisplayName = Mediachase.Commerce.Website, Version=220.127.116.11, Culture=neutral, PublicKeyToken=6e58b501b34abce3 (Fully-specified) LOG: Appbase = file:///D:/Source/AOL/Repos/SOLB2B/SolarB2bEpiserver/SolarB2bEpiserver/ LOG: Initial PrivatePath = D:\Source\AOL\Repos\SOLB2B\SolarB2bEpiserver\SolarB2bEpiserver\bin Calling assembly : EPiServer.Business.Commerce, Version=18.104.22.168, Culture=neutral, PublicKeyToken=8fe83dea738b45b7. === LOG: This bind starts in default load context. LOG: Using application configuration file: D:\Source\AOL\Repos\SOLB2B\SolarB2bEpiserver\SolarB2bEpiserver\web.config LOG: Using host configuration file: C:\Users\kako-admin\Documents\IISExpress\config\aspnet.config LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. LOG: Post-policy reference: Mediachase.Commerce.Website, Version=22.214.171.124, Culture=neutral, PublicKeyToken=6e58b501b34abce3 LOG: Attempting download of new URL file:///C:/Users/kako-admin/AppData/Local/Temp/3/Temporary ASP.NET Files/root/346c8e96/a00b601c/Mediachase.Commerce.Website.DLL. LOG: Attempting download of new URL file:///C:/Users/kako-admin/AppData/Local/Temp/3/Temporary ASP.NET Files/root/346c8e96/a00b601c/Mediachase.Commerce.Website/Mediachase.Commerce.Website.DLL. LOG: Attempting download of new URL file:///D:/Source/AOL/Repos/SOLB2B/SolarB2bEpiserver/SolarB2bEpiserver/bin/Mediachase.Commerce.Website.DLL. WRN: Comparing the assembly name resulted in the mismatch: Major Version ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated. Stack Trace:
[FileLoadException: Could not load file or assembly 'Mediachase.Commerce.Website, Version=126.96.36.199, Culture=neutral, PublicKeyToken=6e58b501b34abce3' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
EPiServer.Business.Commerce.HttpModules.ProfileModule.MigrateWishlist(CustomerContact customerContact, IMarket currentMarket, String anonymousID) +0
EPiServer.Business.Commerce.HttpModules.ProfileModule.Profile_MigrateAnonymous(Object sender, ProfileMigrateEventArgs pe) +658
System.Web.Profile.ProfileModule.OnEnter(Object source, EventArgs eventArgs) +9951361
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69
You will need to update Properties\AssemblyInfo.cs to add these two lines. Then update your webconfig to change the binding redirect to Mediachase.Commerce.Website (make PublicKeyToken = "null"
[assembly: AssemblyVersion("188.8.131.52")] [assembly: AssemblyInformationalVersion("184.108.40.206")]
Unfortunately that didn't work. It seems that EPiServer.Business.Commerce expects to find a Mediachase.Commerce.Website with PublicKeyToken=6e58b501b34abce3. You may be able to use bindingredirect to specify another version of the .dll file, but I don't think you can use bindingredirect to specify a different PublicKeyToken.
However I have solved the problem. I turned on debug logging on "Mediachase". Yes, I guess it was a bit overkill, but I needed some information on what was going on :) I found this error message in the log:
System.IO.FileNotFoundException: Could not find file 'D:\<path>\Configs\Mediachase.Search.Filters.config'.File name: 'D:\<path>\Configs\Mediachase.Search.Filters.config' at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean checkHost) at System.IO.StreamReader..ctor(String path) at Mediachase.Commerce.Website.Search.SearchFilterHelper.get_SearchConfig() at Mediachase.Commerce.Website.Search.SearchFilterHelper.CreateSearchCriteria(String keywords, SearchSort sort) at EPiServer.Business.Commerce.Providers.ProductSearchProviderBase.BindDefaultCatalogs(SearchFilterHelper filter, String keywords) at EPiServer.Business.Commerce.Providers.ProductSearchProviderBase.SearchEntriesInCommerce(String keyword, SearchFilterHelper filter, Int32 pageSize, Boolean cacheResults, TimeSpan cacheTimeout, Boolean getExpired, Boolean getInactive)
Adding a Mediachase.Search.Filters.config file solved the problem.
Thank you for your help in debugging the issue.