lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Miller (JIRA)" <j...@apache.org>
Subject [jira] Updated: (SOLR-1945) Allow @Field annotations in nested classes using DocumentObjectBinder
Date Fri, 11 Jun 2010 16:51:15 GMT

     [ https://issues.apache.org/jira/browse/SOLR-1945?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Mark Miller updated SOLR-1945:
------------------------------

    Attachment: SOLR-1945.patch

Started playing around with this on the plane yesterday - here is a pretty rough first draft.

You annotate members that should be drilled into with @FieldObject (need to think of the right
name here)

eg:

{code}
  public static class ItemHolder {
    @Field
    String superfield;
    @FieldObject
    Item item;
    @FieldObject
    Item2 item2;

    public Item getItem() {
      return item;
    }

    public void setItem(Item item) {
      this.item = item;
    }
    
  }
  
  public static class Item {
    @Field
    String id;

    @Field("cat")
    String[] categories;

    @Field
    List<String> features;

    @Field
    Date timestamp;

    @Field("highway_mileage")
    int mwyMileage;

    boolean inStock = false;

    @Field("supplier_*")
    Map<String, List<String>> supplier;
    
    @Field("sup_simple_*")
    Map<String, String> supplier_simple;

    private String[] allSuppliers;

    @Field("supplier_*")
    public void setAllSuppliers(String[] allSuppliers){
      this.allSuppliers = allSuppliers;  
    }

    public String[] getAllSuppliers(){
      return this.allSuppliers;
    }

    @Field
    public void setInStock(Boolean b) {
      inStock = b;
    }
    
    // required if you want to fill SolrDocuments with the same annotaion...
    public boolean isInStock()
    {
      return inStock;
    }
  }
  
  public static class Item2 {
    @Field
    String sensai;
    
    @FieldObject
    Item3 item3;
    
  }
  
  public static class Item3 {
    @Field
    String server;

    @Field("type")
    String[] types;
  }
  
{code}

> Allow @Field annotations in nested classes using DocumentObjectBinder
> ---------------------------------------------------------------------
>
>                 Key: SOLR-1945
>                 URL: https://issues.apache.org/jira/browse/SOLR-1945
>             Project: Solr
>          Issue Type: Improvement
>            Reporter: Mark Miller
>            Assignee: Mark Miller
>            Priority: Minor
>             Fix For: Next
>
>         Attachments: SOLR-1945.patch
>
>
> see http://search.lucidimagination.com/search/document/d909d909420aeb4e/does_solrj_support_nested_annotated_beans
> Would be nice to be able to pass an object graph to solrj with @field annotations rather
than just a top level class

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message