You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

求助:Solr 8.0安装TermVectors补丁及解决tvrh参数问题

How to Apply the SOLR-949 Patch for TermVectors in Solr 8.0

Hey Alex, I’ve been in your shoes before—getting stuck on missing parameters in Solr can be frustrating. Let’s break down exactly how to apply that SOLR-949 patch so you can fetch TermVectors using the tvrh parameter in your code. Here’s a step-by-step guide:

Prerequisites First

Make sure you have these tools ready:

  • Git (to apply the patch easily)
  • JDK 8+ (Solr 8.0 requires Java 8)
  • The Solr 8.0 source code (we’ll need to build it after patching)

Step 1: Grab the Solr 8.0 Source Code

If you don’t already have the source, clone the Apache Solr repo and switch to the 8.0.0 tag:

git clone https://github.com/apache/solr.git
cd solr
git checkout tags/solr-8.0.0

Step 2: Download the SOLR-949 Patch

Head to the SOLR-949 issue page, locate the patch attachment (it’ll be a .patch file), and save it to your local machine—note the file path (e.g., ~/downloads/SOLR-949.patch).

Step 3: Apply the Patch

Navigate back to your Solr source root directory and run:

git apply ~/downloads/SOLR-949.patch

If you run into any conflicts (unlikely for a patch targeted at 8.0), you’ll need to manually edit the conflicting files to resolve them. Alternatively, you can use the patch command if git apply doesn’t work:

patch -p1 < ~/downloads/SOLR-949.patch

Step 4: Rebuild Solr from Source

Solr uses Gradle for builds, so run this command to compile and package the patched version:

./gradlew assemble

This will generate the full Solr distribution package (a .tar.gz or .zip file) in the solr/build/distributions/ directory.

Step 5: Replace Your Existing Solr Deployment

  • Stop your running Solr instance first.
  • Back up your current Solr installation directory and data folder (always a smart move before making changes!).
  • Extract the newly built distribution package and replace your old Solr files with the patched ones.
  • If you’re running SolrCloud, make sure to update all nodes with the patched version.

Step 6: Test the Patch

Start Solr back up, then update your code to use the tvrh parameter in SolrQuery:

SolrQuery query = new SolrQuery("your-search-query");
// Enable TermVectors for all fields, or specify specific fields like "title,content"
query.set("tvrh", "true");

QueryResponse response = solrClient.query(query);
// Retrieve the TermVectors results
Map<String, TermVectorResponse> termVectors = response.getTermVectors();

Run your code and verify that you’re now able to fetch the TermVectors data successfully.

Quick Notes

  • If you don’t want to rebuild the entire distribution, you can locate the specific jar file modified by the patch (usually solr-core-x.x.x.jar) and replace just that in your existing installation—though full replacement is more reliable.
  • Keep backups handy so you can roll back if anything goes wrong during the process.

内容的提问来源于stack exchange,提问作者Alex

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 08:50:23