You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Shawn Heisey (JIRA)" <ji...@apache.org> on 2015/12/11 15:42:10 UTC

[jira] [Closed] (SOLR-8403) EmbeddedSolrServer has broken sorting with functions and non-alphanumeric symbols in field names

     [ https://issues.apache.org/jira/browse/SOLR-8403?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Shawn Heisey closed SOLR-8403.
------------------------------
    Resolution: Not A Problem

This is not considered a bug.  We see your schema as badly configured.  I am closing this issue.  The following has been the official recommendation regarding field names for quite some time:

bq. field names should consist of alphanumeric or underscore characters only and not start with a digit. This is not currently strictly enforced, but other field names will not have first class support from all components and back compatibility is not guaranteed.

Future plans for Solr include enforcing these restrictions, which will cause Solr to fail when it tries to load your schema configuration.  See SOLR-8110.

> EmbeddedSolrServer has broken sorting with functions and non-alphanumeric symbols in field names
> ------------------------------------------------------------------------------------------------
>
>                 Key: SOLR-8403
>                 URL: https://issues.apache.org/jira/browse/SOLR-8403
>             Project: Solr
>          Issue Type: Bug
>    Affects Versions: 5.3.1
>            Reporter: Vasiliy Bout
>              Labels: embedded, sorting
>
> We are trying to use EmbeddedSolrServer to test our Java code, that sends queries to Solr server.
> We have a number of non-alphanumeric characters in field names in our schema, and such field names work fine for searching and sorting on both real Solr server (via HttpSolrClient) and on EmbeddedSolrServer.
> But when we make search query that has functions in sort clause, real server handles these queries correctly while EmbeddedSolrServer throws exception.
> Suppose, we have a field with name {{foo:bar}}. The following query works fine with both real server and EmbeddedSolrServer:
> {code}
> solrClient.query(new SolrQuery("*:*").addSort("foo:bar", SolrQuery.ORDER.desc));
> {code}
> But when we try to use functions in sort clause, exception is thrown by EmbeddedSolrServer (real server works correctly). For the following code:
> {code}
> solrClient.query(new SolrQuery("*:*").addSort("def(foo:bar,0)", SolrQuery.ORDER.desc));
> {code}
> we get the following exception:
> {noformat}
> org.apache.solr.common.SolrException: sort param could not be parsed as a query, and is not a field that exists in the index: def(foo:bar,0)
> 	at org.apache.solr.search.QueryParsing.parseSortSpec(QueryParsing.java:348)
> 	at org.apache.solr.search.QParser.getSort(QParser.java:247)
> 	at org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:185)
> 	at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:251)
> 	at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:143)
> 	at org.apache.solr.core.SolrCore.execute(SolrCore.java:2068)
> 	at org.apache.solr.client.solrj.embedded.EmbeddedSolrServer.request(EmbeddedSolrServer.java:179)
> 	at org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:135)
> 	at org.apache.solr.client.solrj.SolrClient.query(SolrClient.java:943)
> 	at org.apache.solr.client.solrj.SolrClient.query(SolrClient.java:958)
> 	...
> {noformat}
> If we have a space character between function arguments:
> {code}
> solrClient.query(new SolrQuery("*:*").addSort("def(foo:bar, 0)", SolrQuery.ORDER.desc));
> {code}
> we get different exception:
> {noformat}
> org.apache.solr.common.SolrException: Can't determine a Sort Order (asc or desc) in sort spec 'def(foo:bar, 0) desc', pos=12
> 	at org.apache.solr.search.QueryParsing.parseSortSpec(QueryParsing.java:329)
> 	at org.apache.solr.search.QParser.getSort(QParser.java:247)
> 	at org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:185)
> 	at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:251)
> 	at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:143)
> 	at org.apache.solr.core.SolrCore.execute(SolrCore.java:2068)
> 	at org.apache.solr.client.solrj.embedded.EmbeddedSolrServer.request(EmbeddedSolrServer.java:179)
> 	at org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:135)
> 	at org.apache.solr.client.solrj.SolrClient.query(SolrClient.java:943)
> 	at org.apache.solr.client.solrj.SolrClient.query(SolrClient.java:958)
> 	...
> {noformat}
> Anyway, we have our tests failing with correctly written code that works on real server. Please, make EmbeddedSolrServer to behave the same way as the real Solr server.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org