lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mikhail Khludnev <m...@apache.org>
Subject Re: join in lucene
Date Thu, 16 Mar 2017 18:47:13 GMT
>
> *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,...*


I don't see any reasons why it couldn't work in this manner. but it just
usually slow.


On Thu, Mar 16, 2017 at 8:59 PM, Cristian Lorenzetto <
cristian.lorenzetto@gmail.com> wrote:

> 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
> index
>   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,
> scoreMode);
>   TopDocs topDocs = toSearcher.search(joinQuery, 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)?*
>



-- 
Sincerely yours
Mikhail Khludnev

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