更新SOLR索引上的特定字段 [英] Update specific field on SOLR index
问题描述
我想用solr搜索文章
I want to using solr for search on articles
我有3张桌子:
- 组(id,组名)
- ArticleBase(id,groupId和其他一些字段)
- Article(id,articleBaseId,title,date,...)
在solr schema.xml文件中,我只定义了与ArticleBase表混合的所有article字段(用于在solr上使用一个索引),例如:(id,articleBaseId,groupId,...)
in solr schema.xml file i just define all article field that mixed with ArticleBase table (for use one index on solr) like this: (id, articleBaseId, groupId, ...)
问题:管理员想更改组(ArticleBase),因此我必须在solr中更新(或替换)所有索引的文章.正确的 ?
我只能在solr索引中更新groupId吗?
problem: Admin want to change group (ArticleBase), therefore i must update (or replace) all indexed article in solr. right ?
can i update groupId only in solr index ?
有什么解决方案吗?
注意:文章表包含2亿多条文章,我仅将solr用于索引(除文章ID外,不存储任何字段数据)
Note:Article table contains more than 200 million article, and i using solr for index only (not store any field data except article id)
推荐答案
Solr不支持正在更新各个字段,但是存在一个 JIRA问题 (截至撰写本文时已接近3岁).
Solr does not support updating individual fields yet, but there is a JIRA issue about this (almost 3 years old as of this writing).
在实施此方法之前,您必须更新整个文档.
Until this is implemented, you have to update the whole document.
UPDATE: as of Solr 4+ this is implemented, here's the documentation.
这篇关于更新SOLR索引上的特定字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!