All:
I am new to Solr, when I play with solr example with importing some random document, I use a search query in q like:
fund+report
There is no space between fund and +, and I thought it will search a word "fund+report" in the document, which rarely happen in document, but a lot results return, thequery url is:
http://localhost:8983/solr/collection1/select?q=fund%2Breport&fl=id+filename+%5Bexplain%5D&wt=xml&indent=true
I thought Solr treat my query just like:
fund report
or
fund OR report
Could anyone tell me why solr treat my query like that? And how can I make solr treat fund+report as a single word?
Thanks
The HTTP call will simply translate the +
to a space
. If you need an actual +
sign then you need to use the URL-encoded value for +
(which I think is %2B
). If you are looking for the phrase fund report then you want to put double quotes around the phrase, e.g., "fund report"
. These should also be URL-encoded (I think the value for that is %22
).
Keep in mind that if you're using stemming then a search for "fund report"
will find results for "funds reports"
, "funding reports"
, etc. But maybe that is what you want.
So after all is said and done, your URL might look like the following:
http://localhost:8983/solr/collection1/select?q=%22fund%20report%22&fl=id,filename,%5Bexplain%5D&wt=xml&indent=true
Note that the fields listed for the fl
parameter should be comma-delimited. I am not sure why you have the square brackets around the explain
field.