You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Jeffery Yuan <yu...@gmail.com> on 2017/06/23 19:59:11 UTC

Does solr support multiple collapse officially?

I am trying to use multiple collapse (post) filters:
- collapse on seriesId if seriesId are same
- collapse on tmsId(another Id) if they are same

But seems that Solr doesn't support multiple collapse filters. 

I get NullPointerException sometimes, which I summarized at 
https://issues.apache.org/jira/browse/SOLR-10885

-- Copied from SOLR-10885
Solr collapse is a great function to collapse data that is related so we
only show one in search result.
Just found one issue related with it - It throw NullPointerException in some
cases.
To reproduce it, first ingest some data - AND commit multiple times.
1. When there is no data that matches the query:
http://localhost:8983/solr/thecollection/select?defType=edismax&q=non-existType:*&fq=
{!collapse field=seriesId nullPolicy=expand}&fq={!collapse field=programId
nullPolicy=expand}

- But the problem only happens if I use both collapse fqs, if I just use one
of them, it would be fine.

*2. When the data that matches the query doesn't have the collapse fields
- This is kind of a big problem as we may store different kinds of docs in
one collection, one query may match different kinds of docs. 
If some docs (docType1) have same value for field1, we want to collapse
them, if other dosc(docType2) have some value for field2, do same things.*
- channel data doesn't have seriesId or programId
http://localhost:8983/solr/thecollection/select?defType=edismax&q=docType:channel&fq={!collapse
field=seriesId nullPolicy=expand}
&fq=
{!collapse field=programId nullPolicy=expand}
But the problem only happens if I use both collapse fqs, if I just use one
of them, it would be fine.
Exception from log:
Caused by:
org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error
from server at http://localhost:8983/solr/searchItems_shard1_replica3:
java.lang.NullPointerException
at
org.apache.solr.search.CollapsingQParserPlugin$OrdScoreCollector.finish(CollapsingQParserPlugin.java:617)
at
org.apache.solr.search.CollapsingQParserPlugin$OrdScoreCollector.finish(CollapsingQParserPlugin.java:667)
at
org.apache.solr.search.SolrIndexSearcher.buildAndRunCollectorChain(SolrIndexSearcher.java:256)
at
org.apache.solr.search.SolrIndexSearcher.getDocListNC(SolrIndexSearcher.java:1823)
at
org.apache.solr.search.SolrIndexSearcher.getDocListC(SolrIndexSearcher.java:1640)
at
org.apache.solr.search.SolrIndexSearcher.search(SolrIndexSearcher.java:611)
at
org.apache.solr.handler.component.QueryComponent.process(QueryComponent.java:533)
at
org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:295)
at
org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:166)
at org.apache.solr.core.SolrCore.execute(SolrCore.java:2299)
at org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:658)
at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:464)
at
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:345)
at
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:296)
at
org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1691)
at
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:582)
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
at
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512)
at
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)
at
org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119)
at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
int nextDocBase = currentContext + 1 < this.contexts.length ?
this.contexts[(currentContext + 1)].docBase : this.maxDoc; - 617 from solr
6.4.1 CollapsingQParserPlugin.java
Seems related with https://issues.apache.org/jira/browse/SOLR-8807
But SOLR-8807 only fixes issue related with spell checker.
I may test this with latest solr 6.6.0 when I have time.
Updated:
Whether solr supports multiple collapse fields?
Seems the query occasionally works (1/10 maybe), but othertimes it throws
NullPointerException
http://localhost:18983/solr/thecollection/select?q=programId:* AND
id:*&defType=edismax&fq= {!collapse+field=id }
&fq=
{!collapse+field=programId }



--
View this message in context: http://lucene.472066.n3.nabble.com/Does-solr-support-multiple-collapse-officially-tp4342614.html
Sent from the Solr - User mailing list archive at Nabble.com.