lucene-solr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hoss Man (JIRA)" <j...@apache.org>
Subject [jira] Commented: (SOLR-99) Allow default sort order
Date Thu, 11 Jan 2007 21:02:27 GMT

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

Hoss Man commented on SOLR-99:
------------------------------

the problem with a default sort order (which ANSI SQL does wrong in my opinion) is that it
can lead to "buggy" behavior without making it clear to the user what happened ... users can
test their app, get results, and those results might look like they are in the correct order
because of the nature of the data (ie: they sort by popularity and all documents currently
have no popularity because their application isn't live yet) and only later do they discover
that it's acctually "defaulting" and the default isn't what they want.

as for the legacy format: if it's not hurting anything, i don't see any reason to remove it.
 if it's easy to catch the ArrayIndexOutOfBoundsException and rethrow a better aexception
without gutting the legacy parsing code, we might as well leave it in.

if that parsing code is buggy and would require a lot of additional work to get it's parsing/error
handling equally robust, then purning it is probably fine.

> Allow default sort order
> ------------------------
>
>                 Key: SOLR-99
>                 URL: https://issues.apache.org/jira/browse/SOLR-99
>             Project: Solr
>          Issue Type: Improvement
>          Components: search
>    Affects Versions: 1.2
>            Reporter: Ryan McKinley
>            Priority: Minor
>             Fix For: 1.2
>
>         Attachments: DefaultSortOrder.patch, DefaultSortOrder.patch
>
>
> The current search throws an "ArrayIndexOutOfBoundsException" if you specify a sort field
but do not include an order.  This is anoying and difficult to debug (when you are starting)
> Here is a patch to avoid the exception and use the default sort order if you only specify
a field.  I'm not sure the 'null' case was even possible in the current code:
> Index: QueryParsing.java
> ===================================================================
> --- QueryParsing.java	(revision 494681)
> +++ QueryParsing.java	(working copy)
> @@ -186,13 +186,12 @@
>        }
>  
>        // get the direction of the sort
> -      str=parts[pos];
> -      if ("top".equals(str) || "desc".equals(str)) {
> -        top=true;
> -      } else if ("bottom".equals(str) || "asc".equals(str)) {
> -        top=false;
> -      }  else {
> -        return null;  // must not be a sort command
> +      // by default, top is true, only change it if it is "bottom" or "asc"
> +      if( parts.length > pos ) {
> +    	  str=parts[pos];
> +    	  if ("bottom".equals(str) || "asc".equals(str)) {
> +	         top=false;
> +	      }
>        }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message