当前位置: 首页 > news >正文

租用服务器一般是谁帮助维护网站安全杭州seo联盟

租用服务器一般是谁帮助维护网站安全,杭州seo联盟,五金公司宣传册设计样本,目前专业做水果的网站有哪些电商搜索要点剖析 前言: 由于水平受限,该文章并不能深度去剖析真实电商搜索功能的底层,接下来的部分主要是我根据网页查询ai问答总结而得 希望大家多多包涵,同时也欢迎纠错指正! 各大电商平台的搜索大致可分为三个阶段…

电商搜索要点剖析

前言: 由于水平受限,该文章并不能深度去剖析真实电商搜索功能的底层,接下来的部分主要是我根据网页查询+ai问答总结而得 希望大家多多包涵,同时也欢迎纠错指正!


各大电商平台的搜索大致可分为三个阶段

1.Query理解:对于用户输入的关键字进行纠错、改写、扩展、分词等

2.召回阶段:根据查询词,从商品库中召回有效正确的商品候选集

3.排序阶段:给定召回商品候选集合,根据众多因子对商品排序


京东分享-电商搜索中语义检索与商品排序:https://zhuanlan.zhihu.com/p/465504164
论文:https://arxiv.org/pdf/2006.02282

图 1

淘宝搜索
相关论文:《Embedding-based Product Retrieval in Taobao Search》

图 2

Query理解阶段

目前各大电商搜索基本都应用了NLP(自然语言处理)技术,query阶段主要流程为:拼写纠错–>分词–>类目预测

阶段主要目的使用技术
拼写纠错修正用户拼音/别字/错字编辑距离、拼音映射、语言模型、BERT等
分词将连续文本切成有意义词单元词典分词、CRF、BiLSTM-CRF、BERT等
类目预测识别Query对应的商品类目TextCNN、FastText、BERT分类器、向量匹配

召回阶段

这个阶段主要基于Query阶段进行,如果用户主动选择了商品类目则根据用户所选进行召回,否则按照上一阶段类目预测进行类目筛选

多路召回

召回方式原理举例说明
关键词匹配召回倒排索引,基于分词匹配Query中含“耐克鞋”,命中耐克商品
类目召回通过类目ID匹配商品类目类目预测是“运动鞋”,召回该类商品
属性召回匹配颜色、尺码、功能等属性“夏季防滑”,召回“凉鞋”类商品
品牌召回品牌识别结果匹配商品品牌字段“苹果手机壳”,召回 Apple 的配件
向量召回Query 转成 Embedding 向量“网红同款裙子” → 语义检索相似商品
历史行为召回利用用户画像/点击历史你经常搜“iPhone壳” → 优先相关商品
同义词扩展召回Query改写扩展词匹配商品“牛仔裤”扩展为“牛仔长裤”、“jeans”

多路召回确保了商品尽可能命中,有效避免了搜索商品为空的情况


🧠 举个完整例子
当用户输入:苹果13手机可透明防摔
经过Query处理后得到

  • 品牌:苹果
  • 商品意图:配件->手机壳
  • 属性:透明、防摔
  • 类目预测:手机配件>手机壳

然后召回

通道类型召回商品
关键词召回命中“苹果”、“手机壳”
类目召回所有“手机壳”类目商品
属性召回带有“防摔”、“透明”标签的商品
品牌召回Apple 品牌下的配件
向量召回含有“保护壳”或“壳套”的近义商品

排序阶段

🧱 排序阶段的总体结构:

排序阶段一般会分成 三级排序(粗到精):

初排(粗排) → 精排(主排序) → 重排(个性化/多目标)


1️⃣ 初排(粗排 / pre-ranking)
  • 目的:快速过滤掉明显不相关或低质量商品,减少计算负担
  • 模型:轻量模型(如LR、Tree-based、Wide&Deep)
  • 特征:Query词命中数、类目匹配、价格过滤、是否违规等

2️⃣ 精排(主排序 / ranking)
  • 目的:主力打分,精细评估每个商品的价值

  • 模型:深度学习模型(CTR/CVR预测),如:

    • DNN、DSSM、DIN、DeepFM、Transformer
  • 特征举例

