field listing in solr with “fl” parameter for a field having space in between

时光总嘲笑我的痴心妄想 提交于 2020-01-02 07:21:11

问题


I have a field in my solr schema as "Post Date"(exclude the quotes). when i fire a query with "fl" (field list) parameter in order to view only Post Date of search results, since this field contains a space I am not getting anything in the docs responses. I tried using +, %20 but still i get no results. Please help.


回答1:


I would like to inform that i have found a solution to this. I tried experimenting and hence came up with a solution on putting \+ as the substitute for white space in the query. Hence the query should be Post\+Date:[ranges]

I couldnt aford to change my schema as many teams are depending on it and we are upgrading our system to a new search engine.




回答2:


You can specify (what Solr deems crazy) fields by wrapping them like this:

field(Post Date)

This actually changes the returned results fieldname too so you'll get back something like:

"field(Post Date)" : "2010-01-01"

And not just the name as you might imagine.




回答3:


As a possible workaround, you might be able to use a wild card to achieve your results. Using the solr wiki http://wiki.apache.org/solr/CommonQueryParameters#glob you may be able to specify fl=Post*Date which would possibly get around your problem. I have not verified this but it might work.

Update: This doesn't seem to work on either version of solr I tried (1.4.0 and 3.6.1). Looks like this may have been discussed at http://wiki.apache.org/solr/FieldAliasesAndGlobsInParams but it does not appear to be implemented.



来源:https://stackoverflow.com/questions/8575009/field-listing-in-solr-with-fl-parameter-for-a-field-having-space-in-between

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!