lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Pang <pangyik...@gmail.com>
Subject Re: Lucene 5.2.0 global ordinal based query time join on multiple indexes
Date Tue, 21 Jul 2015 19:12:00 GMT
Seems if I create a MultiReader from my index searchers and create the
ordinal map from that MultiReader (and use an IndexSearcher created from
the MultiReader in the createJoinQuery), then the correct results are found.


On Mon, Jul 20, 2015 at 5:48 PM, Alex Pang <pangyikhei@gmail.com> wrote:

> Hi,
>
>
>
> Does the Global Ordinal based query time join support joining on multiple
> indexes?
>
>
>
> From my testing on 2 indexes with a common join field, the document ids I
> get back from the ScoreDoc[] when searching are incorrect, though the
> number of results is the same as if I use the older join query.
>
>
> For the parent (to) index, the value of the join field is unique to each
> document.
>
> For the child (from) index, multiple documents can have the same value for
> the join field, which must be found in the parent index.
>
> Both indexes have a join field indexed with SortedDocValuesField.
>
>
> The parent index had 7 segments and child index had 3 segments.
>
>
> Ordinal map is built with:
>
>     SortedDocValues[] values = new SortedDocValues[searcher1
>
>         .getIndexReader().leaves().size()];
>
>     for (LeafReaderContext leadContext : searcher1.getIndexReader()
>
>         .leaves()) {
>
>       values[leadContext.ord] = DocValues.getSorted(leadContext.reader(),
>
>           "join_field");
>
>     }
>
>     MultiDocValues.OrdinalMap ordinalMap = null;
>
>     ordinalMap = MultiDocValues.OrdinalMap.build(searcher1.getIndexReader()
>
>         .getCoreCacheKey(), values, PackedInts.DEFAULT);
>
>
> Join Query:
>
> joinQuery = JoinUtil.createJoinQuery("join_field",
>
>           fromQuery,
>
>           new TermQuery(new Term("type", "to")), searcher2,
>
>           ScoreMode.Max, ordinalMap);
>
>
>
> Thanks,
>
> Alex
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message