即使模型和特征存储存在,Solr LTR 查询也不起作用?

问题描述 投票:0回答:1

我在我的 solr 集合中配置了 LTR,我能够看到我的特征和模型文件。为了进行测试,我只保留了两个特征和一个非常基本的模型文件。我已经附上了这两个文件。 我可以使用以下查询检索功能:

localhost:8983/solr/waterstest/query?q=:&fl=title,id,description,score,[features 存储=myWatersFeatureStore efi.boostedTitle=列 efi.boostedDescription=加热器]

以上工作正常。我可以用数据检索特征和分数

当我尝试用上传的模型重新排列结果时,问题就来了。以下是我尝试重新排列结果的查询

localhost:8983/solr/waterstest/query?q=title:columns&rq={!ltr 模型=myWatersModel reRankDocs=100 efi.boostedTitle=列 efi.boostedDescription=加热器}&fl=id,score

Response

{
  "responseHeader":{
    "zkConnected":true,
    "status":400,
    "QTime":28,
    "params":{
      "q":"title:columns",
      "fl":"id,score",
      "rq":"{!ltr model=myWatersModel reRankDocs=100 efi.boostedTitle=columns efi.boostedDescription=Heater}"}},
  "error":{
    "metadata":[
      "error-class","org.apache.solr.common.SolrException",
      "root-error-class","org.apache.solr.common.SolrException",
      "error-class","org.apache.solr.client.solrj.impl.BaseHttpSolrClient$RemoteSolrException",
      "root-error-class","org.apache.solr.client.solrj.impl.BaseHttpSolrClient$RemoteSolrException"],
    "msg":"Error from server at null: cannot find model myWatersModel",
    "code":400}}

日志中没有任何内容只是相同的错误

org.apache.solr.client.solrj.impl.BaseHttpSolrClient$RemoteSolrException: Error from server at null: cannot find model myWatersModel
        at org.apache.solr.client.solrj.impl.Http2SolrClient.processErrorsAndResponse(Http2SolrClient.java:742)
        at org.apache.solr.client.solrj.impl.Http2SolrClient.request(Http2SolrClient.java:412)
        at org.apache.solr.client.solrj.impl.Http2SolrClient.request(Http2SolrClient.java:761)
        at org.apache.solr.client.solrj.SolrClient.request(SolrClient.java:1290)
        at org.apache.solr.handler.component.HttpShardHandler.request(HttpShardHandler.java:78)
        at org.apache.solr.handler.component.ShardRequestor.call(ShardRequestor.java:130)
        at org.apache.solr.handler.component.ShardRequestor.call(ShardRequestor.java:41)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at com.codahale.metrics.InstrumentedExecutorService$InstrumentedRunnable.run(InstrumentedExecutorService.java:180)
        at org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor.lambda$execute$0(ExecutorUtil.java:212)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

我也可以检索模型商店:

localhost:8983/solr/waterstest/schema/model-store

{
  "responseHeader":{
    "status":0,
    "QTime":1},
  "models":[{
      "name":"myWatersModel",
      "class":"org.apache.solr.ltr.model.LinearModel",
      "store":"myWatersFeatureStore",
      "features":[{
          "name":"isboostedTitle",
          "norm":{"class":"org.apache.solr.ltr.norm.IdentityNormalizer"}},
        {
          "name":"isboostedDescription",
          "norm":{"class":"org.apache.solr.ltr.norm.IdentityNormalizer"}}],
      "params":{"weights":{
          "isboostedTitle":0.4,
          "isboostedDescription":0.2}}}]}

如果特征查询有效并且我也能够检索模型,那么为什么我会收到模型空错误。我知道错误处理部分在这里不合适所以有人可以帮我指出这里可能出了什么问题吗?

这就是特征文件的样子

[
  {
    "store" : "myWatersFeatureStore",
    "name" : "isboostedTitle",
    "class" : "org.apache.solr.ltr.feature.SolrFeature",
    "params" : { "q" :"{!field f=title}${boostedTitle}"  }
  },
  {
    "store" : "myWatersFeatureStore",
    "name" : "isboostedDescription",
    "class" : "org.apache.solr.ltr.feature.SolrFeature",
    "params" : { "q" :"{!field f=description}${boostedDescription}" }
  }
]

以及对应的模型文件

{
  "store" : "myWatersFeatureStore",
  "name" : "myWatersModel",
  "class" : "org.apache.solr.ltr.model.LinearModel",
  "features" : [
    { "name" : "isboostedTitle" },
    { "name" : "isboostedDescription" }
  ],
  "params" : {
    "weights" : {
      "isboostedTitle" : 0.4,
      "isboostedDescription" : 0.2
    }
  }
}
solr
1个回答
0
投票

您的查询似乎是正确的。重新加载集合后你能解决这个问题吗?

将特征存储上传到

feature-store
model
model-store
后,重新加载集合以成功应用更改很重要。删除也一样。

如果您正在探索 LTR 部分,这篇博文 可能会派上用场。

© www.soinside.com 2019 - 2024. All rights reserved.