Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solrpy won't allow ranged facets on fields which contain underscores #28

Open
GoogleCodeExporter opened this issue Mar 13, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Create a solr field in the schema which contains an underscore in the name 
and a rangeable value (e.g. an integer).

2. Attempt a ranged facet search like:

solr = solr.Solr(solr_url)
solr.select(q=q, start=s, facet_mincount=facet_mincount,
                            facet_field=normalfield, facet_range=underscored_field,
                            f_underscored_field_facet_range_start=0,
                            f_underscored_field_facet_range_end=50,
                            f_underscored_field_facet_range_gap=10)

3. Observe that the _ in underscored_field is converted to a ., and therefore 
isn't properly recognised in solr.

What is the expected output? What do you see instead?

Expect a normal solr response, with facet_ranges populated.  Instead solr 
throws an error.  The error that solr isn't important as such - it's exactly 
what you would expect solr to do; the problem is clearly isolated to the 
request code in solrpy.

What version of the product are you using? On what operating system?

0.9.4 MacOSX 10.6

Please provide any additional information below.

I have a fix for the bug, although I'm not sure it's 100% optimal.  See 
attached patch file.  This adds an extra argument to the SearchHandler to take 
an "arg_separator" value, which defaults to "_", and then when the _ -> . 
replacement happens, I use the value of arg_separator instead of the string 
literal "_".  This means that for my use case I can pass in an arg_separator of 
"__" (double underscore).  Using this code now works for me.

Original issue reported on code.google.com by rich...@cottagelabs.com on 27 Jun 2011 at 8:18

Attachments:

@GoogleCodeExporter
Copy link
Author

This wont work though unless there is a way for the user to provide a custom 
arg_separator when a SolrConnection in instantiated.  

Original comment by kes...@keshavmagge.com on 11 Jan 2014 at 11:53

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant