The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

solr addSortField

Discussion in 'General Discussion' started by judi, Dec 17, 2010.

  1. judi

    judi Registered

    Joined:
    Dec 17, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    i am using solr to index and search documents. i have got the following fields defined in my schema.xml

    Code:
       <field name="id" type="string" indexed="true" stored="true" required="true" /> 
       <field name="title" type="textgen" indexed="true" stored="true"/>
       <field name="date" type="date" indexed="true" stored="true"/>
       <field name="author" type="textgen" indexed="true" stored="true"/>
       <field name="number" type="textgen" indexed="true" stored="true"/>
       <field name="docType" type="textgen" indexed="true" stored="true"/>
       <field name="docTypeExact" type="string" indexed="true" stored="true"/>
       <field name="oemPartner" type="textgen" indexed="true" stored="true"/>
       <field name="languages" type="textgen" indexed="true" stored="true" multiValued="true" omitNorms="true" />
       <field name="productGroup" type="textgen" indexed="true" stored="true"/>
       <field name="specificProductGroup" type="textgen" indexed="true" stored="true"/>   
       <field name="url" type="textgen" indexed="true" stored="true"/>
       <field name="content" type="textgen" indexed="true" stored="true"/>
       <field name="users" type="textgen" indexed="true" stored="true" multiValued="true" omitNorms="true" />
       
       <field name="docClass" type="string" indexed="true" stored="true"/>
    
       <field name="text" type="text" indexed="true" stored="false" multiValued="true"/>
    searching the index works perfectly well as long as i do not add a sort field. as soon as i add the following command, the whole thing crashes:
    solrQuery.addSortField("title", SolrQuery.ORDER.asc);

    the strange thing about this is, that only sorting by some fields causes the program to crash. sorting for example by "id" or "author" works without any problem.

    here is the error message i get when sorting by "title" or "oemPartner", etc.:

    Code:
    org.apache.solr.client.solrj.SolrServerException: Error executing query
    	at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:95)
    	at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:118)
    	at solrSearch.SolrSearch.search(SolrSearch.java:46)
    	at solrSearch.Main.main(Main.java:54)
    Caused by: org.apache.solr.common.SolrException: 4__javalangArrayIndexOutOfBoundsException_4___at_orgapachelucenesearchFieldCacheImpl$StringIndexCachecreateValueFieldCacheImpljava721___at_orgapachelucenesearchFieldCacheImpl$CachegetFieldCacheImpljava224___at_orgapachelucenesearchFieldCacheImplgetStringIndexFieldCacheImpljava692___at_orgapachelucenesearchFieldComparator$StringOrdValComparatorsetNextReaderFieldComparatorjava667___at_orgapachelucenesearchTopFieldCollector$OneComparatorNonScoringCollectorsetNextReaderTopFieldCollectorjava94___at_orgapachesolrsearchDocSetDelegateCollectorsetNextReaderDocSetHitCollectorjava140___at_orgapachelucenesearchIndexSearchersearchIndexSearcherjava249___at_orgapachelucenesearchSearchersearchSearcherjava171___at_orgapachesolrsearchSolrIndexSearchergetDocListAndSetNCSolrIndexSearcherjava1101___at_orgapachesolrsearchSolrIndexSearchergetDocListCSolrIndexSearcherjava880___at_orgapachesolrsearchSolrIndexSearchersearchSolrIndexSearcherjava341___at_orgapachesolrhandlercomponentQueryComponentprocessQueryComponentjava182___at_orgapachesolrhandlercomponentSearchHandlerhandleRequestBodySearchHandlerjava195___at_orgapachesolrhandlerRequestHandlerBasehandleRequestRequestHandlerBasejava131___at_orgapachesolrcoreSolrCoreexecuteSolrCorejava1316___at_orgapachesolrservletSolrDispatchFilterexecuteSolrDispatchFilterjava338___at_orgapachesolrservletSolrDispatchFilterdoFilterSolrDispatchFilterjava241___at_orgmortbayjettyservletServletHandler$CachedChaindoFilterServletHandlerjava1089___at_orgmortbayjettyservletServletHandlerhandleServletHandlerjava365___at_orgmortbayjettysecuritySecurityHandlerhandleSecurityHandlerjava216___at_orgmortbayjettyservletSessionHandlerhandleSessionHandlerjava181___at_orgmortbayjettyhandlerContextHandlerhandleContextHandlerjava712___at_orgmortbayjettywebappWebAppContexthandleWebAppContextjava405___at_orgmortbayjet
    
    4__javalangArrayIndexOutOfBoundsException_4___at_orgapachelucenesearchFieldCacheImpl$StringIndexCachecreateValueFieldCacheImpljava721___at_orgapachelucenesearchFieldCacheImpl$CachegetFieldCacheImpljava224___at_orgapachelucenesearchFieldCacheImplgetStringIndexFieldCacheImpljava692___at_orgapachelucenesearchFieldComparator$StringOrdValComparatorsetNextReaderFieldComparatorjava667___at_orgapachelucenesearchTopFieldCollector$OneComparatorNonScoringCollectorsetNextReaderTopFieldCollectorjava94___at_orgapachesolrsearchDocSetDelegateCollectorsetNextReaderDocSetHitCollectorjava140___at_orgapachelucenesearchIndexSearchersearchIndexSearcherjava249___at_orgapachelucenesearchSearchersearchSearcherjava171___at_orgapachesolrsearchSolrIndexSearchergetDocListAndSetNCSolrIndexSearcherjava1101___at_orgapachesolrsearchSolrIndexSearchergetDocListCSolrIndexSearcherjava880___at_orgapachesolrsearchSolrIndexSearchersearchSolrIndexSearcherjava341___at_orgapachesolrhandlercomponentQueryComponentprocessQueryComponentjava182___at_orgapachesolrhandlercomponentSearchHandlerhandleRequestBodySearchHandlerjava195___at_orgapachesolrhandlerRequestHandlerBasehandleRequestRequestHandlerBasejava131___at_orgapachesolrcoreSolrCoreexecuteSolrCorejava1316___at_orgapachesolrservletSolrDispatchFilterexecuteSolrDispatchFilterjava338___at_orgapachesolrservletSolrDispatchFilterdoFilterSolrDispatchFilterjava241___at_orgmortbayjettyservletServletHandler$CachedChaindoFilterServletHandlerjava1089___at_orgmortbayjettyservletServletHandlerhandleServletHandlerjava365___at_orgmortbayjettysecuritySecurityHandlerhandleSecurityHandlerjava216___at_orgmortbayjettyservletSessionHandlerhandleSessionHandlerjava181___at_orgmortbayjettyhandlerContextHandlerhandleContextHandlerjava712___at_orgmortbayjettywebappWebAppContexthandleWebAppContextjava405___at_orgmortbayjet
    
    request: [url]http://localhost:8983/solr/select?q=text:(apache[/url]) AND docClass:(document) AND users:(aarman) AND docType:(repair drawing)&facet=true&facet.mincount=1&facet.field=docTypeExact&sort=oemPartner asc&wt=javabin&version=1
    	at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:435)
    	at org.apache.solr.client.solrj.impl.CommonsHttpSolrServer.request(CommonsHttpSolrServer.java:244)
    	at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:89)
    	... 3 more
    can anybody help me?
    Judi
     

Share This Page