Re: SolrSharp example

2007-06-20 Thread Jeff Rodenburg

Hi Michael -

Moving this conversations to the general solr mailing list...



 1. SolrSharp example solution works with schema.xml from

apache-solr-1.1.0-incubating.If I'm using schema.xml from
apache-solr-1.2.0 example program doesn't update index...

I didn't realize the solr 1.2 release code sample schema.xml was different
from the solr 1.1 version.  In my implementation, I had solr 1.1 already
installed and upgraded to 1.2 by replacing the war file (per the
instructions in solr.)  So, the example code is geared to go against
the 1.1schema.

For the example code, adding the "timestamp" field in the
ExampleIndexDocument public constructor such as:

   this.Add(new IndexFieldValue("timestamp", DateTime.Now.ToString
("s")+"Z")));

will take care of the solr 1.2 schema invalidation issue.

The addition of the @default attribute on this field in the schema is not
presently accommodated in the validation routine.  If I'm not mistaken, the
default attribute value will be applied for all documents without that field
present in the xml payload.  This would imply that any field with a default
attribute is not required for any implemented UpdateIndexDocument.  I'll
look into this further.



2. When I run example with schema.xml from

apache-solr-1.1.0-incubating program
throw Exception

Hmmm, can't really help you with this one.  It sounds as if solr is
incurring an error when the xml is posted to the server.  Try the standard
step-through troubleshooting routines to see what messages are being passed
back from the server.



-- j







On 6/19/07, Michael Plax <[EMAIL PROTECTED]> wrote:


 Hello Jeff,

thank you again for updating files.
I just run with some  problems. I don't know what is the best way to
report them solr maillist/solrsharp jira.

1.
SolrSharp example solution works with schema.xml from
apache-solr-1.1.0-incubating.
   If I'm using schema.xml from apache-solr-1.2.0 example program doesn't
update index because:

   line 33: if (solrSearcher.SolrSchema.IsValidUpdateIndexDocument(iDoc))
return false.
   update falls because of configuration file

schema.xml file:

line 265: 
...
line 279:

those fields "word", "timestamp" don't pass validation in SolrSchema.csline 217.

2.
When I run example with schema.xml from apache-solr-1.1.0-incubating
program throw Exception

System.Exception was unhandled
  Message="Http error in request/response to
http://localhost:8983/solr/update/";
  Source="SolrSharp"
  StackTrace:
   at org.apache.solr.SolrSharp.Configuration.SolrSearcher.WebPost(String
url, Byte[] bytesToPost, String& statusDescription) in
E:\SOLR-CSharp\src\Configuration\SolrSearcher.cs:line 229
   at org.apache.solr.SolrSharp.Update.SolrUpdater.PostToIndex(IndexDocument
oDoc, Boolean bCommit) in E:\SOLR-CSharp\src\Update\SolrUpdater.cs:line 70
   at SolrSharpExample.Program.Main(String[] args) in
E:\SOLR-CSharp\example\Program.cs:line 35
   at System.AppDomain.nExecuteAssembly(Assembly assembly, String[]
args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly
()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

xmlstring value from oDoc.SerializeToString()

"http://www.w3.org/2001/XMLSchema-instance\"
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\";>http://www.w3.org/2001/XMLSchema%5C%22%3E%3Cdoc%3E%3Cfield>name=\"id\">101One oh oneSonyElectronicsComputerGoodFastCheapUSB cable1.23499.991True"

I checked  all features from Solr tutorial, they are working. I'm running
solr on Windows XP Pro without firewall.

Do you know how to solve those problems? Do you recommend to handle all
communication by maillist/jira ?

Regards
Michael




Re: SolrSharp example

2007-06-20 Thread Michael Plax

Hi Jeff,

This is a log that I got after runnning SolrSharp example. I think example 
program posts not properly formatted xml.
I'm running Solr on Windows XP, Java 1.5. Are those settings could be the 
problem?


Thank you
Michael

Jun 19, 2007 5:26:39 PM org.apache.solr.core.SolrException log
SEVERE: org.apache.solr.core.SolrException: missing content stream
   at 
org.apache.solr.handler.XmlUpdateRequestHandler.handleRequestBody(XmlUpdateRequestHandler.java:75)
   at 
org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:77)

   at org.apache.solr.core.SolrCore.execute(SolrCore.java:658)
   at 
org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:191)
   at 
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:159)
   at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1089)
   at 
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:365)
   at 
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
   at 
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
   at 
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
   at 
org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
   at 
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211)
   at 
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
   at 
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)

   at org.mortbay.jetty.Server.handle(Server.java:285)
   at 
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:502)
   at 
org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:835)

   at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:641)
   at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:202)
   at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:378)
   at 
org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:226)
   at 
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)


