Thanks Peter, sorry for the difficulties you ran into and thanks for sharing
the fixes you implemented.  The issues you ran into are (mostly) due to
changes in configuration around Solr with the pending 1.3x code level.  The
code release committed at CodePlex on 12/30/2007 was built against the Solr
1.2 release version.

On the specific issues you encountered:

Fix 1) The charset tag in the posted xml should be defined in the xml
declaritive node, which was how it worked with Solr 1.2.  That value may be
getting interpreted differently now, quite possibly by Solr or Tomcat.  I'll
verify this on my own system.  Nice find.

Fix 2) Solr configuration/application change.  For flexibility against
future Solr releases, maybe these should be configuration values for
Solrsharp.

Fix 3) Required attribute: perfect addition, thank you.

Fix 4) Blanking redundant namespaces: thank you for the cleanup.

I believe the primary trouble you're encountering with the character
encoding can be controlled with the Culture setting in the
SolrConfigurationSection class.  There was a previous discussion about that
issue a while back, and setting that property to CultureInvariant provided a
solution, but you're mileage may vary.

cheers,
jeff r.



On Jan 18, 2008 12:11 AM, Peter Thygesen <[EMAIL PROTECTED]> wrote:

> Solr Server:
> HW: IBM xSeries 300 (old pizzabox)
> OS: Ubuntu Server 7.10
> WEB: Tomcat 6.0.14
> SOLR: Nightly build 2008-01-14
>
> Thx,
> Peter
>
> -----Original Message-----
> From: Jeff Rodenburg [mailto:[EMAIL PROTECTED]
> Sent: 18. januar 2008 03:24
> To: solr-user@lucene.apache.org
> Subject: Re: Getting SolrSharp to work
>
> Thanks for the updates Peter.  Can you pass along your Solr instance
> information?
>
> thanks,
> jeff r.
>
>
> On Jan 17, 2008 7:22 AM, Peter Thygesen <[EMAIL PROTECTED]> wrote:
>
> > Version solrsharp-Dec-30-2007.zip
> >
> > I had to make a few changes to get this version to work. Here is what I
> > did.
> >
> > ------------------------------
> > // fix 1,. Solr server messed up Danish/Norwegian letters like "æøå"
> > because the HttpWbRequest object wasn't sending in utf-8 to Solr server
> > Class: SolrSearcher,
> > Method: public static HttpStatusCode WebPost(string url, byte[]
> > bytesToPost, ref string statusDescription)
> > Changed line
> > oRequest.ContentType = "text/xml";
> > To
> > oRequest.ContentType = "text/xml;charset=\"utf-8\"";
> >
> > -----------------------------
> > // fix 2, Could not get Schema.xml from server.. Permission denied.. or
> > wrong URL.
> > Class SolrSearcher,
> > Method private void SetSolrPaths()
> > Changed
> > this.SOLR_CONFIG = this.SOLR + "admin/get-file.jsp?file=solrconfig.xml";
> > To
> > this.SOLR_CONFIG = this.SOLR + "admin/file/?file=solrconfig.xml";
> >
> > this.SOLR_SCHEMA = this.SOLR + "admin/get-file.jsp?file=schema.xml";
> > To
> > this.SOLR_SCHEMA = this.SOLR + "admin/file/?file=schema.xml";
> >
> > ---------------------------
> > // fix 3,. Added functionality. My schema had field with required=false
> > and the validation failed.
> > // if (solrService.SolrSchema.IsValidUpdateIndexDocument(doc)) // failed
> > //
> > 1)
> > Class: SolrField
> > Method: public SolrField(XmlNode xnSolrField, SolrSchema solrSchema)
> > At Last line:
> >
> > Before:
> > this.solrschema = solrschema;
> >
> > After:
> > if (xnSolrField.Attributes["required"] != null)
> > {
> >       this.required = Convert.ToBoolean(xnSolrField.Attributes
> > ["required"].Value);
> > }
> > this.solrschema = solrSchema;
> >
> > 2) Added Property getter in SolrField class
> > private bool required = false;
> > public bool IsRequired
> > {
> >  get { return this.required; }
> > }
> >
> > 3)
> > Add check for IsRequired in field loop
> > Class: SolrSchema
> > Method: public bool IsValidUpdateIndexDocument(UpdateIndexDocument
> > updateIndexDocument)
> >        {
> >            ....
> >            foreach (SolrField solrField in this.solrFields)
> >            {
> >                if ((!solrField.IsCopied) &&
> >                    (!solrField.IsDefaulted) &&
> >                    (!docfieldnames.Contains(solrField.Name) &&
> >       solrField.IsRequired) // ADDED by Peter Thygesen
> >                    )
> >                {
> >                    return false;
> >                }
> >                else
> >                {
> >                    docfieldnames.Remove(solrField.Name);
> >                }
> >            }
> >            ....
> >        }
> >
> > --------------------------------
> > // fix 4:
> > // removed unnecessary namespace declarations in posted xml
> > Class: IndexDocument
> > Method: public string SerializeToString()
> > After XmlSerializerNamespaces xsn = new XmlSerializerNamespaces();
> > Add line:
> > xsn.Add("", "");
> >
> >
> > Hope someone can use this.. I took me all day to figure out.
> >
> > \Peter Thygesen
> >
> >
> >
>
>
>

Reply via email to