faceted-search

Can someone explain to me what this GetCardinality method is doing?

人走茶凉 提交于 2019-11-30 11:42:38
问题 I've been looking into faceted search with Lucene.NET, I've found a brilliant example here which explains a fair amount, apart from the fact that it completely overlooks the function which checks the cardinality of items in a bit array. Can anyone give me a run down of what it is doing? The main things I don't understand is why the bitsSetArray is created as it is, what it is used for and how all the if statements work in the for loop. This may be a big ask but I have to understand how this

Efficient way to compute *Facet Counts* in Elastic Search

一个人想着一个人 提交于 2019-11-30 10:21:00
I want to compute facet counts for a facet query UI but I think I am missing something as I am unable to get the numbers I need using facet filters. Here's an example. Given two facets with three possible terms in each facet: Colors: {red, yellow, blue} Notes: {do, re, mi} When I do a search, the counts for each term in a facet do not take into account the filters set in the other facet. To illustrate: [ ] All colors (18) [x] Red (10) [ ] Green (5) [ ] Blue (3) [ ] All notes (18) [ ] Do (5) [x] Re (7) [ ] Mi (6) Note that the totals within each facet sum to the total number of hits for the

ElasticSearch group by multiple fields

寵の児 提交于 2019-11-30 01:20:25
The only close thing that I've found was: Multiple group-by in Elasticsearch Basically I'm trying to get the ES equivalent of the following MySql query: select gender, age_range, count(distinct profile_id) as count FROM TABLE group by age_range, gender The age and gender by themselves were easy to get: { "query": { "match_all": {} }, "facets": { "ages": { "terms": { "field": "age_range", "size": 20 } }, "gender_by_age": { "terms": { "fields": [ "age_range", "gender" ] } } }, "size": 0 } which gives: { "ages": { "_type": "terms", "missing": 0, "total": 193961, "other": 0, "terms": [ { "term": 0

Can someone explain to me what this GetCardinality method is doing?

假装没事ソ 提交于 2019-11-30 01:00:40
I've been looking into faceted search with Lucene.NET, I've found a brilliant example here which explains a fair amount, apart from the fact that it completely overlooks the function which checks the cardinality of items in a bit array. Can anyone give me a run down of what it is doing? The main things I don't understand is why the bitsSetArray is created as it is, what it is used for and how all the if statements work in the for loop. This may be a big ask but I have to understand how this works before I can even think of using it in my own code. Thanks public static int GetCardinality

How to get an Elasticsearch aggregation with multiple fields

拈花ヽ惹草 提交于 2019-11-29 22:12:01
I'm attempting to find related tags to the one currently being viewed. Every document in our index is tagged. Each tag is formed of two parts - an ID and text name: { ... meta: { ... tags: [ { id: 123, name: 'Biscuits' }, { id: 456, name: 'Cakes' }, { id: 789, name: 'Breads' } ] } } To fetch the related tags I am simply querying the documents and getting an aggregate of their tags: { "query": { "bool": { "must": [ { "match": { "item.meta.tags.id": "123" } }, { ... } ] } }, "aggs": { "baked_goods": { "terms": { "field": "item.meta.tags.id", "min_doc_count": 2 } } } } This works perfectly, I am

Efficient way to compute *Facet Counts* in Elastic Search

孤街醉人 提交于 2019-11-29 16:00:50
问题 I want to compute facet counts for a facet query UI but I think I am missing something as I am unable to get the numbers I need using facet filters. Here's an example. Given two facets with three possible terms in each facet: Colors: {red, yellow, blue} Notes: {do, re, mi} When I do a search, the counts for each term in a facet do not take into account the filters set in the other facet. To illustrate: [ ] All colors (18) [x] Red (10) [ ] Green (5) [ ] Blue (3) [ ] All notes (18) [ ] Do (5)

Solr - Getting facet counts without returning search results

两盒软妹~` 提交于 2019-11-29 02:11:14
问题 I need to return only the facet counts from solr. So I basically want to search over all documents and return the facet counts, but I don't want to return any search results. Is this possible? Thanks 回答1: Setting facet=true will enable faceting and setting rows=0 will prevent any results being returned. Conveniently the numFound will show you how many results were found. 回答2: I guess the obvious solution would be to search using a wildcard and specify that you want zero results returned. That

ElasticSearch group by multiple fields

大憨熊 提交于 2019-11-28 22:05:27
问题 The only close thing that I've found was: Multiple group-by in Elasticsearch Basically I'm trying to get the ES equivalent of the following MySql query: select gender, age_range, count(distinct profile_id) as count FROM TABLE group by age_range, gender The age and gender by themselves were easy to get: { "query": { "match_all": {} }, "facets": { "ages": { "terms": { "field": "age_range", "size": 20 } }, "gender_by_age": { "terms": { "fields": [ "age_range", "gender" ] } } }, "size": 0 } which

Solr - Getting facet counts without returning search results

ぃ、小莉子 提交于 2019-11-28 21:05:25
I need to return only the facet counts from solr. So I basically want to search over all documents and return the facet counts, but I don't want to return any search results. Is this possible? Thanks nialloc Setting facet=true will enable faceting and setting rows=0 will prevent any results being returned. Conveniently the numFound will show you how many results were found. Ryan I guess the obvious solution would be to search using a wildcard and specify that you want zero results returned. That's my solution so far. So, from what I have understood if I need to get facets count for all

How to get an Elasticsearch aggregation with multiple fields

♀尐吖头ヾ 提交于 2019-11-28 18:35:29
问题 I'm attempting to find related tags to the one currently being viewed. Every document in our index is tagged. Each tag is formed of two parts - an ID and text name: { ... meta: { ... tags: [ { id: 123, name: 'Biscuits' }, { id: 456, name: 'Cakes' }, { id: 789, name: 'Breads' } ] } } To fetch the related tags I am simply querying the documents and getting an aggregate of their tags: { "query": { "bool": { "must": [ { "match": { "item.meta.tags.id": "123" } }, { ... } ] } }, "aggs": { "baked