# Find percentage of facets matched rather than number of matched documents

Hi ,

Is there any way i can find the percentage of facet name matched for a
query rather than the number of documents having that facet.

That is , instead of telling that there are 1000 documents which have a
facet yahoo , i want the result which tells me that there are 60% document
which matches the query and have a facet yahoo. Rest 40% of documents which
have the facet yahoo dont match the query.

Thanks
Vineeth

--

Hi,

you can easily calculate the value from hits.total and count of particular
facet.

Regards,
Lukas

On Tue, Sep 11, 2012 at 10:15 AM, Vineeth Mohan
vineethmohan@algotree.comwrote:

Hi ,

Is there any way i can find the percentage of facet name matched for a
query rather than the number of documents having that facet.

That is , instead of telling that there are 1000 documents which have a
facet yahoo , i want the result which tells me that there are 60% document
which matches the query and have a facet yahoo. Rest 40% of documents which
have the facet yahoo dont match the query.

Thanks
Vineeth

--

--

That is also a useful variable but what i mean was not that.

Lets say there are total of 30 feeds in an index and for the field Country
, there are 10 India , 5 US and 3 UK.

No for the query "growth" , i got 20 hits , out of which for the field
country there are 5 India , 2 US and 1 UK.

What i want is for the facet Country:India , i want the result as India -
50% , US = 40% , UK = 33.3%

Thanks
Vineeth

On Tue, Sep 11, 2012 at 2:02 PM, Lukáš Vlček lukas.vlcek@gmail.com wrote:

Hi,

you can easily calculate the value from hits.total and count of particular
facet.

Regards,
Lukas

On Tue, Sep 11, 2012 at 10:15 AM, Vineeth Mohan <vineethmohan@algotree.com

wrote:

Hi ,

Is there any way i can find the percentage of facet name matched for a
query rather than the number of documents having that facet.

That is , instead of telling that there are 1000 documents which have a
facet yahoo , i want the result which tells me that there are 60% document
which matches the query and have a facet yahoo. Rest 40% of documents which
have the facet yahoo dont match the query.

Thanks

``````      Vineeth
``````

--

--

--

Don't quite understand your math. India 50%? Depending on what you are
after, it should either be 5/20 or 5/8. I can understand your problem
better if you can explain how those percentages are calculated.

In your first example, you have the percentage for Yahoo vs.
everything else. In your second example, you should percentages for
multiple values: India, US, and UK. Which one do you want? First one
is tricky, I would probably use two facets, one with a filter, and the
other one without, and then calculate percentages on the client side.

--

Ivan

On Tue, Sep 11, 2012 at 1:55 AM, Vineeth Mohan
vineethmohan@algotree.com wrote:

That is also a useful variable but what i mean was not that.

Lets say there are total of 30 feeds in an index and for the field Country ,
there are 10 India , 5 US and 3 UK.

No for the query "growth" , i got 20 hits , out of which for the field
country there are 5 India , 2 US and 1 UK.

What i want is for the facet Country:India , i want the result as India -
50% , US = 40% , UK = 33.3%

Thanks
Vineeth

On Tue, Sep 11, 2012 at 2:02 PM, Lukáš Vlček lukas.vlcek@gmail.com wrote:

Hi,

you can easily calculate the value from hits.total and count of particular
facet.

Regards,
Lukas

On Tue, Sep 11, 2012 at 10:15 AM, Vineeth Mohan
vineethmohan@algotree.com wrote:

Hi ,

Is there any way i can find the percentage of facet name matched for a
query rather than the number of documents having that facet.

That is , instead of telling that there are 1000 documents which have a
facet yahoo , i want the result which tells me that there are 60% document
which matches the query and have a facet yahoo. Rest 40% of documents which
have the facet yahoo dont match the query.

Thanks

``````      Vineeth
``````

--

--

--

--

On 9/11/2012 1:55 AM, Vineeth Mohan wrote:

That is also a useful variable but what i mean was not that.

Lets say there are total of 30 feeds in an index and for the field
Country , there are 10 India , 5 US and 3 UK.

No for the query "growth" , i got 20 hits , out of which for the field
country there are 5 India , 2 US and 1 UK.

What i want is for the facet Country:India , i want the result as
India - 50% , US = 40% , UK = 33.3%

Thanks
Vineeth

I also don't see your math, but I think it is
india = 5 new ones (I suppose this means there 15 total both old and
new) which is a growth of 50% over the 10 original.

I'd just to two facets,
1st facet base counts
2nd facet counts growth for period
and do the division yourself.
But I think you could do both in the same search request.

-Paul

--