field listing in solr with “fl” parameter for a fi

2019-05-14 00:36发布

问题:

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.



标签: solr