solr Hybris多词产品搜索无法正常工作

byqmnocz  于 2022-11-05  发布在  Solr
关注(0)|答案(1)|浏览(230)

当我执行一个多字搜索,例如“番茄酱热狗”,尽管在SOLR中索引了以下产品:

  • 名称:番茄酱热狗
  • 产品名称:番茄酱
  • 名称:热狗大号

SOLR结果按以下顺序显示:
1.名称:热狗大号
1.产品名称:番茄酱
1.名称:番茄酱热狗
而不是把“番茄酱热狗”放在第一位,因为是一个完全匹配。
我的当前配置是:

Free text Search:
INSERT_UPDATE SolrSearchQueryProperty; indexedProperty(name, solrIndexedType(identifier))[unique = true]; searchQueryTemplate(name, indexedType(identifier))[unique = true][default = DEFAULT:$solrIndexedType]; ftsQuery[default = false]; ftsQueryBoost; ftsQueryMinTermLength[default = 2];
                                 ; name:$solrIndexedType                                            ;                                                                                                      ; TRUE                     ; 1000         ;                                   ;
                                 ; description:$solrIndexedType                                     ;                                                                                                      ;                          ;              ;                                   ;
                                 ; summary:$solrIndexedType                                         ;                                                                                                      ;                          ;              ;                                   ;
                                 ; manufacturerName:$solrIndexedType                                ;                                                                                                      ; TRUE                     ; 40           ;                                   ;
                                 ; manufacturerAID:$solrIndexedType                                 ;                                                                                                      ; TRUE                     ; 100          ;                                   ;
                                 ; brandName:$solrIndexedType                                       ;                                                                                                      ; TRUE                     ; 800          ;                                   ;
                                 ; categoryName:$solrIndexedType                                    ;                                                                                                      ;                          ;              ;                                   ;
                                 ; allCategories:$solrIndexedType                                   ;                                                                                                      ;                          ;              ;                                   ;
                                 ; category:$solrIndexedType                                        ;                                                                                                      ;                          ;              ;                                   ;
                                 ; brand:$solrIndexedType                                           ;                                                                                                      ; TRUE                     ; 800          ;                                   ;

Fuzzy Search:
INSERT_UPDATE SolrSearchQueryProperty; indexedProperty(name, solrIndexedType(identifier))[unique = true]; searchQueryTemplate(name, indexedType(identifier))[unique = true][default = DEFAULT:$solrIndexedType]; ftsFuzzyQuery[default = false]; ftsFuzzyQueryBoost; ftsFuzzyQueryMinTermLength[default = 2]; ftsFuzzyQueryFuzziness[default = 1];
                                 ; name:$solrIndexedType                                            ;                                                                                                      ; TRUE                          ; 100               ;                                        ;                                    ;
                                 ; description:$solrIndexedType                                     ;                                                                                                      ;                               ;                   ;                                        ;                                    ;
                                 ; summary:$solrIndexedType                                         ;                                                                                                      ;                               ;                   ;                                        ;                                    ;
                                 ; manufacturerName:$solrIndexedType                                ;                                                                                                      ;                               ;                   ;                                        ;                                    ;
                                 ; manufacturerAID:$solrIndexedType                                 ;                                                                                                      ;                               ;                   ;                                        ;                                    ;
                                 ; brandName:$solrIndexedType                                       ;                                                                                                      ; TRUE                          ; 80                ;                                        ;                                    ;
                                 ; categoryName:$solrIndexedType                                    ;                                                                                                      ;                               ;                   ;                                        ;                                    ;
                                 ; allCategories:$solrIndexedType                                   ;                                                                                                      ;                               ;                   ;                                        ;                                    ;
                                 ; category:$solrIndexedType                                        ;                                                                                                      ;                               ;                   ;                                        ;                                    ;
                                 ; brand:$solrIndexedType                                           ;                                                                                                      ; TRUE                          ; 80                ;                                        ;                                    ;

