KRH
unread,Feb 27, 2012, 4:40:04 PM2/27/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django-haystack
I'm trying to use LocalParams on a query, to specify dismax behavior
for it. However, it seems like Haystack is malforming the query. The
python:
sqs = SearchQuerySet().filter(content=AltParser('edismax',
qf='text^0.5 trait^1.5 name^2.0 display_name^2.0', mm=1))
sqs = sqs.auto_query('my awesome query')
Putting a print statement in Haystack's solr backend, I see this come
out as the query string:
({!edismax mm=1 qf='text^0.5 trait^1.5 name^2.0 display_name^2.0'} AND
my awesome query)
This throws a Solr error:
Failed to query Solr using '({!edismax mm=1 qf='text^0.5 trait^1.5
name^2.0 display_name^2.0'} AND my awesome query)': [Reason:
org.apache.lucene.queryParser.ParseException: Cannot parse '({!edismax
mm=1 qf='text^0.5 trait^1.5 name^2.0 display_name^2.0'} AND my awesome
query)': Encountered " <RANGEEX_GOOP> "qf=\'text^0.5
"" at line 1, column 16.
Was expecting:
"}" ...
]
I believe the way the query needs to be formatted is this way: {!
edismax mm=1 qf='text^0.5 trait^1.5 name^2.0 display_name^2.0'}(my
awesome query)
Plugging that directly into Solr yields a valid query. So it seems
like Haystack is treating the LocalParams as its own query statement
and trying to chain it into the main query. I've also tried putting
the LocalParams in with the Raw input type and gotten the same result.
Is this a bug in Haystack or is there another way for me to do this?