Jun 19, 2007 5:26:39 PM org.apache.solr.core.SolrCore execute
INFO: /update/ version="1.0"+encoding%3D"utf-8"?>http://www.w3.org/2001/XMLSchema-instance"+xmln

s:xsd%3D"http://www.w3.org/2001/XMLSchema";>101One+oh+oneSonyElectronicsComputerGoodFastCheapUSB+cable1.23499.991True 0 16



- Original Message - 
From: "Jeff Rodenburg" <[EMAIL PROTECTED]>

To: "Michael Plax" <[EMAIL PROTECTED]>; 
Sent: Wednesday, June 20, 2007 8:42 AM
Subject: Re: SolrSharp example



Hi Michael -

Moving this conversations to the general solr mailing list...



 1. SolrSharp example solution works with schema.xml from

apache-solr-1.1.0-incubating.If I'm using schema.xml from
apache-solr-1.2.0 example program doesn't update index...

I didn't realize the solr 1.2 release code sample schema.xml was different
from the solr 1.1 version.  In my implementation, I had solr 1.1 already
installed and upgraded to 1.2 by replacing the war file (per the
instructions in solr.)  So, the example code is geared to go against
the 1.1schema.

For the example code, adding the "timestamp" field in the
ExampleIndexDocument public constructor such as:

   this.Add(new IndexFieldValue("timestamp", DateTime.Now.ToString
("s")+"Z")));

will take care of the solr 1.2 schema invalidation issue.

The addition of the @default attribute on this field in the schema is not
presently accommodated in the validation routine.  If I'm not mistaken, 
the
default attribute value will be applied for all documents without that 
field
present in the xml payload.  This would imply that any field with a 
default

attribute is not required for any implemented UpdateIndexDocument.  I'll
look into this further.



2. When I run example with schema.xml from

apache-solr-1.1.0-incubating program
throw Exception

Hmmm, can't really help you with this one.  It sounds as if solr is
incurring an error when the xml is posted to the server.  Try the standard
step-through troubleshooting routines to see what messages are being 
passed

back from the server.



-- j





Re: SolrSharp example

2007-06-20 Thread Yonik Seeley

On 6/20/07, Michael Plax <[EMAIL PROTECTED]> wrote:

This is a log that I got after runnning SolrSharp example. I think example
program posts not properly formatted xml.
I'm running Solr on Windows XP, Java 1.5. Are those settings could be the
problem?


Solr1.2 is pickier about the Content-type in the HTTP headers.
I bet it's being set incorrectly.

-Yonik


Re: SolrSharp example

2007-06-20 Thread Jeff Rodenburg

On 6/20/07, Yonik Seeley <[EMAIL PROTECTED]> wrote:


On 6/20/07, Michael Plax <[EMAIL PROTECTED]> wrote:
> This is a log that I got after runnning SolrSharp example. I think
example
> program posts not properly formatted xml.
> I'm running Solr on Windows XP, Java 1.5. Are those settings could be
the
> problem?

Solr1.2 is pickier about the Content-type in the HTTP headers.
I bet it's being set incorrectly.




Ahh, good point.  Within SolrSearcher.cs, the WebPost method contains this
setting:

oRequest.ContentType = "application/x-www-form-urlencoded";

Looking through the CHANGES.txt file in the 1.2 tagged release on svn:

9. The example solrconfig.xml maps /update to XmlUpdateRequestHandler using
the new request dispatcher (SOLR-104). This requires posted content to have
a valid contentType: curl -H 'Content-type:text/xml; charset=utf-8'.  The
response format matches that of /select and returns standard error codes. To
enable solr1.1 style /update, do not map "/update" to any handler in
solrconfig.xml (ryan)

For SolrSearcher.cs, it sounds as though changing the ContentType setting to
"text/xml" may fix this issue.

I don't have a 1.2 instance to test this against available to me right now,
but can check this later.  Michael, try updating your SolrSearcher.cs file
for this content-type setting to see if that resolves your issue.


thanks,
jeff r.


Re: SolrSharp example

2007-06-20 Thread Michael Plax

Hello,

Yonik and Jeff thank you for your help.
You are right this was content-type issue.

in order to run example  following things need to be done:

1.Code (SolrSharp) should be changed
from:
src\Configuration\SolrSearcher.cs(217):oRequest.ContentType = 
"application/x-www-form-urlencoded";

to:
src\Configuration\SolrSearcher.cs(217):oRequest.ContentType = 
"text/xml";


2. In order take care of the solr 1.2 schema invalidation issue:
schema.xml
comment line: 265

comment line: 279


or as Jeff suggested:
   For the example code, adding the "timestamp" field in the
   ExampleIndexDocument public constructor such as:
   this.Add(new IndexFieldValue("timestamp", 
DateTime.Now.ToString("s")+"Z")));


