Solr
  1. Solr
  2. SOLR-3214

If you use multiple fl entries rather than a comma separated list, all but the first entry can be ignored if you are using distributed search.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0-ALPHA
    • Component/s: search
    • Labels:
      None

      Description

      I have not checked yet, but prob in 3.x too.

        Issue Links

          Activity

          Hide
          Mark Miller added a comment - - edited
          Index: solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java
          ===================================================================
          --- solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java	(revision 1296933)
          +++ solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java	(working copy)
          @@ -935,13 +935,14 @@
                 // make sure that the id is returned for correlation.
                 String fl = sreq.params.get(CommonParams.FL);
                 if (fl != null) {
          -         fl = fl.trim();
          +        fl = fl.trim();
                   // currently, "score" is synonymous with "*,score" so
          -        // don't add "id" if the fl is empty or "score" or it would change the meaning.
          -         if (fl.length()!=0 && !"score".equals(fl) && !"*".equals(fl)) {
          -           sreq.params.set(CommonParams.FL, fl+','+uniqueField.getName());
          -         }
          -      }      
          +        // don't add "id" if the fl is empty or "score" or it would change the
          +        // meaning.
          +        if (fl.length() != 0 && !"score".equals(fl) && !"*".equals(fl)) {
          +          sreq.params.add(CommonParams.FL, uniqueField.getName());
          +        }
          +      }
           
                 ArrayList<String> ids = new ArrayList<String>(shardDocs.size());
                 for (ShardDoc shardDoc : shardDocs) {
          
          
          Show
          Mark Miller added a comment - - edited Index: solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java =================================================================== --- solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java (revision 1296933) +++ solr/core/src/java/org/apache/solr/handler/component/QueryComponent.java (working copy) @@ -935,13 +935,14 @@ // make sure that the id is returned for correlation. String fl = sreq.params.get(CommonParams.FL); if (fl != null) { - fl = fl.trim(); + fl = fl.trim(); // currently, "score" is synonymous with "*,score" so - // don't add "id" if the fl is empty or "score" or it would change the meaning. - if (fl.length()!=0 && !"score".equals(fl) && !"*".equals(fl)) { - sreq.params.set(CommonParams.FL, fl+','+uniqueField.getName()); - } - } + // don't add "id" if the fl is empty or "score" or it would change the + // meaning. + if (fl.length() != 0 && !"score".equals(fl) && !"*".equals(fl)) { + sreq.params.add(CommonParams.FL, uniqueField.getName()); + } + } ArrayList<String> ids = new ArrayList<String>(shardDocs.size()); for (ShardDoc shardDoc : shardDocs) {
          Hide
          Mark Miller added a comment -
          Index: solr/core/src/test/org/apache/solr/TestDistributedSearch.java
          ===================================================================
          --- solr/core/src/test/org/apache/solr/TestDistributedSearch.java	(revision 1296933)
          +++ solr/core/src/test/org/apache/solr/TestDistributedSearch.java	(working copy)
          @@ -135,7 +135,10 @@
               //is agnostic of request params.
               handle.remove("maxScore");
               query("q","{!func}"+i1, "fl","*,score");  // even scores should match exactly here
          -
          +    
          +    // multple fl entries
          +    query("q","*:*", "fl","id", "fl", t1, "sort","n_tl1 desc");
          +    
               handle.put("highlighting", UNORDERED);
               handle.put("response", UNORDERED);
           
          
          
          Show
          Mark Miller added a comment - Index: solr/core/src/test/org/apache/solr/TestDistributedSearch.java =================================================================== --- solr/core/src/test/org/apache/solr/TestDistributedSearch.java (revision 1296933) +++ solr/core/src/test/org/apache/solr/TestDistributedSearch.java (working copy) @@ -135,7 +135,10 @@ //is agnostic of request params. handle.remove("maxScore"); query("q","{!func}"+i1, "fl","*,score"); // even scores should match exactly here - + + // multple fl entries + query("q","*:*", "fl","id", "fl", t1, "sort","n_tl1 desc"); + handle.put("highlighting", UNORDERED); handle.put("response", UNORDERED);
          Hide
          Mark Miller added a comment -

          So I started looking at the following little bit of logic:

          currently, "score" is synonymous with "*,score" so don't add "id" if the fl is empty or "score" or it would change the meaning.
          
          if (fl.length()!=0 && !"score".equals(fl) && !"*".equals(fl)) {
          

          This also needs a bit of tweaking to work with multiple fls. However, in trying to fix that, I realized this appears broken anyway. If you try and just ask for score back in distrib search, it fails. Not so to a single node.

          It appears that "currently, "score" is synonymous with "*,score"" is just not true currently. If you ask a single node for fl=score, you only get back the score field. So later in distrib search when we look for the id field, we cannot find it and get an NPE.

          Show
          Mark Miller added a comment - So I started looking at the following little bit of logic: currently, "score" is synonymous with "*,score" so don't add "id" if the fl is empty or "score" or it would change the meaning. if (fl.length()!=0 && !"score".equals(fl) && !"*".equals(fl)) { This also needs a bit of tweaking to work with multiple fls. However, in trying to fix that, I realized this appears broken anyway. If you try and just ask for score back in distrib search, it fails. Not so to a single node. It appears that "currently, "score" is synonymous with "*,score"" is just not true currently. If you ask a single node for fl=score, you only get back the score field. So later in distrib search when we look for the id field, we cannot find it and get an NPE.
          Hide
          Mark Miller added a comment -

          It appears that "currently, "score" is synonymous with "*,score"" is just not true currently

          This was recently changed by SOLR-2712 - this part of it just was missed.

          Show
          Mark Miller added a comment - It appears that "currently, "score" is synonymous with "*,score"" is just not true currently This was recently changed by SOLR-2712 - this part of it just was missed.
          Hide
          Mark Miller added a comment -

          Resolved using Tomas' patch in SOLR-3256

          Show
          Mark Miller added a comment - Resolved using Tomas' patch in SOLR-3256

            People

            • Assignee:
              Mark Miller
              Reporter:
              Mark Miller
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development