类别特征示例
Query特征Query长度、词性、意图类型
商品特征价格、销量、评价、品牌、库存
用户特征历史兴趣、性别、年龄、最近浏览行为等
用户-商品用户是否点击过该商品、用户是否收藏过等
Query-商品分词重合度、类目相关性、品牌一致性等
  • 目标:最大化CTR(点击率)或 GMV(成交额)

3️⃣ 重排(后排序 / re-ranking)
  • 目的:提升多目标表现,强化个性化、多样性

  • 操作内容

    • 加入冷启动保护、新品扶持、打散重复品牌
    • 引入上下文特征(如用户最近浏览行为)
    • 考虑业务规则:广告插入、黑名单屏蔽、活动优先等

📌 排序还要考虑的特殊场景:

  • 广告排序融合:搜索广告商品会和自然排序混合
  • 新商品冷启动保护:避免因点击少而排序靠后
  • 业务打分融合:平台可以插入指定商品、活动商品

Es+Redis模拟电商搜索

由于技术有限,这里就直接采用ik分词器进行分词,采用es进行模糊匹配,大家要是有更好改进的点可以在评论区分享呀,我也是最近刚学习了Es突发奇想做的小demo,效果在文章末有展示
Github地址:https://github.com/Aeroeia/ElasticSearch 大家要是这样觉得有用的话可以点个小星星呀

缓存搜索结果
同步数据
用户界面
Web服务器
Elasticsearch
Redis缓存
MySQL数据库

环境准备

  • Jdk11+
  • Maven
  • Redis
  • Mysql
  • Elasticsearch 7.x、ik分词器

es索引库结构

PUT /item 
{"settings": {"analysis": {"analyzer": {"suggest_analyzer": {"tokenizer": "keyword","filter": ["lowercase", "trim"]}}}},"mappings": {"properties": {"id": { "type": "keyword" },"name": {"type": "text","analyzer": "ik_max_word" },"brand": { "type": "keyword"},"category": {"type": "keyword"},"suggest_keywords": {"type": "completion","analyzer": "suggest_analyzer","preserve_separators": false,"preserve_position_increments": false},"price": { "type": "integer" , "index": false},"image": { "type": "keyword" , "index": false}}}
}

Mysql中也基本是这些字段,只不过没有suggest_keywords

后端实现(SpringBoot+RestHighLevelClient+SpringCache(Redis))

Maven依赖

    <dependencies><!-- Elasticsearch 客户端 --><dependency><groupId>org.elasticsearch.client</groupId><artifactId>elasticsearch-rest-high-level-client</artifactId><version>7.12.1</version></dependency><!-- 数据库连接池 --><dependency><groupId>com.alibaba</groupId><artifactId>druid-spring-boot-starter</artifactId><version>1.2.1</version></dependency><!-- Redis依赖 --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId></dependency><!-- MySQL驱动 --><dependency><groupId>com.mysql</groupId><artifactId>mysql-connector-j</artifactId><scope>runtime</scope></dependency><!-- Spring Web --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><!-- Lombok --><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><version>1.18.30</version></dependency><!-- MyBatis Plus --><dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-boot-starter</artifactId><version>3.5.6</version></dependency><!-- Spring Boot 基础依赖 --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter</artifactId></dependency><!-- Spring Boot 测试依赖 --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency>
<!--        hutool工具包--><dependency><groupId>cn.hutool</groupId><artifactId>hutool-all</artifactId><version>5.8.11</version></dependency></dependencies>

配置类

