lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yo...@apache.org
Subject svn commit: r883566 - in /lucene/solr/trunk: CHANGES.txt src/solrj/org/apache/solr/client/solrj/impl/StreamingUpdateSolrServer.java src/test/org/apache/solr/client/solrj/SolrExampleTests.java
Date Tue, 24 Nov 2009 01:42:47 GMT
Author: yonik
Date: Tue Nov 24 01:42:40 2009
New Revision: 883566

URL: http://svn.apache.org/viewvc?rev=883566&view=rev
Log:
SOLR-1595: use utf8 in streaming solrj client

Modified:
    lucene/solr/trunk/CHANGES.txt
    lucene/solr/trunk/src/solrj/org/apache/solr/client/solrj/impl/StreamingUpdateSolrServer.java
    lucene/solr/trunk/src/test/org/apache/solr/client/solrj/SolrExampleTests.java

Modified: lucene/solr/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/CHANGES.txt?rev=883566&r1=883565&r2=883566&view=diff
==============================================================================
--- lucene/solr/trunk/CHANGES.txt (original)
+++ lucene/solr/trunk/CHANGES.txt Tue Nov 24 01:42:40 2009
@@ -86,7 +86,12 @@
   or the close of a core resulted in a warning:
   "SEVERE: SolrIndexWriter was not closed prior to finalize()" although
   there were no other consequences. (yonik)
-  
+
+* SOLR-1595: StreamingUpdateSolrServer used the patform default character
+  set when streaming updates, rather than using UTF-8 as the HTTP headers
+  indicated, leading to an encoding mismatch. (hossman, yonik)
+
+didn't specify the character set creating OutputStreamWriter
 
 
 Other Changes

Modified: lucene/solr/trunk/src/solrj/org/apache/solr/client/solrj/impl/StreamingUpdateSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/solrj/org/apache/solr/client/solrj/impl/StreamingUpdateSolrServer.java?rev=883566&r1=883565&r2=883566&view=diff
==============================================================================
--- lucene/solr/trunk/src/solrj/org/apache/solr/client/solrj/impl/StreamingUpdateSolrServer.java
(original)
+++ lucene/solr/trunk/src/solrj/org/apache/solr/client/solrj/impl/StreamingUpdateSolrServer.java
Tue Nov 24 01:42:40 2009
@@ -90,7 +90,7 @@
   
           public void writeRequest(OutputStream out) throws IOException {
             try {
-              OutputStreamWriter writer = new OutputStreamWriter( out );
+              OutputStreamWriter writer = new OutputStreamWriter(out, "UTF-8");
               writer.append( "<stream>" ); // can be anything...
               UpdateRequest req = queue.poll( 250, TimeUnit.MILLISECONDS );
               while( req != null ) {

Modified: lucene/solr/trunk/src/test/org/apache/solr/client/solrj/SolrExampleTests.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/test/org/apache/solr/client/solrj/SolrExampleTests.java?rev=883566&r1=883565&r2=883566&view=diff
==============================================================================
--- lucene/solr/trunk/src/test/org/apache/solr/client/solrj/SolrExampleTests.java (original)
+++ lucene/solr/trunk/src/test/org/apache/solr/client/solrj/SolrExampleTests.java Tue Nov
24 01:42:40 2009
@@ -175,7 +175,7 @@
 
     SolrInputDocument doc2 = new SolrInputDocument();
     doc2.addField( "id", "id2", 1.0f );
-    doc2.addField( "name", "doc2", 1.0f );
+    doc2.addField( "name", "h\u1234llo", 1.0f );
     doc2.addField( "price", 20 );
     
     Collection<SolrInputDocument> docs = new ArrayList<SolrInputDocument>();
@@ -191,7 +191,7 @@
     query.addSortField( "price", SolrQuery.ORDER.asc );
     QueryResponse rsp = server.query( query );
     
-    Assert.assertEquals( 2, rsp.getResults().getNumFound() );
+    assertEquals( 2, rsp.getResults().getNumFound() );
     System.out.println( rsp.getResults() );
     
     // Now do it again
@@ -199,9 +199,14 @@
     server.commit();
     
     rsp = server.query( query );
-    Assert.assertEquals( 2, rsp.getResults().getNumFound() );
-    System.out.println( rsp.getResults() );
-    
+    assertEquals( 2, rsp.getResults().getNumFound() );
+    // System.out.println( rsp.getResults() );
+
+    // query outside ascii range
+    query.setQuery("name:h\u1234llo");
+    rsp = server.query( query );
+    assertEquals( 1, rsp.getResults().getNumFound() );
+
   }
   
   /**



Mime
View raw message