lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mikhail Khludnev <m...@apache.org>
Subject Re: ToParentBlockJoinSortField and NullPointerException - test case
Date Wed, 02 Aug 2017 12:58:36 GMT
Make sure it uses IW.updateDocuments() to write docs block as whole

On Wed, Aug 2, 2017 at 8:15 PM, Alexander Lipatov <alipatov@advisa.ru>
wrote:

> Hello,
>
> I have a ToParentBlockJoinQuery and I want to sort the results by one of
> the child fields. I have: ToParentBlockJoinSortField
>
> Sometimes it works good. And sometimes I have a strange error. Maybe you
> can guess what's going on based on the stack trace. If not - I created an
> example here: https://github.com/jamerlan/LuceneNestedSearchError
>
> It fails on: "parents.length()" because parents is null.
> Lucene version: 6.6.0
>
> Exception in thread "main" java.lang.NullPointerException
> 	at org.apache.lucene.search.join.BlockJoinSelector.wrap(BlockJoinSelector.java:161)
> 	at org.apache.lucene.search.join.ToParentBlockJoinSortField$3.getNumericDocValues(ToParentBlockJoinSortField.java:168)
> 	at org.apache.lucene.search.FieldComparator$NumericComparator.doSetNextReader(FieldComparator.java:153)
> 	at org.apache.lucene.search.SimpleFieldComparator.getLeafComparator(SimpleFieldComparator.java:36)
> 	at org.apache.lucene.search.FieldValueHitQueue.getComparators(FieldValueHitQueue.java:180)
> 	at org.apache.lucene.search.TopFieldCollector$SimpleFieldCollector.getLeafCollector(TopFieldCollector.java:100)
> 	at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:659)
> 	at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:472)
> 	at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:591)
> 	at org.apache.lucene.search.IndexSearcher.searchAfter(IndexSearcher.java:576)
> 	at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:491)
> 	at parentchild.StrangeErrorTest.main(StrangeErrorTest.java:87)
>
>
> Strange thing is:
> If you comment out this block:
>         BookStore bs2 = new BookStore(2, "second");
>         BookStoreInfo bookStoreInfo2 = new BookStoreInfo(20, "book 2");
>         index(searcherManager, indexWriter, bs2, bookStoreInfo2);
> then it works.
>
> Thank you for help!
>



-- 
Sincerely yours
Mikhail Khludnev

Mime
View raw message