[英]Passing a variable in a solr auery
I'm working with solr using r library solrium 我正在使用R库Solrium使用Solr
After the connection to solr in the variable conn1, I make queries like this: 连接到变量conn1中的solr之后,我进行如下查询:
solr_search(conn1,"collection_name", params = list(q = "price:1000",start = 0, rows = 20000,fl=c('column_name')))
p = 1000000 d = solr_search(conn1,"collection_name", params = list(q = "price:p", start = 0, rows = 20000,fl=c('column_name' )))
And obviously it doesn't work. 显然这是行不通的。 I have tried tricks that I found on Internet like "price":p "price:${p}" "price":{p}
我尝试了一些在互联网上找到的技巧,例如“ price”:p“ price:$ {p}”“ price”:{p}
But none of these worked. 但是这些都不起作用。
While I'm not familiar with R or Solrium, it seems like standard string concatenation is performed by using paste("price:", p)
. 虽然我不熟悉R或Solrium,但似乎标准的字符串连接是通过使用
paste("price:", p)
。 This assumes that p is not user supplied - ie you can assume that the value is safe to send directly to Solr. 这假定p不是用户提供的-即您可以假定该值可以安全地直接发送到Solr。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.