Phrase Search:
INSERT_UPDATE SolrSearchQueryProperty; indexedProperty(name, solrIndexedType(identifier))[unique = true]; searchQueryTemplate(name, indexedType(identifier))[unique = true][default = DEFAULT:$solrIndexedType]; ftsPhraseQuery[default = false]; ftsPhraseQueryBoost; ftsPhraseQuerySlop[default = 6];
                                 ; name:$solrIndexedType                                            ;                                                                                                      ; TRUE                           ; 1500               ;                                ;
                                 ; description:$solrIndexedType                                     ;                                                                                                      ;                                ;                    ;                                ;
                                 ; summary:$solrIndexedType                                         ;                                                                                                      ;                                ;                    ;                                ;
                                 ; manufacturerName:$solrIndexedType                                ;                                                                                                      ;                                ; 80                 ;                                ;
                                 ; manufacturerAID:$solrIndexedType                                 ;                                                                                                      ;                                ;                    ;                                ;
                                 ; brandName:$solrIndexedType                                       ;                                                                                                      ; TRUE                           ; 1000               ;                                ;
                                 ; categoryName:$solrIndexedType                                    ;                                                                                                      ;                                ;                    ;                                ;
                                 ; allCategories:$solrIndexedType                                   ;                                                                                                      ;                                ;                    ;                                ;
                                 ; category:$solrIndexedType                                        ;                                                                                                      ;                                ;                    ;                                ;
                                 ; brand:$solrIndexedType                                           ;                                                                                                      ; TRUE                           ; 1000               ;                                ;

Wildcard Query
INSERT_UPDATE SolrSearchQueryProperty; indexedProperty(name, solrIndexedType(identifier))[unique = true]; searchQueryTemplate(name, indexedType(identifier))[unique = true][default = DEFAULT:$solrIndexedType]; ftsWildcardQuery[default = false]; ftsWildcardQueryType(code)[default = POSTFIX]; ftsWildcardQueryBoost; ftsWildcardQueryMinTermLength[default = 2];
                                 ; name:$solrIndexedType                                            ;                                                                                                      ; TRUE                             ;                                              ; 10                   ;                                           ;
                                 ; description:$solrIndexedType                                     ;                                                                                                      ;                                  ;                                              ; 0                    ;                                           ;
                                 ; summary:$solrIndexedType                                         ;                                                                                                      ;                                  ;                                              ; 0                    ;                                           ;
                                 ; manufacturerName:$solrIndexedType                                ;                                                                                                      ;                                  ;                                              ; 0                    ;                                           ;
                                 ; manufacturerAID:$solrIndexedType                                 ;                                                                                                      ;                                  ;                                              ; 0                    ;                                           ;
                                 ; brandName:$solrIndexedType                                       ;                                                                                                      ; TRUE                             ;                                              ; 40                   ;                                           ;
                                 ; categoryName:$solrIndexedType                                    ;                                                                                                      ;                                  ;                                              ; 0                    ;                                           ;
                                 ; allCategories:$solrIndexedType                                   ;                                                                                                      ;                                  ;                                              ; 0                    ;                                           ;
                                 ; category:$solrIndexedType                                        ;                                                                                                      ;                                  ;                                              ; 0                    ;                                           ;
                                 ; brand:$solrIndexedType                                           ;                                                                                                      ; TRUE                             ;                                              ; 45                   ;                                           ;

为了实现更准确的多词搜索,我必须修改哪些参数?

eblbsuwk

eblbsuwk1#

建议事项

  • 将查询参数sow=falsestandard/”lucene”edismax查询解析器配合使用,以启用查询时多词同义词.
  • query-time analyzer中切换到SynonymGraphFilter。在大多数情况下,您不希望在index-time analyzer中包含任何类型的同义词扩展。
  • SynonymGraphFilter指定expand="true"选项(或保留默认值不变),以便将所有替代项添加到查询中。
  • 请注意,当在具有不同(足够)query-time analysis的字段上使用sow=false和edismax时,生成的查询的形式将与sow=true时生成的查询的形式不同;这个差值can change both matching and ranking

相关问题