cancel
Showing results for 
Search instead for 
Did you mean: 

Solr not able to return the correct product after searching by product code or other code

Former Member
0 Kudos

Hi, i wanted to indexing the products codes with solr using the springELValueProvider and precising the type of the indexed property as String, however when i try to search for a product using his code in the search bar i get a few unexpected results for the products. some unwanted content are also displaying. for example when i am going to search "abc def" then two product is showing one is "abc" and another is "abc def". same for colon also when i am searching "abc:def" then "abc" and "abc:def" both product is showing. schema.xml.

  <fieldType name="keyword" class="solr.TextField" positionIncrementGap="100">
              <analyzer>
                  <tokenizer class="solr.KeywordTokenizerFactory" />
                  <filter class="solr.LowerCaseFilterFactory"/>
              </analyzer>
          </fieldType>

 

      <dynamicField name="*_keyword" type="keyword" indexed="true" stored="true" />
      <dynamicField name="*_keyword_mv" type="keyword" indexed="true" stored="true" multiValued="true" />
 

can you guys explain where i am wrong. if any information please let me know. thanks in advance.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Can you please analyse your query here you can see * so point is that you want exact search. So from HMC>System > facet search config> solr config here change mode of solr and

run your query as follow:

 $solrIndexedType= your index name
 INSERT_UPDATE SolrIndexedProperty;solrIndexedType(identifier)[unique=true];name[unique=true];ftsQuery;ftsQueryMinTermLength;ftsQueryBoost;ftsWildcardQuery;ftsWildcardQueryMinTermLength;ftsWildcardQueryType(code);ftsWildcardQueryBoost;ftsPhraseQuery;ftsPhraseQuerySlop;ftsPhraseQueryBoost
 ;$solrIndexedType;code;true;4;100;
Former Member
0 Kudos

Hi Abhishek, thanks for reply, but sorry for that i am not understand your point. can you please elaborate. if any example in wiki or any other place it will be help full for me. in solr keyword filed as below in solr.impex

 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
                                     ;$solrTPubsIndexedType                        ;publicationNumber        ;keyword    ;                    ;                        ;                            ;                            ;                                    ;                                    ;springELValueProvider ;publicationNumber
                                     ;$solrTPubsIndexedType                        ;publicationNumberText    ;keyword    ;                    ;                        ;                            ;                            ;                                    ;                                    ;springELValueProvider ;publicationNumber
 

above sample example where need to applied.

Former Member
0 Kudos

Hi Ajani,

OOTB search query you can refer in solrstat log here you will find ootb query adds some * in query. To find your result you need to customize it accordingly to yours. And for this I will give quick solution just change your solr made lagacy to default and update your query using solr.impex(sample data).

Sample Query for your reference: (code_text:(6871ssx2-1^200.0 OR 6871ssx2-1*^100.0 OR 6871ssx2-1~^50.0)) AND (name_text_en:(6871ssx2-1^120.0 OR 6871ssx2-1*^60.0 OR 6871ssx2-1~^30.0)) AND (brandName_text:(6871ssx2-1^60.0 OR 6871ssx2-1*^30.0 OR 6871ssx2-1~^15.0))