#148 new
Scott Burton

Parse error "Missing end quote" using RestrictionWithNear and boosted field values

Reported by Scott Burton | November 9th, 2010 @ 12:38 AM | in Wishlist

I'm getting a parse error from Solr when trying to use geospatial search in combination with per-document boost at search time.

Here's my search method:

  Sunspot.search(Business) do
    with(:coordinates).near(coordinates.first, coordinates.last, :boost => 3, :precision => 4)
    keywords query do
      recommendations.each_pair do |id, score|
        boost score do
          with :_id, id
        end
      end
    end
  end

"recommendations" is a hash of location_id => score pairs, but trading this out for any other boost block gives the same results. Using either the geospatial clause or the keyword per-document boost works fine, but it blows up in combination.

Defining a simpler search like

  Sunspot.search(Business) do
    with(:coordinates).near(coordinates.first, coordinates.last)
    keywords query do
      boost score do
        with :_id, id
      end
    end
  end

provides the same result.

Here's what Solr says:

SEVERE: org.apache.solr.common.SolrException: org.apache.lucene.queryParser.ParseException: Cannot parse
'(coordinates_s:9vk1md0jmef3^10.0 OR coordinates_s:9vk1md0jmef^0.625 OR coordinates_s:9vk1md0jme^0.0391 OR coordinates_s: 9vk1md0jm^0.00244 OR coordinates_s:9vk1md0j^0.000153 OR coordinates_s:9vk1md0^0.00000954 OR coordinates_s:9vk1md^0.000000596 OR coordinates_s:9vk1m^0.0000000373 OR coordinates_s: 9vk1^0.00000000233) query:"{!dismax qf='name_text description_text keywords_text category_ids_text' bq='["_id_s: 4cd827e344939b0592004dda^7.626670425981168"]'}gas"': Missing end quote for string at pos 76 str='{!dismax qf='name_text' bq='['

It looks to me like the quoting is ok, but I'm not a sophisticated enough Solr user to know for sure what is wrong.

Comments and changes to this ticket

  • mat

    mat December 27th, 2010 @ 02:44 PM

    • Milestone set to 1.2
    • Tag changed from parsing, query, string to bug
    • Milestone order changed from “40” to “0”
  • mat

    mat December 28th, 2010 @ 11:30 AM

    • Milestone changed from 1.2 to Wishlist

    I can't reproduce this in a test case -- moving to Wishlist pending a patch with a failing spec.

  • Kate

    Kate April 16th, 2013 @ 08:30 AM

    have the same issue too.

    Got
    fulltext search_params.terms['duty_station'], {fields: [:duty_station]} if search_params.terms['duty_station'].present?
    if search_params.terms['unit'].present?
    fulltext search_params.terms['unit'], fields: [:unit_name] do boost(4.0) { with :unit_name_strict, search_params.terms['unit'] } end end

    If I try to search either a unit or duty_station all is fine, but when i trying to search both got an error:

    RSolr::Error::Http - 400 Bad Request
    Error: org.apache.lucene.queryParser.ParseException: Cannot parse '_query_:"{!dismax qf='duty_station_text'}fort rucker, al" query:"{!dismax qf='unit_name_text' bq='["unit_name_strict_s:crc^4.0"]'}crc"': Missing end quote for string at pos 32 str='{!dismax qf='unit_name_text' bq='['

  • Kate

    Kate April 16th, 2013 @ 08:34 AM

    Sorry for the formatting in previous post, fixed here.

    have the same issue too.
    Got

    fulltext search_params.terms['duty_station'], {fields: [:duty_station]} if search_params.terms['duty_station'].present?
    if search_params.terms['unit'].present?
      fulltext search_params.terms['unit'], fields: [:unit_name] do
        boost(4.0) { with(:unit_name_strict, search_params.terms['unit']) }
      end
    end
    
    If I try to search either a unit or duty_station all is fine, but when i trying to search both got an error:
    RSolr::Error::Http - 400 Bad Request
    Error: org.apache.lucene.queryParser.ParseException: Cannot parse '_query_:"{!dismax qf='duty_station_text'}fort rucker, al" query:"{!dismax qf='unit_name_text' bq='["unit_name_strict_s:crc^4.0"]'}crc"': Missing end quote for string at pos 32 str='{!dismax qf='unit_name_text' bq='['
    

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Awesome Solr interaction for Ruby

People watching this ticket

Tags

Pages