Hi Folks,

Wanted to follow up here. Can someone help me just answer whether what I'm
hoping for is feasible?

(a) The desired outcome is supported with the right model/queries
(b) The desired outcome is not supported; maybe it could be in the future
(c) The desired outcome is fundamentally unsupportable for the
foreseeable future

To summarize, the desired behavior is:

- Query which can AND across child docs (i.e, return parents whos children
match an AND query even if tokens are spread across children)
- Query whose parents are returned based on relevance of the children

In my example, obviously there is parent data being queried ("post_en"),
but the parent data could easily be made child data if need be.

Thanks!
Stephen

On Mon, Oct 25, 2021 at 6:54 AM Stephen Lewis Bianamara <
[email protected]> wrote:

> Hi SOLR Community,
>
> I'm experimenting with solr 8.10 and trying to get a query pattern with
> child docs to work. An example of a nested document structure I'd like to
> search is below. In this example, there will only be two levels, child of
> type:post and /comments children.
> {
>     "id": "post1",
>     "type": "post",
>     "post_en": "I put lemon on my apple slices to keep them fresh",
>     "comments": [
>         {
>             "id": "comment1",
>             "type": "comment",
>             "comment_en": "Lime works too"
>         },
>         {
>             "id": "comment2",
>             "type": "comment",
>             "comment_en": "Does it work for pears?"
>         }
>     ]
> }
>
> What I'd like is to be able to do keyword search for /lemon apple/ and
> only return the parent; /lemon lime/ and return the parent and comment1;
> /lemon pear/ and return the parent and comment2; /lime pear/ and return the
> parent, comment1, and comment2. And /lime gum/ should return nothing (as if
> it were an AND query). Additionally, this should all be done with relevance.
>
> I've tried a few combinations of nested docs from this documentation
> <https://solr.apache.org/guide/8_10/searching-nested-documents.html>, but
> am having trouble getting this to work. I wonder if I'm asking more from
> block join/child doc transformer than it currently supports, or perhaps I'm
> just missing something. Can someone familiar with nesting documents help me
> out? I've included my schema below as well.
>
> Thanks!
> Stephen
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <schema name="ChildTest" version="1.5">
>   <fields>
>     <field name="id" type="string" required="true" docValues="true"/>
>     <dynamicField name="*_en" type="text_en" large="true" omitNorms="true"
> />
>     <field name="username" type="string" docValues="true" />
>     <field name="type" type="string" docValues="true" />
>     <field name="_version_" type="long" />
>     <!-- child docs -->
>     <field name="_root_" type="string" indexed="true" stored="false"
> docValues="false" />
>     <field name="_nest_path_" type="_nest_path_" />
>     <field name="_nest_parent_" type="string" indexed="true" stored="true"
> />
>   </fields>
>   <uniqueKey>id</uniqueKey>
>   <types>
>     <fieldType name="_nest_path_" class="solr.NestPathField" />
>     <fieldType name="long" class="solr.LongPointField" />
>     <fieldType name="string" class="solr.StrField" sortMissingLast="true"
> />
>     <fieldType name="text_en" class="solr.TextField"
> positionIncrementGap="100" autoGeneratePhraseQueries="true">
>       <analyzer type="index">
>         <tokenizer class="solr.WhitespaceTokenizerFactory"/>
>         <filter class="solr.LowerCaseFilterFactory"/>
>         <filter class="solr.SnowballPorterFilterFactory"/>
>       </analyzer>
>       <analyzer type="query">
>         <tokenizer class="solr.WhitespaceTokenizerFactory"/>
>         <filter class="solr.LowerCaseFilterFactory"/>
>         <filter class="solr.SnowballPorterFilterFactory"/>
>       </analyzer>
>     </fieldType>
>   </types>
> </schema>
>

Reply via email to