Solr
  1. Solr
  2. SOLR-4524

ReturnFields could not support hash '#' in filed name

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 4.1
    • Fix Version/s: None
    • Component/s: search

      Description

      If some fields start with '#' and we try to put it in fl param, this field and all next fields are not in response document

      With query:

      q=:&fl=score,#id,myOtherField

      Document response is like:

      SolrDocument

      {score=3.809621}

      this bug is similar to SOLR-2719 and SOLR-4374

        Activity

        Hide
        Erick Erickson added a comment -

        I'm going to close this one as I think it's highly unlikely that Solr will be changed to support # in field names. You'll save yourself a world of pain by using letters, numbers and underscores.

        We can re-open this if others have an interest in fixing this.

        Show
        Erick Erickson added a comment - I'm going to close this one as I think it's highly unlikely that Solr will be changed to support # in field names. You'll save yourself a world of pain by using letters, numbers and underscores. We can re-open this if others have an interest in fixing this.
        Hide
        Hoss Man added a comment -

        There is no problem here, i think there is just user confusion about how to include a "#" character in a URL – "#" is a reserved character in URLs for dealing with relative anchors, when you type a URL like this in your browser...

        http://localhost:8983/solr/select?q=id:HOSS&fl=score&fl=#foo_s&fl=id
        

        ...the browser never sends anything after the "#" to the server.

        If you URL escape it, then everything works fine...

        $ curl -sS 'http://localhost:8983/solr/select?q=id:HOSS&fl=score&fl=%23foo_s&fl=id&indent=true&wt=json'
        {
          "responseHeader":{
            "status":0,
            "QTime":1,
            "params":{
              "fl":["score",
                "#foo_s",
                "id"],
              "indent":"true",
              "q":"id:HOSS",
              "wt":"json"}},
          "response":{"numFound":1,"start":0,"maxScore":3.8033605,"docs":[
              {
                "id":"HOSS",
                "#foo_s":"special",
                "score":3.8033605}]
          }}
        

        I've re-opened and assigned to myself to add a unit test demonstrating that a field name like this works in the fl param.

        Show
        Hoss Man added a comment - There is no problem here, i think there is just user confusion about how to include a "#" character in a URL – "#" is a reserved character in URLs for dealing with relative anchors, when you type a URL like this in your browser... http://localhost:8983/solr/select?q=id:HOSS&fl=score&fl=#foo_s&fl=id ...the browser never sends anything after the "#" to the server. If you URL escape it, then everything works fine... $ curl -sS 'http://localhost:8983/solr/select?q=id:HOSS&fl=score&fl=%23foo_s&fl=id&indent=true&wt=json' { "responseHeader":{ "status":0, "QTime":1, "params":{ "fl":["score", "#foo_s", "id"], "indent":"true", "q":"id:HOSS", "wt":"json"}}, "response":{"numFound":1,"start":0,"maxScore":3.8033605,"docs":[ { "id":"HOSS", "#foo_s":"special", "score":3.8033605}] }} I've re-opened and assigned to myself to add a unit test demonstrating that a field name like this works in the fl param.
        Hide
        Commit Tag Bot added a comment -

        [trunk commit] Chris M. Hostetter
        http://svn.apache.org/viewvc?view=revision&revision=1452612

        SOLR-4524: test proving this works

        Show
        Commit Tag Bot added a comment - [trunk commit] Chris M. Hostetter http://svn.apache.org/viewvc?view=revision&revision=1452612 SOLR-4524 : test proving this works
        Hide
        Hoss Man added a comment -

        Tests added...

        Committed revision 1452612.
        Committed revision 1452613.

        Show
        Hoss Man added a comment - Tests added... Committed revision 1452612. Committed revision 1452613.
        Hide
        Commit Tag Bot added a comment -

        [branch_4x commit] Chris M. Hostetter
        http://svn.apache.org/viewvc?view=revision&revision=1452613

        SOLR-4524: test proving this works (merge r1452612)

        Show
        Commit Tag Bot added a comment - [branch_4x commit] Chris M. Hostetter http://svn.apache.org/viewvc?view=revision&revision=1452613 SOLR-4524 : test proving this works (merge r1452612)
        Hide
        Benjamin POUSSIN added a comment -

        Thanks for your unit test, and your hypothesis with # and URL can be right, but i used solrj and i don't write myself url . Perhaps there is bug in solrj about '#' encoding ?
        I have no time to test this quickly, but i send result of my test when i do it.

        Show
        Benjamin POUSSIN added a comment - Thanks for your unit test, and your hypothesis with # and URL can be right, but i used solrj and i don't write myself url . Perhaps there is bug in solrj about '#' encoding ? I have no time to test this quickly, but i send result of my test when i do it.

          People

          • Assignee:
            Hoss Man
            Reporter:
            Benjamin POUSSIN
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development