簡體   English   中英

在 Solr 搜索中也顯示沒有孩子的父母

[英]Showing parents without children in Solr search too

我正在調用一個相當復雜的搜索查詢,以便只有父母(沒有孩子的根記錄)和孩子的父母出現在結果中(搜索父母和孩子記錄)。 我從( Solr 搜索頂級和嵌套記錄)獲得的查詢效果很好,除非父級沒有任何子級,否則它不會顯示在搜索結果中。 我希望您能幫助我更改查詢,以便沒有孩子的父母也出現在搜索結果中。

我正在使用的帶有 url 參數的查詢如下所示:

http://localhost:8983/solr/b-core/select?&fq=solr_type:parent&childFilter={!edismax%20v=$q.user}&fl=*,[child%20childFilter=$childFilter%20%20limit=1000]&q={!parent%20which=solr_type:parent%20v=$q.child}%20OR%20{!edismax%20v=$q.user}&q.child=%20%2Bsolr_type:child%20%20%2B{!edismax%20v=$q.user}&q.user=suppressed_b:False&rows=10&start=0&sort=&fq=solr_type:parent

使用參數轉換為以下結果:

status: 0,
QTime: 9,
params: {
childFilter: "{!edismax v=$q.user}",
ps: "0",
indent: "2",
echoParams: "all",
fl: "*,[child childFilter=$childFilter  limit=1000]",
fq: [
"solr_type:parent",
"solr_type:parent"
],
tie: "0.01",
defType: "lucene",
qf: "...
      ",
q.child: " +solr_type:child  +{!edismax v=$q.user}",
wt: "json",
mm: "6<-1 6<90%",
qs: "1",
q.alt: "*:*",
facet.field: [
...
],
start: "0",
sort: "",
rows: "10",
q: "{!parent which=solr_type:parent v=$q.child} OR {!edismax v=$q.user}",
facet.limit: "10",
spellcheck: "true",
pf: "...
      ",
q.user: "suppressed_b:False",
facet.mincount: "1",
facet: "true",
rid: "-2221"
}
},

帶有孩子的上傳記錄如下所示: https://drive.google.com/file/d/1wZoCZDUS7evpA8ssSvSB1WlWmvNgp_wE/view?usp=sharing

並且在沒有子項的情況下重新發布此記錄(例如,刪除“ childDocuments ”列表)可防止無子項的父項在任何地方搜索期間顯示在結果中。

在修復上述搜索以便孩子的父母和無子女的父母記錄出現在搜索結果中時,任何指導將不勝感激。

謝謝你的時間。

問題出在您的q參數中。 人類一眼看去,結構清晰——一個 boolean OR 兩個子句,其中一個是“父”查詢,右邊是“edismax”。 但是對於 Solr,如果查詢字符串以{! 如果存在v local-param,則忽略下一個}之后的所有內容。 解決方案很簡單——只需在其中放置一個空格,就像我看到你已經為q.child所做的那樣(實際上並不需要那個空間)。 我提交了這個: https://issues.apache.org/jira/browse/SOLR-15906

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM