Search Facets not coming up

Vote:
 

I am on Commerce Manager 7.5, using Lucene as search provider. I want to have facets returned by the search provider. I checked that the meta fields are included in the search index. I also matched the field names in the search.filters.config file but still no luck. What am I missing? 

I am using the code below 

 ICatalogSystem system = CatalogContext.Current;
            // Get catalog lists
            CatalogDto catalogs = system.GetCatalogDto();

            // Create Entry Criteria
            CatalogEntrySearchCriteria criteria = new CatalogEntrySearchCriteria();
            // Bind default catalogs if none found
            if (criteria.CatalogNames.Count == 0)
            {
                if (catalogs.Catalog.Count > 0)
                {
                    foreach (CatalogDto.CatalogRow row in catalogs.Catalog)
                    {
                        if (row.IsActive &&
                        row.StartDate <= frameworkcontext.current.currentdatetime && row.enddate>= FrameworkContext.Current.CurrentDateTime)
                        {
                            criteria.CatalogNames.Add(row.Name);
                        }
                    }
                }
            }
criteria.StartingRecord = 0;
            criteria.RecordsToRetrieve = 10;
criteria.Sort = new SearchSort("DisplayName");
            criteria.SearchPhrase = "blues";
            criteria.IgnoreFilterOnLanguage = true;
            // Perform search
            results = manager.Search(criteria);

            criteria.MarketId = _currentMarket.GetCurrentMarket().MarketId; 

CatalogEntryResponseGroup responseGroup = new CatalogEntryResponseGroup(CatalogEntryResponseGroup.ResponseGroup.CatalogEntryInfo);
if (criteria.CatalogNames.Count != 0)
              {
                  
                  Mediachase.Commerce.Catalog.Objects.Entries entriess = sfHelper.SearchEntries(criteria, out count, responseGroup, cacheResults, cacheTimeout);

            ISearchFacetGroup[] facets=     sfHelper.GetFacets(false, cacheTimeout);
         
                 // sfHelper.
                  dataSource = new CatalogIndexSearchDataSource();
                  dataSource.TotalResults = count;
                  dataSource.CatalogEntries = entriess;
}
#88398
Jul 10, 2014 21:13
Vote:
 

Have you setup the Mediachase.Search.Filters.config file for your facets?

Regards

/K

#88417
Jul 11, 2014 16:35
Vote:
 

Yes I setup the Mediachase.Search.Filters.config in the front end project. Is that the right place or should it be in the commerce manager project? 

It looks like below 


          
        
            
                Color
            
            
                
                    
                        Red
                    
                
                
                    
                        Blue
                    
                
                
                    
                        Yellow
                    
                
                
                    
                        Gray
                    
                
            
        
        
            
                Brand
            
            
                
                    
                        Brand Test
                    
                
                
                    
                        test
                    
                
                
                    
                        Brand 3
                    
                
                
                    
                        Brand 4
                    
                
            
        

Where SearchFacet1 and SearchFacet2 are the meta fields that I am trying to include. 

#88418
Jul 11, 2014 16:50
Vote:
 

Can you please share the properties of SearchFacet1 Meta Field (Please Rebuild the Index also from commerce mananger after adding those facets in commerce manager also).

/K

#88419
Edited, Jul 11, 2014 17:00
Vote:
 

Name: SearchFacet1

Friendly Name: SearchFacet1

Type: Short String

Support Multiple Languages: Not checked 

Use in Comparison: checked

Allow Null Values: Checked

Use Encryption: Not Checked 

Allow Search: Checked 

Enable Sorting Search Results: Not Checked 

Include Values in Search Results: Not Checked 

Tokenize: Checked

Include in Default Search: Checked 

#88420
Jul 11, 2014 17:08
Vote:
 

I rebuild the index from commerce manager but still no luck. I am getting the results as expected but not facetgroups.

 

#88421
Jul 11, 2014 17:22
Vote:
 

Did you or anyone find a solution to this? I'm having the exact same problem, my SearchResult returns searchhits but the FacetGroup property is empty. I have added records to the configuration file and added the properties to the index.

#90277
Sep 04, 2014 16:38
Vote:
 

Could you use this code

ISearchFacetGroup[] facets= sfHelper.SearchEntries(criteria).FacetGroups

instead of

ISearchFacetGroup[] facets= sfHelper.GetFacets(false, cacheTimeout)

In GetFacets, it seems that only call SearchEntries with default CreateSearchCriteria with searchquery.

#90296
Edited, Sep 05, 2014 6:31
Vote:
 

No, same result unfortunately. I'm using Lucene. 

#90312
Sep 05, 2014 9:13
Vote:
 

Emelie: Have you set the meta field to searchable? Look in commerce manager, for the meta field sepecified in the mediachase.search.filters.config file. The meta field with the same name sould be set as searchable. This can also be done by code by adding the Searchable attribute to the property.

When this has been set, rerun the index with the "Full Search Index" job.

#90582
Sep 12, 2014 13:47
Vote:
 

I have marked the meta fields as searchable and rebuilt the index but still no luck. 

#90591
Sep 12, 2014 17:07
Vote:
 

[Searchable]
[IncludeInDefaultSearch]
public virtual string ISBN13 { get; set; }

fields with these two attributes makes it search able in CMS Editor mode (Catalog window)

/K

#90594
Sep 12, 2014 17:17
Vote:
 

[Searchable]
[IncludeInDefaultSearch]
public virtual string ISBN13 { get; set; }

fields with these two attributes makes it search able in CMS Editor mode (Catalog window)

/K

#90595
Sep 12, 2014 17:17
Vote:
 

Still having the same issue. I can see values for the Facet fields in Lucene index but facets are not being returned. I am using Luke to have a look at the luncene index. 

#114503
Dec 12, 2014 23:23
Vote:
 

Syed: Can you create a support case on this, and send the code to the support team?

#114687
Dec 18, 2014 11:21
Vote:
 

I think I found the solution.

The search criteria object I was creating using "new CatalogEntrySearchCriteria()" was always sending query without facets to lucene helper function. 

Switching to SearchFilterHelper factory class made it start working. 

SearchFilterHelper helper= new SearchFilterHelper();
// Create Entry Criteria
CatalogEntrySearchCriteria criteria = helper.CreateSearchCriteria("",new SearchSort(""));

Thanks,

Syed

#114809
Edited, Dec 22, 2014 23:15
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.