Skip to Content
0
Former Member
Jun 22, 2015 at 01:32 PM

Solr attributes not giving Expected results ,

365 Views

I added a new Attributes into my Solr.impex based on this attributes sale product should not be listed in search suggestion as well as search result, I did the following changes but unable to get expected results :--

 INSERT_UPDATE SolrIndexedProperty;solrIndexedType(identifier) unique=true];name[unique=true];type(code);sortableType(code);currency[default=false];localized[default=false];multiValue[default=false];useForSpellchecking[default=false];useForAutocomplete[default=false];fieldValueProvider;valueProviderParameter
 ;$solrIndexedType; sale             ;boolean;            ;    ;    ;    ;    ;    ;

And override the textSearch method Like as follows:

 public class DefaultCustomSolrProductSearchService <ITEM> extends DefaultSolrProductSearchService 
 {
     @Override
     public ProductCategorySearchPageData<SolrSearchQueryData, ITEM, CategoryModel> textSearch(
             String text, PageableData pageableData) {
         SolrSearchQueryData searchQueryData = createSearchQueryData();
         searchQueryData.setFreeTextSearch(text);
         List<SolrSearchQueryTermData> searchTermList = new ArrayList<SolrSearchQueryTermData>();
         SolrSearchQueryTermData searchTerm = new SolrSearchQueryTermData();
            searchTerm.setKey("sale");
         searchTerm.setValue(Boolean.FALSE.toString());
         searchTermList.add(searchTerm);
         searchQueryData.setFilterTerms(searchTermList);
         return super.doSearch(searchQueryData, pageableData);
     }