You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by "Ryan McKinley (JIRA)" <ji...@apache.org> on 2009/01/06 01:13:44 UTC

[jira] Created: (SOLR-948) Add helper functions to SolrPluginUtils that replace the DocList response with SolrDocumentList

Add helper functions to SolrPluginUtils that replace the DocList response with SolrDocumentList
-----------------------------------------------------------------------------------------------

                 Key: SOLR-948
                 URL: https://issues.apache.org/jira/browse/SOLR-948
             Project: Solr
          Issue Type: New Feature
            Reporter: Ryan McKinley
            Assignee: Ryan McKinley
            Priority: Minor
             Fix For: 1.4


We should add an easy (reusable) way for a search component to augment/modify the SolrDocuments before they are returned.

This patch adds two functions to SolrPluginUtils:

{code:java}
  public static SolrDocumentList docListToSolrDocumentList( 
      DocList docs, 
      SolrIndexSearcher searcher, 
      Set<String> fields, 
      Map<SolrDocument, Integer> ids ) throws IOException
  {
{code}

and

{code:java}
  public static void addOrReplaceResults(SolrQueryResponse rsp, SolrDocumentList docs) 
{code}

Typical usage may look like this:

{code:java}
  public void process(ResponseBuilder builder) throws IOException 
  {
    if( you want to ) {

      SolrDocumentList docs = SolrPluginUtils.docListToSolrDocumentList(
          builder.getResults().docList, 
          builder.req.getSearcher(), 
          builder.rsp.getReturnFields(),
          null );

      for( SolrDocument doc : docs ) {
        doc.setField( "field", "your field value..."   );
      }
      
      SolrPluginUtils.addOrReplaceResults( builder.rsp, docs );
    }
  }

{code}



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SOLR-948) Add helper functions to SolrPluginUtils that replace the DocList response with SolrDocumentList

Posted by "Ryan McKinley (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-948?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ryan McKinley updated SOLR-948:
-------------------------------

    Attachment: SOLR-948-augment-helper.patch

> Add helper functions to SolrPluginUtils that replace the DocList response with SolrDocumentList
> -----------------------------------------------------------------------------------------------
>
>                 Key: SOLR-948
>                 URL: https://issues.apache.org/jira/browse/SOLR-948
>             Project: Solr
>          Issue Type: New Feature
>            Reporter: Ryan McKinley
>            Assignee: Ryan McKinley
>            Priority: Minor
>             Fix For: 1.4
>
>         Attachments: SOLR-948-augment-helper.patch
>
>
> We should add an easy (reusable) way for a search component to augment/modify the SolrDocuments before they are returned.
> This patch adds two functions to SolrPluginUtils:
> {code:java}
>   public static SolrDocumentList docListToSolrDocumentList( 
>       DocList docs, 
>       SolrIndexSearcher searcher, 
>       Set<String> fields, 
>       Map<SolrDocument, Integer> ids ) throws IOException
>   {
> {code}
> and
> {code:java}
>   public static void addOrReplaceResults(SolrQueryResponse rsp, SolrDocumentList docs) 
> {code}
> Typical usage may look like this:
> {code:java}
>   public void process(ResponseBuilder builder) throws IOException 
>   {
>     if( you want to ) {
>       SolrDocumentList docs = SolrPluginUtils.docListToSolrDocumentList(
>           builder.getResults().docList, 
>           builder.req.getSearcher(), 
>           builder.rsp.getReturnFields(),
>           null );
>       for( SolrDocument doc : docs ) {
>         doc.setField( "field", "your field value..."   );
>       }
>       
>       SolrPluginUtils.addOrReplaceResults( builder.rsp, docs );
>     }
>   }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (SOLR-948) Add helper functions to SolrPluginUtils that replace the DocList response with SolrDocumentList

Posted by "Ryan McKinley (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SOLR-948?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ryan McKinley resolved SOLR-948.
--------------------------------

    Resolution: Fixed

> Add helper functions to SolrPluginUtils that replace the DocList response with SolrDocumentList
> -----------------------------------------------------------------------------------------------
>
>                 Key: SOLR-948
>                 URL: https://issues.apache.org/jira/browse/SOLR-948
>             Project: Solr
>          Issue Type: New Feature
>            Reporter: Ryan McKinley
>            Assignee: Ryan McKinley
>            Priority: Minor
>             Fix For: 1.4
>
>         Attachments: SOLR-948-augment-helper.patch
>
>
> We should add an easy (reusable) way for a search component to augment/modify the SolrDocuments before they are returned.
> This patch adds two functions to SolrPluginUtils:
> {code:java}
>   public static SolrDocumentList docListToSolrDocumentList( 
>       DocList docs, 
>       SolrIndexSearcher searcher, 
>       Set<String> fields, 
>       Map<SolrDocument, Integer> ids ) throws IOException
>   {
> {code}
> and
> {code:java}
>   public static void addOrReplaceResults(SolrQueryResponse rsp, SolrDocumentList docs) 
> {code}
> Typical usage may look like this:
> {code:java}
>   public void process(ResponseBuilder builder) throws IOException 
>   {
>     if( you want to ) {
>       SolrDocumentList docs = SolrPluginUtils.docListToSolrDocumentList(
>           builder.getResults().docList, 
>           builder.req.getSearcher(), 
>           builder.rsp.getReturnFields(),
>           null );
>       for( SolrDocument doc : docs ) {
>         doc.setField( "field", "your field value..."   );
>       }
>       
>       SolrPluginUtils.addOrReplaceResults( builder.rsp, docs );
>     }
>   }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SOLR-948) Add helper functions to SolrPluginUtils that replace the DocList response with SolrDocumentList

Posted by "Ryan McKinley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SOLR-948?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12660993#action_12660993 ] 

Ryan McKinley commented on SOLR-948:
------------------------------------

The *Map<SolrDocument, Integer> ids*  arguemt is a map from the SolrDocument to the lucene id -- this may be useful in some cases (it is for the local lucene component)

> Add helper functions to SolrPluginUtils that replace the DocList response with SolrDocumentList
> -----------------------------------------------------------------------------------------------
>
>                 Key: SOLR-948
>                 URL: https://issues.apache.org/jira/browse/SOLR-948
>             Project: Solr
>          Issue Type: New Feature
>            Reporter: Ryan McKinley
>            Assignee: Ryan McKinley
>            Priority: Minor
>             Fix For: 1.4
>
>
> We should add an easy (reusable) way for a search component to augment/modify the SolrDocuments before they are returned.
> This patch adds two functions to SolrPluginUtils:
> {code:java}
>   public static SolrDocumentList docListToSolrDocumentList( 
>       DocList docs, 
>       SolrIndexSearcher searcher, 
>       Set<String> fields, 
>       Map<SolrDocument, Integer> ids ) throws IOException
>   {
> {code}
> and
> {code:java}
>   public static void addOrReplaceResults(SolrQueryResponse rsp, SolrDocumentList docs) 
> {code}
> Typical usage may look like this:
> {code:java}
>   public void process(ResponseBuilder builder) throws IOException 
>   {
>     if( you want to ) {
>       SolrDocumentList docs = SolrPluginUtils.docListToSolrDocumentList(
>           builder.getResults().docList, 
>           builder.req.getSearcher(), 
>           builder.rsp.getReturnFields(),
>           null );
>       for( SolrDocument doc : docs ) {
>         doc.setField( "field", "your field value..."   );
>       }
>       
>       SolrPluginUtils.addOrReplaceResults( builder.rsp, docs );
>     }
>   }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.