cancel
Showing results for 
Search instead for 
Did you mean: 

Solr attributes not giving Expected results ,

Former Member
0 Kudos

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);
     }


Former Member
0 Kudos

First a couple of questions:

  1. Is the field sale a direct attribute of product? If yes, are you sure you have products with attribute sale set to true?

  2. If its not a direct attribute, have you implemented a value provider?

  3. Does your solr index contain any product with sale as true? try accessing the solr directly to find this out.

  4. Is your intention to restrict only auto-suggestions and free text search results and not category results?

Former Member
0 Kudos
 1.Yes, It's direct attribute. and I set some product true and some are set  false.
 
 2. Covered in question 
 
 3.I 'll try.
 
 4. Yes I want restrict only auto -suggest and free test search.


Former Member
0 Kudos

In that case can you please post the solr query that is getting fired and a sample doc where the sale value is set to true?

Another stupid question - You sure you have overridden the bean with your newly implemented class/bean?

Former Member
0 Kudos

Yes Mr. Jha When I overrided the class then I checked using debugger it's going in newly implemented method. and my solr query is looks like as follows when i search for bag. localhost:9001/search?q=BAG:relevance:sale:false&pageSize=12&page=0&sort=relevance

Former Member
0 Kudos

The query looks good so, at this moment I could only suggest that the data in solr is not correct.

And if the data is correct then I am afraid the only way to know whats wrong is to debug because everything else looks good to me.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

First you need to be sure that you can get the sale value from "http://localhost:9001/solrfacetsearch/hybris/login.jsp"

Former Member
0 Kudos

Thansk Mr Yang,I am getting all values but some unexpected values are coming.

Former Member
0 Kudos

Is it included the "sale" field which is value false in this results?