You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by JP Genty - LibertySurf <ge...@libertysurf.fr> on 2007/09/24 18:04:58 UTC

Solrsharp culture problems

    I use solrsharp on a french XP and I have problems with the float
conversion to text.

    I modified ExempleIndexDocument constructor to force the "en-US"
culture.

    CultureInfo MyCulture = new CultureInfo("en-US");
    .
    .
    this.Add(new IndexFieldValue("weight", weight.ToString(MyCulture)));
    this.Add(new IndexFieldValue("price", price.ToString(MyCulture)));

   And I modified IndexFieldAttribute SetValue method

           CultureInfo MyCulture = new CultureInfo("en-US");

                   this.PropertyInfo.SetValue(searchRecord,
Convert.ChangeType(xnodevalue.InnerText,
                    this.PropertyInfo.PropertyType, MyCulture), null);
       ....

valueArray.SetValue(Convert.ChangeType(xnlvalues[i].InnerText, basetype,
MyCulture), i);


  Now the example runs smoothly on a windows XP french.


         Is it the right solution ??

   Thanks
 Jean-Paul





Re: Solrsharp culture problems

Posted by Jeff Rodenburg <je...@gmail.com>.
Yes, that would be the right solution.  I'm not sure if, in order to use
french culture settings on xp, you would require corresponding changes in
culture settings for the solr instance.

Hope this helps.

-- j

On 9/24/07, JP Genty - LibertySurf <ge...@libertysurf.fr> wrote:
>
>
>     I use solrsharp on a french XP and I have problems with the float
> conversion to text.
>
>     I modified ExempleIndexDocument constructor to force the "en-US"
> culture.
>
>     CultureInfo MyCulture = new CultureInfo("en-US");
>     .
>     .
>     this.Add(new IndexFieldValue("weight", weight.ToString(MyCulture)));
>     this.Add(new IndexFieldValue("price", price.ToString(MyCulture)));
>
>    And I modified IndexFieldAttribute SetValue method
>
>            CultureInfo MyCulture = new CultureInfo("en-US");
>
>                    this.PropertyInfo.SetValue(searchRecord,
> Convert.ChangeType(xnodevalue.InnerText,
>                     this.PropertyInfo.PropertyType, MyCulture), null);
>        ....
>
> valueArray.SetValue(Convert.ChangeType(xnlvalues[i].InnerText, basetype,
> MyCulture), i);
>
>
>   Now the example runs smoothly on a windows XP french.
>
>
>          Is it the right solution ??
>
>    Thanks
> Jean-Paul
>
>
>
>
>