We have solved the problem. We ended up using The Lucine API and the QueryParser. We also used @IndexedEmbedded(indexNullAs = IndexedEmbedded.DEFAULT_NULL_TOKEN) on field2.
bool.must(parser.parse("field1.field2:_null_" + " OR field1.field2.status.statusId:3"));
Have we found a bug or is there a logical explanation to the following? As you can see above, we use the constant IndexedEmbedded.DEFAULT_NULL_TOKEN which holds the value "__DEFAULT_NULL_TOKEN__". First we tried parser.parse("field1.field2:"+IndexedEmbedded.DEFAULT_NULL_TOKEN but this didn't work. When I looked in the index with Luke, it was indexed as _null_. Then I tried @IndexedEmbedded(indexNullAs = "MY_NULL_VALUE"), the index showed "MY_NULL_VALUE" in Luke but the query still didn't work when I used "MY_NULL_VALUE" in the query. I an only get it to work if I use @IndexedEmbedded(indexNullAs = IndexedEmbedded.DEFAULT_NULL_TOKEN) and _null_ as value in the query.
If only IndexedEmbedded.DEFAULT_NULL_TOKEN is an accepted value, why can we choose a value in the first place? And why does "__DEFAULT_NULL_TOKEN__" get translated to "_null_" in the index?
Anyone have an explanation to this behaviour?
Regards Andreas
|