Hello Julia,
I'm not sure why not just post process facet values of two fields. Overall,
JSON Facets are not extendable (btw, why?). To hack them you need to extend
FacetModule and inject your custom facet processor somewhere
around 
org.apache.solr.search.facet.FacetParser#parseFacetOrStat(java.lang.String,
java.lang.String, java.lang.Object).

On Wed, Jan 4, 2023 at 5:54 PM Julia Gilenko
<jgile...@proofpoint.com.invalid> wrote:

> Hi everyone,
>
> We have two multi-valued fields, both containing usernames, and we'd like
> to compute the combined counts across both fields. For example, if we were
> to facet on these two docs:
>
> doc1: { field1: [user1, user2], field2: [user3, user4] }
> doc2: { field1: [user1, user3], field2: [user2] }
>
> we'd expect the following counts:
>
> user1: 2
> user2: 2
> user3: 2
> user4: 1
>
> I know one option is to create a new field that combines the two and facet
> on that, but these lists can be large and we could have millions of unique
> users, so we're looking at implementing a custom facet processor to avoid
> duplicating data. Looks like one way would be to subclass SimpleFacets and
> register a new FacetComponent, but this seems to use the legacy faceting
> methods. Is there a way to do something similar with the JSON API? Is this
> even advisable?
>
> Thanks,
> Julia
>


-- 
Sincerely yours
Mikhail Khludnev
https://t.me/MUST_SEARCH
A caveat: Cyrillic!

Reply via email to