lucene-solr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Solr Trey <solrt...@gmail.com>
Subject Issue with Function Query on Field Names with a Hyphen
Date Thu, 13 Aug 2009 03:04:00 GMT
Hey Everyone,

So, I was experimenting with some function queries today, and came across
something disturbing:

The following query works fine (field name: rank_i):
/solr/select/?q.op=AND&start=0&rows=10&fl=*%2cscore&q={!func}product(rank_i,2)

But the following query (field name: rank-i) throws a Parse Error (returns
404):
q={!func}product(rank-i,2)

Here's the error:
HTTP ERROR: 400
org.apache.lucene.queryParser.ParseException: Expected ',' at position 14 in
'product(rank_i,2)'


I confirmed that the problem occurs whenever a hyphen/minus/dash occurs in
the field name by putting in a fake field name:
q={!func}product(MadeUpField-Name,2)
HTTP ERROR: 400

undefined field MadeUpField

So, it looks like it is trying to parse the "-" in the field name as an
operator instead of as part of the field name.  Is it bad form to include a
hyphen in a field name... I've never had issues with it anywhere else in the
past.  FYI, I've confirmed this behavior on 1.4 nightly builds from both
6/16 and 8/6 and both forms of the function query syntax ({!func} and
_val_).  Also, I have this problem with seemingly all function queries (ord,
sum, etc.), not just "product."

Is there any way to escape the field name, or is this just a bug?

Any help you can provide would be greatly appreciated.  Thanks!

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message