|
|
-
boost function parameter (bf) ignores character escaping
mail@... 2012-05-21, 12:01
Hey,
I'm running solr (3.5.0.2011.11.30.16.37.06) and have encountered what I think is a bug with the boost function (bf) parameter.
I've used sunspot (for use of solr with rails) which allows managing dynamic fields, which by default creates fields like "dynamicfield:value1","dynamicfield:value2", though using the : character in the field name, which needs to be escaped.
If I use a query which includes "q=dynamicfield\:value1:6", everything works fines and matches are found.
However, if I use the bf field with bf=dynamicfield\:value1, I get an error message "undefined field dynamicfield", the same without escaping the :
Should I file a bug report?
Best,
Nils
-
Re: boost function parameter (bf) ignores character escaping
Erik Hatcher 2012-05-21, 12:36
Yeah, a bug report would be good. But really this is a Sunspot bug report. Field names should NOT have :'s in them. Field names should stick to standard Java identifier rules, otherwise it's escaping madness.
You could try something like this as a workaround:
bq=_val_:"dynamicfield\:value1"
I don't know if that'll do better than the bf issue you've hit, but it's another way of doing the same sort of thing.
Erik
On May 21, 2012, at 08:01 , [EMAIL PROTECTED] wrote:
> Hey, > > I'm running solr (3.5.0.2011.11.30.16.37.06) and have encountered what I think is a bug with the boost function (bf) parameter. > > I've used sunspot (for use of solr with rails) which allows managing dynamic fields, which by default creates fields like "dynamicfield:value1","dynamicfield:value2", though using the : character in the field name, which needs to be escaped. > > If I use a query which includes "q=dynamicfield\:value1:6", everything works fines and matches are found. > > However, if I use the bf field with bf=dynamicfield\:value1, I get an error message "undefined field dynamicfield", the same without escaping the : > > Should I file a bug report? > > Best, > > Nils > <solr_debug_normalquery.xml>
-
Re: boost function parameter (bf) ignores character escaping
Jack Krupansky 2012-05-21, 12:37
Quoting from the new trunk example schema:
"field names should consist of alphanumeric or underscore characters only and not start with a digit. This is not currently strictly enforced, but other field names will not have first class support from all components and back compatibility is not guaranteed."
In other words, don't do it. Replace the colon with an underscore in your field names.
-- Jack Krupansky
-----Original Message----- From: [EMAIL PROTECTED] Sent: Monday, May 21, 2012 8:01 AM To: [EMAIL PROTECTED] Subject: boost function parameter (bf) ignores character escaping
Hey,
I'm running solr (3.5.0.2011.11.30.16.37.06) and have encountered what I think is a bug with the boost function (bf) parameter.
I've used sunspot (for use of solr with rails) which allows managing dynamic fields, which by default creates fields like "dynamicfield:value1","dynamicfield:value2", though using the : character in the field name, which needs to be escaped.
If I use a query which includes "q=dynamicfield\:value1:6", everything works fines and matches are found.
However, if I use the bf field with bf=dynamicfield\:value1, I get an error message "undefined field dynamicfield", the same without escaping the :
Should I file a bug report?
Best,
Nils
-
Re: boost function parameter (bf) ignores character escaping
Jack Krupansky 2012-05-21, 16:45
I think there is a way in sunspot to give an explicit name to a field so that sunspot doesn't generate <class-name><colon><field-name> for field names. I think it is the ":as" function, such as:
string :name, :as => :name_s
So, you can then refer to "name" in your ruby code and "name_s" will be the field name in Solr.
-- Jack Krupansky
-----Original Message----- From: Jack Krupansky Sent: Monday, May 21, 2012 8:37 AM To: [EMAIL PROTECTED] Subject: Re: boost function parameter (bf) ignores character escaping
Quoting from the new trunk example schema:
"field names should consist of alphanumeric or underscore characters only and not start with a digit. This is not currently strictly enforced, but other field names will not have first class support from all components and back compatibility is not guaranteed."
In other words, don't do it. Replace the colon with an underscore in your field names.
-- Jack Krupansky
-----Original Message----- From: [EMAIL PROTECTED] Sent: Monday, May 21, 2012 8:01 AM To: [EMAIL PROTECTED] Subject: boost function parameter (bf) ignores character escaping
Hey,
I'm running solr (3.5.0.2011.11.30.16.37.06) and have encountered what I think is a bug with the boost function (bf) parameter.
I've used sunspot (for use of solr with rails) which allows managing dynamic fields, which by default creates fields like "dynamicfield:value1","dynamicfield:value2", though using the : character in the field name, which needs to be escaped.
If I use a query which includes "q=dynamicfield\:value1:6", everything works fines and matches are found.
However, if I use the bf field with bf=dynamicfield\:value1, I get an error message "undefined field dynamicfield", the same without escaping the :
Should I file a bug report?
Best,
Nils
|
|