Hello,
I read about the possibility to have nested documents with solr
block-join since version 4.5.
I’m wondering if I can change an existing index to use this new
opportunity. Right now I’m having an index which stores informations
about a journal and each of its articles. For example an journal has
the id 1111-2222 and the articles have ids like 1111-2222-01,
1111-2222-02, ….
I also already using a field called j-id in all documents to refer to
the id of the journal (so all articles of a the journal in the given
example have the j-id 1111-2222). I’m using this j-id to group all
results of an journal with the group feature. Obviously this solution
lacks of some features like faceting or finding the parent journal of
an article without doing a second request.
So, the new block-joing feature seems to solve some of these problems
(sadly not all – as far as I see, I can’t get the parent document and
the articles where the search term was found in a nested result).
So, my question now: can I change my existing index in just adding a
is_parent and a _root_ field and saving the journal id there like I
did with j-id or do I have to reindex all my documents?
I made some test in adding the id of the parent journal in the _root_
field of the articles and trying to make a query like q={!parent
which='is_parent:true'}+description:test but it didn’t seem to work. I
only got an error message:
java.lang.IllegalArgumentException: docID must be >= 0 and <
maxDoc=1418849 (got docID=-1)\r\n\tat
org.apache.lucene.index.BaseCompositeReader.readerIndex(BaseCompositeReader.java:182)\r\n\tat org.apache.lucene.index.BaseCompositeReader.document(BaseCompositeReader.java:109)\r\n\tat org.apache.lucene.index.IndexReader.document(IndexReader.java:436)\r\n\tat org.apache.solr.search.SolrIndexSearcher.doc(SolrIndexSearcher.java:657)\r\n\tat org.apache.solr.response.TextResponseWriter.writeDocuments(TextResponseWriter.java:270)\r\n\tat org.apache.solr.response.TextResponseWriter.writeVal(TextResponseWriter.java:172)\r\n\tat org.apache.solr.response.JSONWriter.writeNamedListAsMapWithDups(JSONResponseWriter.java:183)\r\n\tat org.apache.solr.response.JSONWriter.writeNamedList(JSONResponseWriter.java:299)\r\n\tat org.apache.solr.response.JSONWriter.writeResponse(JSONResponseWriter.java:95)\r\n\tat org.apache.solr.response.JSONResponseWriter.write(JSONResponseWriter.java:60)\r\n\tat org.apache.solr.servlet.SolrDispatchFilter.writeResponse(SolrDispatchFilter.java:698)\r\n\tat org.apache.solr.
servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:426)\r\n\tat
org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:197)\r\n\tat
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)\r\n\tat
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)\r\n\tat
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)\r\n\tat
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)\r\n\tat
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)\r\n\tat
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)\r\n\tat
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)\r\n\tat
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)\r\n\tat
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)\r\n\tat
org.apache.coyote.ht
tp11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)\r\n\tat org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)\r\n\tat org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)\r\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)\r\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)\r\n\tat
java.lang.Thread.run(Thread.java:724)\r\n",
"code": 500
Do you have any advice how to fix this or to use block-join properly?
Thanks,
Gesh