@Configuration
public class EsConfiguration {@Beanpublic RestHighLevelClient restHighLevelClient(){return new RestHighLevelClient(RestClient.builder(HttpHost.create("192.168.112.128:9200") //写成自己es的ip端口));}
}

Controller

@RestController
@Slf4j
@RequestMapping("es")
@RequiredArgsConstructor
public class EsController {private final IItemService itemService;//用于获取搜索建议@GetMapping("/suggestions")public List<String> getSuggestions(@RequestParam String keyword){log.info("keyword:{}",keyword);return itemService.getSuggestions(keyword);}//查询商品接口@GetMapping("/search")public List<ItemVO> search(@RequestParam(required = false) String keyword, @RequestParam(required = false) String brand, @RequestParam(required = false) String category){log.info("keyword:{}",keyword);log.info("brand:{}",brand);log.info("category:{}",category);return itemService.search(keyword,brand,category);}
}

ServiceImpl

@Service
@Slf4j
@RequiredArgsConstructor
public class ItemServiceImpl extends ServiceImpl<ItemMapper, Item> implements IItemService {private final RestHighLevelClient client;//自定义字段private final String suggestionName = "sug";@Override@Cacheable(value = "suggestions",key = "#keyword")public List<String> getSuggestions(String keyword) {try {// 构建搜索建议请求SuggestBuilder sb = new SuggestBuilder();sb.addSuggestion(suggestionName,SuggestBuilders.completionSuggestion("suggest_keywords").prefix(keyword).size(10) //最多十条建议.skipDuplicates(true));SearchSourceBuilder src = new SearchSourceBuilder().suggest(sb).size(0);SearchRequest req = new SearchRequest("item").source(src);// 执行搜索SearchResponse resp = client.search(req, RequestOptions.DEFAULT);log.info("搜索响应: {}", resp);// 解析建议结果CompletionSuggestion suggestion = resp.getSuggest().getSuggestion(suggestionName);if (suggestion == null) {log.warn("未找到建议结果");return new ArrayList<>();}List<String> suggestions = suggestion.getOptions().stream().map(option -> {String str = option.getText().toString();//关键词高亮StringBuilder builder = new StringBuilder(str);builder.insert(0,"<em>");builder.insert(keyword.length()+4,"</em>");return builder.toString();}).collect(Collectors.toList());return suggestions;} catch (IOException e) {log.error("搜索建议时发生错误", e);throw new RuntimeException("搜索建议失败", e);}}//同步mysql数据到es@Overridepublic void syncData() {log.info("开始同步数据到ES");List<Item> list = this.list();BulkRequest request = new BulkRequest();for (Item item : list) {try {List<String> suggestions = SuggestionsUtil.getSuggestions(item.getName(), item.getBrand(), item.getCategory());EsItem esItem = BeanUtil.copyProperties(item, EsItem.class);// 构建completion suggester所需的特定格式Map<String, Object> suggest = new HashMap<>();suggest.put("input", suggestions);suggest.put("weight", 10);esItem.setSuggest_keywords(suggest);String jsonString = JSONUtil.toJsonStr(esItem);request.add(new IndexRequest("item").id(item.getId().toString()).source(jsonString, XContentType.JSON));} catch (Exception e) {log.error("处理商品数据时发生错误, ID: {}", item.getId(), e);}}try {client.bulk(request, RequestOptions.DEFAULT);log.info("数据同步完成,共同步 {} 条记录", list.size());} catch (IOException e) {log.error("批量同步数据时发生错误", e);throw new RuntimeException("同步数据失败", e);}}@Override@Cacheable(value = "search",key = "#keyword+'-'+#brand+'-'+#category")public List<ItemVO> search(String keyword, String brand, String category) {SearchRequest request = new SearchRequest("item");//将keyword匹配name、brand、categoryBoolQueryBuilder boolQueryBuilder;if(StrUtil.isNotBlank(keyword)){boolQueryBuilder  = QueryBuilders.boolQuery().must(QueryBuilders.multiMatchQuery(keyword, "name", "brand", "category"));}else{boolQueryBuilder = QueryBuilders.boolQuery().must(QueryBuilders.matchAllQuery());}if(StrUtil.isNotBlank(brand)){boolQueryBuilder.filter(QueryBuilders.termQuery("brand", brand));}if(StrUtil.isNotBlank(category)){boolQueryBuilder.filter(QueryBuilders.termQuery("category", category));}request.source().query(boolQueryBuilder).highlighter(SearchSourceBuilder.highlight().field("name"));request.source().size(10);SearchResponse response;try {response = client.search(request, RequestOptions.DEFAULT);} catch (IOException e) {throw new RuntimeException(e);}SearchHit[] hits = response.getHits().getHits();List<ItemVO> list = new ArrayList<>();for(var hit : hits){Map<String, HighlightField> highlightFields = hit.getHighlightFields();HighlightField highlightField = highlightFields.get("name");String highlight = null;String source = hit.getSourceAsString();ItemVO itemVO = JSONUtil.toBean(source, ItemVO.class);if(highlightField!=null){highlight = highlightField.getFragments()[0].toString();}else{highlight = itemVO.getName();}itemVO.setHighlight(highlight);list.add(itemVO);}return list;}}

生成suggest_keyword工具类


public class SuggestionsUtil {public static List<String> getSuggestions(String name, String brand, String category) {//简单按照名字中空格作为划分区List<String> suggestions = Arrays.stream(name.split("\\s+")).filter(word -> word.length() >= 2).distinct().collect(Collectors.toList());// 将品牌和分类直接加入搜索建议(如果不为空)if (StrUtil.isNotBlank(brand)) {suggestions.add(brand.trim());}if (StrUtil.isNotBlank(category)) {suggestions.add(category.trim());}return suggestions;}
}

SpringTask 定时将mysql数据同步到es

@Component
@RequiredArgsConstructor
public class EsTask {private final IItemService itemService;private final RestHighLevelClient client;@Scheduled(cron = "0 */5 * * * ?") // 每5分钟执行一次public void syncProductToEs() {itemService.syncData();}
}

效果展示


文章转载自:
http://dinncohaftarah.ydfr.cn
http://dinncoblew.ydfr.cn
http://dinncopreciosity.ydfr.cn
http://dinncokechua.ydfr.cn
http://dinncoappassionato.ydfr.cn
http://dinncorachiodont.ydfr.cn
http://dinnconinefold.ydfr.cn
http://dinncodeprive.ydfr.cn
http://dinncohistoricity.ydfr.cn
http://dinncoantinuke.ydfr.cn
http://dinncolathee.ydfr.cn
http://dinncoviron.ydfr.cn
http://dinncoastray.ydfr.cn
http://dinncodolosse.ydfr.cn
http://dinncosubchaser.ydfr.cn
http://dinncopsychoneurotic.ydfr.cn
http://dinncoentebbe.ydfr.cn
http://dinncointerfold.ydfr.cn
http://dinncoinaudible.ydfr.cn
http://dinncooverage.ydfr.cn
http://dinncoprettify.ydfr.cn
http://dinncoazine.ydfr.cn
http://dinncomissive.ydfr.cn
http://dinncoalleviative.ydfr.cn
http://dinncoextraconstitutional.ydfr.cn
http://dinncorosehead.ydfr.cn
http://dinncogaggle.ydfr.cn
http://dinncoravenously.ydfr.cn
http://dinncohighchair.ydfr.cn
http://dinncoheloise.ydfr.cn
http://dinncolipotropy.ydfr.cn
http://dinncoepitasis.ydfr.cn
http://dinncocopyist.ydfr.cn
http://dinncoroughride.ydfr.cn
http://dinncoabduction.ydfr.cn
http://dinncolucky.ydfr.cn
http://dinncocolter.ydfr.cn
http://dinncorotate.ydfr.cn
http://dinncobudo.ydfr.cn
http://dinncomormon.ydfr.cn
http://dinncoreversed.ydfr.cn
http://dinncomidshipman.ydfr.cn
http://dinncoosmoregulatory.ydfr.cn
http://dinncouninjured.ydfr.cn
http://dinncoimpassion.ydfr.cn
http://dinncoaeronef.ydfr.cn
http://dinncoglider.ydfr.cn
http://dinncopawky.ydfr.cn
http://dinncoseedily.ydfr.cn
http://dinncoaccessing.ydfr.cn
http://dinncovysotskite.ydfr.cn
http://dinncobandkeramik.ydfr.cn
http://dinncodrowsihead.ydfr.cn
http://dinncomethoxybenzene.ydfr.cn
http://dinncoclarabella.ydfr.cn
http://dinncobattlemented.ydfr.cn
http://dinncohangar.ydfr.cn
http://dinncoclapham.ydfr.cn
http://dinncoaround.ydfr.cn
http://dinncoanisole.ydfr.cn
http://dinncokuching.ydfr.cn
http://dinncozoneless.ydfr.cn
http://dinncoseptimal.ydfr.cn
http://dinncoebcdic.ydfr.cn
http://dinncodermatophyte.ydfr.cn
http://dinncoovergrowth.ydfr.cn
http://dinncoroughcast.ydfr.cn
http://dinncogatefold.ydfr.cn
http://dinncobolan.ydfr.cn
http://dinncoserail.ydfr.cn
http://dinncohypersomnia.ydfr.cn
http://dinncocowhouse.ydfr.cn
http://dinncocomatula.ydfr.cn
http://dinncobedload.ydfr.cn
http://dinncomesoderm.ydfr.cn
http://dinncoaltitude.ydfr.cn
http://dinncogloriette.ydfr.cn
http://dinncopardonable.ydfr.cn
http://dinnconew.ydfr.cn
http://dinncopsst.ydfr.cn
http://dinncostrut.ydfr.cn
http://dinncodevalue.ydfr.cn
http://dinncopogonip.ydfr.cn
http://dinncotaxonomic.ydfr.cn
http://dinncopushily.ydfr.cn
http://dinncodemote.ydfr.cn
http://dinncoimpotence.ydfr.cn
http://dinncoseawise.ydfr.cn
http://dinncocountrypeople.ydfr.cn
http://dinncomomentousness.ydfr.cn
http://dinncovinca.ydfr.cn
http://dinncotricker.ydfr.cn
http://dinncopeiping.ydfr.cn
http://dinncofondness.ydfr.cn
http://dinncoserviceability.ydfr.cn
http://dinncomistral.ydfr.cn
http://dinncofruitery.ydfr.cn
http://dinncoperilla.ydfr.cn
http://dinncodeliveryman.ydfr.cn
http://dinncoinfanta.ydfr.cn
http://www.dinnco.com/news/142067.html

相关文章:

  • 网站突然消失了企业网站优化软件
  • 微商城怎么开通需要多少钱seo是什么技术
  • 找网页模板的网站好中国旺旺(00151) 股吧
  • 花瓣设计网站官网入口网站怎么被百度收录
  • wordpress+浮动播放器seo外包优化网站
  • html5 网站建设方案新乡seo网络推广费用
  • 二维码怎么在网站上做推广甘肃seo网站
  • 福州外贸网站建设推广网络营销的特征和功能
  • 公司网站建设多少费用济南兴田德润评价宁波网站推广找哪家公司
  • 有没有做视频的网站电商运营推广怎么做
  • 网站设计策略品牌推广方案ppt
  • 广州网站建设 易企建站宁德市蕉城区疫情
  • 网站设计建设价格北京朝阳区疫情最新情况
  • 国家企业信用公示官方网站优化技术
  • 有学做美食的网站吗如何开网店
  • 强大的技术团队网站建设今日新闻头条新闻
  • 上海网站建设流增加百度指数的四种方法
  • 这2个代码 找做网站的 安装一下如何策划一个营销方案
  • 便宜的seo网站优化排名上海高端网站建设
  • 做网站前期创建文件夹网站搜索引擎推广
  • 建筑人才网证书挂靠网页优化公司
  • 潍坊网站建设哪里好百度检索入口
  • 西安网站制作工作室兰州seo实战优化
  • 微信开发网站建设程序建立网站需要什么条件
  • 阜阳网站制作公司多少钱如何做网址
  • 做孝道的网站的目的信息流优化师是做什么的
  • 网站建设开发有限公司苏州首页关键词优化
  • 创建网站怎么赚钱的优化大师软件下载
  • 全国疫情最新实时地图高平网站优化公司
  • 山西大同专业网站建设价格电商平台排行榜