You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by "Ryan McKinley (JIRA)" <ji...@apache.org> on 2007/04/29 02:31:15 UTC

[jira] Commented: (SOLR-220) Solr returns "HTTP status code=1" in some case

    [ https://issues.apache.org/jira/browse/SOLR-220?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12492531 ] 

Ryan McKinley commented on SOLR-220:
------------------------------------

I just checked in a much smaller patch that at least won't throw a status code="1"
http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/schema/IndexSchema.java?r1=533449&r2=533448&pathrev=533449

We should probably use your patch so that it has a nice context specific error, rather then the general "undefined field"

As an aside, SOLR-204 will make the request dispatcher the default /select handler.  This catches invalid error codes and returns a 500.

thanks



> Solr returns "HTTP status code=1" in some case
> ----------------------------------------------
>
>                 Key: SOLR-220
>                 URL: https://issues.apache.org/jira/browse/SOLR-220
>             Project: Solr
>          Issue Type: Bug
>          Components: search
>            Reporter: Koji Sekiguchi
>         Attachments: QueryParsing.patch
>
>
> If I request the following on solr example:
> http://localhost:8080/solr/select?q=ipod%3Bzzz+asc&version=2.2&start=0&rows=10&indent=on
> I got an exception as I expected because zzz isn't undefined, but HTTP status code is 1. I expected 400 in this case.
> The reason of this is because IndexSchema.getField() method throws SolrException(1,"") and QueryParsing.parseSort() doesn't catch it:
>         // getField could throw an exception if the name isn't found
>     	SchemaField f = schema.getField(part);	// <=== makes HTTP status code=1
>         if (f == null || !f.indexed()){
>           throw new SolrException( 400, "can not sort on unindexed field: "+part );
>         }
> There seems to be a couple of ways to solve this problem:
> 1. IndexSchema.getField() method throws SolrException(400,"")
> 2. IndexSchema.getField() method doesn't throw the exception but returns null
> 3. The caller catches the exception and re-throws SolrException(400,"")
> 4. The caller catches the exception and re-throws SolrException(400,"",cause) that wraps the cause exception
> I think either #3 or #4 will be acceptable. The attached patch is #3 for sort on undefined field.
> Other than QueryParsing.parseSort(), IndexSchema.getField() is called by the following class/methos:
> - CSVLoader.prepareFields()
> - JSONWriter.writeDoc()
> - SimpleFacets.getTermCounts()
> - QueryParsing.parseValSource()
> I'm not sure these methods require same patch. Any thoughts?
> regards,

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.