Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 8AC4A200C3E for ; Tue, 21 Mar 2017 10:11:30 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 8949D160B74; Tue, 21 Mar 2017 09:11:30 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id A5366160B68 for ; Tue, 21 Mar 2017 10:11:29 +0100 (CET) Received: (qmail 48598 invoked by uid 500); 21 Mar 2017 09:11:27 -0000 Mailing-List: contact solr-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: solr-user@lucene.apache.org Delivered-To: mailing list solr-user@lucene.apache.org Received: (qmail 48307 invoked by uid 99); 21 Mar 2017 09:11:27 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Mar 2017 09:11:27 +0000 Received: from mail-vk0-f46.google.com (mail-vk0-f46.google.com [209.85.213.46]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id 66FDE1A0046 for ; Tue, 21 Mar 2017 09:11:27 +0000 (UTC) Received: by mail-vk0-f46.google.com with SMTP id x75so87802057vke.2 for ; Tue, 21 Mar 2017 02:11:27 -0700 (PDT) X-Gm-Message-State: AFeK/H0X7F7s5rDUIyBIta5RY65oAI+aXlY3IMcv1VqQxQmSqJsSMpqVaiWanCT/cbyiKVIo0CBiLSgfUSjtoA== X-Received: by 10.176.74.150 with SMTP id s22mr13148935uae.85.1490087486377; Tue, 21 Mar 2017 02:11:26 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.42.2 with HTTP; Tue, 21 Mar 2017 02:11:26 -0700 (PDT) In-Reply-To: References: From: Mikhail Khludnev Date: Tue, 21 Mar 2017 12:11:26 +0300 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: block join - search together at parent and childern To: solr-user Content-Type: multipart/alternative; boundary=f403045f881e4f5ada054b3a0732 archived-at: Tue, 21 Mar 2017 09:11:30 -0000 --f403045f881e4f5ada054b3a0732 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hello Jan, If I get you right, you need to find every word either in parent or child level, hence: q=3D+({!edismax qf=3D$pflds v=3D$w1} {!parent ..}{!edismax qf=3D$cflds v=3D= $w1}) +({!edismax qf=3D$pflds v=3D$w1} {!parent ..}{!edismax qf=3D$cflds v=3D$w1})...&w1=3Dfoo&w2=3Dbar note that spaces and + matter much. This yields cross-matches, but you probably don't bother about them. On Sun, Mar 19, 2017 at 11:58 AM, Jan Nekuda wrote: > Hi Michael, > thank you for fast answer - I have tried it, but it's not exactly what I > need. I hope that I understood it good - the problem is that if I will > write foo bar and foo bar is not found in root entity then it returns > nothing even if any field in children contains foo bar. > I need to write foo bar and find all documents where foo bar exists in > document A OR B OR C OR D even if in A will have FOO and in e.g C will be > bar. But if I will write bar of chocolate then I need return nothing. > > my idea was to use > edismax and filter query for each word: > http://localhost:8983/solr/demo/select?q=3D*:*&fq=3D{!parent > which=3Dtype:root}foo*&fq=3D{!parent > which=3Dtyp:root}bar*&wt=3Djson&indent=3Dtrue&defType=3Dedismax& > qf=3D$allfields&stopwords=3Dtrue&lowercaseOperators=3Dtrue&allfieldscolor= , > first_country, power, name, country > > the problem is that I'm not able to find also parent documents in one > condition with children. > > How I wrote I'm able solve it with another parent and then also doc A wil= l > be child and everything will work fine - but I would like to solve it > better. > > > Do you have or someone else another idea?:) > > Thanks > Jan > > > 2017-03-16 21:51 GMT+01:00 Mikhail Khludnev : > > > Hello Jan, > > > > What if you combine child and parent dismaxes like below > > q=3D{!edismax qf=3D$parentfields}foo bar {!parent ..}{!dismax qf=3D$chi= ldfields > > v=3D$childclauses}&childclauses=3Dfoo bar +type:child&parentfields=3D..= .& > > parentfields=3D... > > > > On Thu, Mar 16, 2017 at 10:54 PM, Jan Nekuda > wrote: > > > > > Hello Mikhail, > > > > > > thanks for fast answer. The problem is, that I want to have the disma= x > on > > > child and parent together - to have the filter evaluated together. > > > > > > I need to have documents: > > > > > > > > > path: car > > > > > > type:car > > > > > > color:red > > > > > > first_country: CZ > > > > > > name:seat > > > > > > > > > > > > path: car\engine > > > > > > type:engine > > > > > > power:63KW > > > > > > > > > > > > path: car\engine\manufacturer > > > > > > type:manufacturer > > > > > > name: xx > > > > > > country:PL > > > > > > > > > path: car > > > > > > type:car > > > > > > color:green > > > > > > first_country: CZ > > > > > > name:skoda > > > > > > > > > > > > path: car\engine > > > > > > type:engine > > > > > > power:88KW > > > > > > > > > > > > path: car\engine\manufacturer > > > > > > type:manufacturer > > > > > > name: yy > > > > > > country:PL > > > > > > > > > where car is parent document engine is its child a manufacturer is > child > > > of engine and the structure can be deep. > > > > > > I need to make a query with edismax over fields color, first_country, > > > power, name, country over parent and all childern. > > > > > > when I ask then "seat 63 kw" i need to get seat car > > > > > > the same if I will write only "seat" or only "63kw" or only "xx" > > > > > > but if I will write "seat 88kw" i expect that i will get no result > > > > > > I need to return parents in which tree are all the words which I wrot= e > to > > > query. > > > > > > How I wrote before my solution was to split the query text and use > q:*:* > > > and for each /word/ in query make > > > > > > fq=3D{!parent which=3Dtype:car}/word// > > > / > > > > > > //and edismax with qf=3Dcolor, first_country, power, name, country > > > > > > Thank you for your time:) > > > > > > Jan > > > > > > > > > Dne 16.03.2017 v 20:00 Mikhail Khludnev napsal(a): > > > > > > > > > Hello, > > >> > > >> It's hard to get into the problem. but you probably want to have > dismax > > on > > >> child level: > > >> q=3D{!parent ...}{!edismax qf=3D'childF1 childF2' v=3D$chq}&chq=3Dfo= o bar > > >> It's usually broken because child query might match parents which is > not > > >> allowed. Thus, it's probably can solved by adding +type:child into > chq. > > >> IIRC edismax supports lucene syntax. > > >> > > >> On Thu, Mar 16, 2017 at 4:47 PM, Jan Nekuda > > wrote: > > >> > > >> Hi, > > >>> I have a question for which I wasn't able to find a good solution. > > >>> I have this structure of documents > > >>> > > >>> A > > >>> |\ > > >>> | \ > > >>> B \ > > >>> \ > > >>> C > > >>> \ > > >>> \ > > >>> \ > > >>> D > > >>> > > >>> Document type A has fields id_number, date_from, date_to > > >>> Document type C has fields first_name, surname, birthdate > > >>> Document type D AND B has fields street_name, house_number, city > > >>> > > >>> > > >>> I want to find *all parents with block join and edismax*. > > >>> The problem is that I have found that possible is find children by > > >>> parent, > > >>> or parent by children. > > >>> *I want to find parent by values in parent and in children*. I want > to > > >>> use > > >>> edismax with all fields from all documents (id_number, date_from, > > >>> date_to, > > >>> has fields first_name, surname, birthdate,street_name, house_number= , > > >>> city). > > >>> I want to write *Hynek* AND *Brojova* AND 14 and I expect that it > > returns > > >>> document A because it found Hynek in surname, Brojova in street and > 14 > > in > > >>> house number. > > >>> This is easy with {!parent which=3Dtype:A} > > >>> the problem is, that I'm not able to find by condition 789 AND > > *Brojova* > > >>> where 789 is id_number from type A and Brojova is Street from D. > > >>> > > >>> In short I need to find all parents of tree (parent and childern) i= n > > >>> which > > >>> are matched all the word which i send to condition > > >>> > > >>> > > >>> My only solution is to make root type X. Then A will be its child. > > Then I > > >>> can use {!parent which=3Dtype:X}. > > >>> Than this will work: > > >>> > > >>> http://localhost:8983/solr/demo/select?q=3D*:*&fq=3D{!parent > > >>> which=3Dtype:X}brojova*&fq=3D{!parent which=3Dtype:X}16&wt=3Djson& > > >>> indent=3Dtrue&defType=3Dedismax&qf=3Did_number date_from date_to ha= s > fields > > >>> first_name surname birthdate street_name house_number > > >>> city&stopwords=3Dtrue& > > >>> lowercaseOperators=3Dtrue > > >>> > > >>> > > >>> But I believe it can be solved much better. > > >>> > > >>> X > > >>> | > > >>> A > > >>> |\ > > >>> | \ > > >>> B \ > > >>> \ > > >>> C > > >>> \ > > >>> \ > > >>> \ > > >>> D > > >>> > > >>> > > >>> Thanks for your help > > >>> Jan > > >>> > > >>> > > >> > > >> > > > > > > > > > --- > > > Tato zpr=C3=A1va byla zkontrolov=C3=A1na na viry programem Avast Anti= virus. > > > https://www.avast.com/antivirus > > > > > > > > > > > -- > > Sincerely yours > > Mikhail Khludnev > > > --=20 Sincerely yours Mikhail Khludnev --f403045f881e4f5ada054b3a0732--