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

Already on GitHub? Sign in to your account

Solr: use nested query syntax for AltParser queries #723

merged 1 commit into from Jan 30, 2013
Commits on Jan 28, 2013
  1. Solr: use nested query syntax for AltParser queries

    acdha committed Jan 23, 2013
    The previous implementation would, given a query like this::
        sqs.filter(content=AltParser('dismax', 'library', qf="title^2 text" mm=1))
    generate a query like this::
        {!dismax v=library qf="title^2 text" mm=1}
    This works in certain situations but causes Solr to choke while parsing it
    when Haystack wraps this term in parentheses::
        org.apache.lucene.queryParser.ParseException: Cannot parse '({!dismax mm=1 qf='title^2 text institution^0.8' v=library})':
        Encountered " <RANGEEX_GOOP> "qf=\'title^1.25 "" at line 1, column 16.
    The solution is to use the nested query syntax described here:
    This will produce a query like this, which works with Solr 3.6.2::
        (_query_:"{!edismax mm=1 qf='title^1.5 text institution^0.5' v=library}")
    Leaving the actual URL query string looking like this::
    * Tests updated for the new query generation output
    * A Solr backend task was added to actually run the dismax queries and verify
      that we're not getting Solr 400s errors due to syntax gremlins