lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cristian Lorenzetto <>
Subject join in lucene
Date Thu, 16 Mar 2017 17:59:04 GMT
I want realize multiple joins in lucene.
Considering the complexy of joining i want i will skip index join.

first strategy :
Query-time joins

String fromField = "from"; // Name of the from field
  boolean multipleValuesPerDocument = false; // Set only yo true in
the case when your fromField has multiple values per document in your
  String toField = "to"; // Name of the to field
  ScoreMode scoreMode = ScoreMode.Max // Defines how the scores are
translated into the other side of the join.
  Query fromQuery = new TermQuery(new Term("content", searchTerm)); //
Query executed to collect from values to join to the to values

  Query joinQuery = JoinUtil.createJoinQuery(fromField,
multipleValuesPerDocument, toField, fromQuery, fromSearcher,
  TopDocs topDocs =, 10); // Note:
toSearcher can be the same as the fromSearcher
  // Render topDocs...

*First question is: *

*it possible to use joinedQuery in nested way(if i have 2 joins to 2
different entities for example)? *
*main query -> nested inside first join -> nested in the second join,...*

Query-custom joins
I could realize a mini class Loader  making joins:
 1) every entity is a different class
 2) by reflection if the getter is class ==entity .... Loader load document
with the key saved in parent object.

*second question:*
*this solution is essentially similar to how it works the query times or
not (so similar performance)?*

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