Regards
Michael




- Original Message - 
From: "Jeff Rodenburg" <[EMAIL PROTECTED]>

To: 
Sent: Wednesday, June 20, 2007 1:56 PM
Subject: Re: SolrSharp example



On 6/20/07, Yonik Seeley <[EMAIL PROTECTED]> wrote:


On 6/20/07, Michael Plax <[EMAIL PROTECTED]> wrote:
> This is a log that I got after runnning SolrSharp example. I think
example
> program posts not properly formatted xml.
> I'm running Solr on Windows XP, Java 1.5. Are those settings could be
the
> problem?

Solr1.2 is pickier about the Content-type in the HTTP headers.
I bet it's being set incorrectly.




Ahh, good point.  Within SolrSearcher.cs, the WebPost method contains this
setting:

oRequest.ContentType = "application/x-www-form-urlencoded";

Looking through the CHANGES.txt file in the 1.2 tagged release on svn:

9. The example solrconfig.xml maps /update to XmlUpdateRequestHandler 
using
the new request dispatcher (SOLR-104). This requires posted content to 
have

a valid contentType: curl -H 'Content-type:text/xml; charset=utf-8'.  The
response format matches that of /select and returns standard error codes. 
To

enable solr1.1 style /update, do not map "/update" to any handler in
solrconfig.xml (ryan)

For SolrSearcher.cs, it sounds as though changing the ContentType setting 
to

"text/xml" may fix this issue.

I don't have a 1.2 instance to test this against available to me right 
now,

but can check this later.  Michael, try updating your SolrSearcher.cs file
for this content-type setting to see if that resolves your issue.


thanks,
jeff r.





Re: SolrSharp example

2007-06-20 Thread Jeff Rodenburg

Thanks for checking, Michael -- great find.  I'm in process of readying this
same fix for inclusion in the source code (I'm verifying against a
full 1.2install.)

The SolrField class is now also being extended to incorporate an IsDefaulted
property, which will permit the SolrSchema.IsValidUpdateIndexDocument to
yield true when default value fields aren't present in the update request.

thanks,
jeff r.



On 6/20/07, Michael Plax <[EMAIL PROTECTED]> wrote:


Hello,

Yonik and Jeff thank you for your help.
You are right this was content-type issue.

in order to run example  following things need to be done:

1.Code (SolrSharp) should be changed
from:
src\Configuration\SolrSearcher.cs(217):oRequest.ContentType =
"application/x-www-form-urlencoded";
to:
src\Configuration\SolrSearcher.cs(217):oRequest.ContentType =
"text/xml";

2. In order take care of the solr 1.2 schema invalidation issue:
schema.xml
comment line: 265

comment line: 279

or as Jeff suggested:
For the example code, adding the "timestamp" field in the
ExampleIndexDocument public constructor such as:
this.Add(new IndexFieldValue("timestamp",
DateTime.Now.ToString("s")+"Z")));

Regards
Michael




- Original Message -
From: "Jeff Rodenburg" <[EMAIL PROTECTED]>
To: 
Sent: Wednesday, June 20, 2007 1:56 PM
Subject: Re: SolrSharp example


> On 6/20/07, Yonik Seeley <[EMAIL PROTECTED]> wrote:
>>
>> On 6/20/07, Michael Plax <[EMAIL PROTECTED]> wrote:
>> > This is a log that I got after runnning SolrSharp example. I think
>> example
>> > program posts not properly formatted xml.
>> > I'm running Solr on Windows XP, Java 1.5. Are those settings could be
>> the
>> > problem?
>>
>> Solr1.2 is pickier about the Content-type in the HTTP headers.
>> I bet it's being set incorrectly.
>>
>>
>>
> Ahh, good point.  Within SolrSearcher.cs, the WebPost method contains
this
> setting:
>
> oRequest.ContentType = "application/x-www-form-urlencoded";
>
> Looking through the CHANGES.txt file in the 1.2 tagged release on svn:
>
> 9. The example solrconfig.xml maps /update to XmlUpdateRequestHandler
> using
> the new request dispatcher (SOLR-104). This requires posted content to
> have
> a valid contentType: curl -H 'Content-type:text/xml;
charset=utf-8'.  The
> response format matches that of /select and returns standard error
codes.
> To
> enable solr1.1 style /update, do not map "/update" to any handler in
> solrconfig.xml (ryan)
>
> For SolrSearcher.cs, it sounds as though changing the ContentType
setting
> to
> "text/xml" may fix this issue.
>
> I don't have a 1.2 instance to test this against available to me right
> now,
> but can check this later.  Michael, try updating your SolrSearcher.csfile
> for this content-type setting to see if that resolves your issue.
>
>
> thanks,
> jeff r.
>