You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gora.apache.org by "Lewis John McGibbney (JIRA)" <ji...@apache.org> on 2014/08/06 05:58:12 UTC

[jira] [Comment Edited] (GORA-266) Lucene datastore for Gora

    [ https://issues.apache.org/jira/browse/GORA-266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14087209#comment-14087209 ] 

Lewis John McGibbney edited comment on GORA-266 at 8/6/14 3:57 AM:
-------------------------------------------------------------------

Hi [~sstults], thanks for reuploading this. I am getting ClassCastException's for many tests when I attempt to run the test suite on the module.
The Exception is raised at the following line within LuceneStore#put method
{color:red}
data = IOUtils.serialize( datumWriter, fieldSchema, (T) v);
{color}
{code:title=LuceneStore.java|borderStyle=solid}
+  @Override
+  public void put(K key, T persistent) {
+    Schema schema = persistent.getSchema();
+    Document doc = new Document();
+
+    // populate the doc
+    List<org.apache.avro.Schema.Field> fields = schema.getFields();
+    for ( org.apache.avro.Schema.Field field : fields ) {
+      if (!persistent.isDirty( field.name() )) {
+        continue;
+      }
+      String sf = mapping.getLuceneField( field.name() );
+      if ( sf == null ) {
+        continue;
+      }
+      Schema fieldSchema = field.schema();
+      Object v = persistent.get( field.pos() );
+      if ( v == null ) {
+        continue;
+      }
+      switch ( fieldSchema.getType() ) {
+        case MAP:   //TODO: These should be handled better
+        case ARRAY:
+        case RECORD:
+        case UNION:
+          // For now we'll just store the bytes
+          byte[] data = new byte[0];
+          try {
+            data = IOUtils.serialize( datumWriter, fieldSchema, (T) v);
{code}


was (Author: lewismc):
Hi [~sstults], thanks for reuploading this. I am getting ClassCastException's for many tests when I attempt to run the test suite on the module.
The Exception is raised at the bottom line within LuceneStore#put method

+  @Override
+  public void put(K key, T persistent) {
+    Schema schema = persistent.getSchema();
+    Document doc = new Document();
+
+    // populate the doc
+    List<org.apache.avro.Schema.Field> fields = schema.getFields();
+    for ( org.apache.avro.Schema.Field field : fields ) {
+      if (!persistent.isDirty( field.name() )) {
+        continue;
+      }
+      String sf = mapping.getLuceneField( field.name() );
+      if ( sf == null ) {
+        continue;
+      }
+      Schema fieldSchema = field.schema();
+      Object v = persistent.get( field.pos() );
+      if ( v == null ) {
+        continue;
+      }
+      switch ( fieldSchema.getType() ) {
+        case MAP:   //TODO: These should be handled better
+        case ARRAY:
+        case RECORD:
+        case UNION:
+          // For now we'll just store the bytes
+          byte[] data = new byte[0];
+          try {
+            data = IOUtils.serialize( datumWriter, fieldSchema, (T) v);

> Lucene datastore for Gora
> -------------------------
>
>                 Key: GORA-266
>                 URL: https://issues.apache.org/jira/browse/GORA-266
>             Project: Apache Gora
>          Issue Type: New Feature
>          Components: gora-lucene
>            Reporter: Lewis John McGibbney
>            Assignee: Scott Stults
>            Priority: Minor
>              Labels: features
>             Fix For: 0.6
>
>         Attachments: GORA-266.patch
>
>
> Sometimes we don't need to set up, administer, maintain and configure a running solr server(s).
> Sometime we just want to write to Lucene index files and read directly from them. 



--
This message was sent by Atlassian JIRA
(v6.2#6252)