[ 
https://issues.apache.org/jira/browse/SOLR-2606?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Hoss Man updated SOLR-2606:
---------------------------

    Attachment: SOLR-2606.test.only.patch

bq. Lucene has no limits on fieldnames. I've long advocated sticking to java 
identifiers (minus the $) as best practice for a whole bunch of reasons. Maybe 
it was a mistake not enforcing it to begin with.

That ship has kind of sailed.  At this point it's really a matter of trying to 
do the best we can with what the users got.

For those unfamiliar...

Historically speaking, Solr has never enforced limits on field names except on 
a feature by feature basis -- so you can have any character you want in field 
names in your schema.xml, but some characters don't play nice with some 
features: whitespace or commas in field names have never worked with the "fl" 
param, many punctuation characters would cause you problems with the Lucene 
query parser, etc...

for sorting, the only limitation until SOLR-1297 has ever been that you can't 
sort on a field containing whitespace, and that naming a field "score" was 
going to cause you problems.

With SOLR-1297 the decision was sorting by function was valuable enough that 
"things that look like functions" should be parsed as functions, even though 
it's theoretically possible that you might have a field named "log(price)" (or 
a "*" dynamicField) in your schema.

but at the same time, i added logic to try and ensure that if the function 
parsing approach didn't produce a valid sort, it would fallback to the legacy 
parsing approach before assuming an error (see 
"SOLR-1297.better.field.support.patch")

Apparently there are some combinations that we missed.

Attached patch demonstrates the problem specifically with ":" and "-" in field 
names.

given that rails uses ":" in field names when using solr, and "-" is a pretty 
common character for people to expect to work in field names, we should 
definitely try to get to the bottom of this.

> Solr sort no longer works on field names with some punctuation in them
> ----------------------------------------------------------------------
>
>                 Key: SOLR-2606
>                 URL: https://issues.apache.org/jira/browse/SOLR-2606
>             Project: Solr
>          Issue Type: Bug
>          Components: search
>    Affects Versions: 3.1, 3.2
>         Environment: Linux
>            Reporter: Mitsu Hadeishi
>         Attachments: SOLR-2606.test.only.patch
>
>
> We just upgraded from Solr 1.4 to 3.2. For the most part the upgrade went 
> fine, however we discovered that sorting on field names with dashes in them 
> is no longer working properly. For example, the following query used to work:
> http://[our solr server]/select/?q=computer&sort=static-need-binary+asc
> and now it gives this error:
>     HTTP Status 400 - undefined field static
>     type Status report
>     message undefined field static
>     description The request sent by the client was syntactically incorrect 
> (undefined field static).
> It appears the parser for sorting has been changed so that it now tokenizes 
> differently, and assumes field names cannot have dashes in them. However, 
> field names clearly can have dashes in them. The exact same query which 
> worked fine for us in 1.4 is now breaking in 3.2. Changing the sort field to 
> use a field name that doesn't have a dash in it works just fine.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to