我想将下面的SQL查询转换为solr查询
select
Sentences.sentenceid, sentence, languagecode
from
Sentences
where
sentenceid in (select translatedid
from SentencesRelationship
where sentenceid = '3152');
非常感谢!
假设您有两个SOLR内核:1. 句子(sentenceId, sentence, languageCode)2. senencesrelationship (senenceid, translatedId)
有以下数据:
句子:
sentenceId, sentence, languageCode
1, sentence1, lang1
2, sentence2, lang2
3, sentence3, lang3
sentencesRelationship:
sentenceId, translatedId
1, 101
2, 102
在SOLR中进行连接有几种解决方案。一种是在StreamingExpression中使用innerJoin:
innerJoin(
search(sentences, q="*:*", fl="sentenceId, sentence, languagecode", sort="sentenceId asc", qt="/export"),
search(sentencesRelationship, q="sentenceId:3152",
fl="sentenceId, translatedId", sort="sentenceId asc", qt="/export"),
on="sentenceId"
)