Snippets and faceting

Hello,
I am using the built-in GUI and service.
One of my attributes is a sizable portion of text.
If I ask for this attribute to be a facet, then the whole text appears in the facet column.
I dont find how to reduce this to a snippet around the search term!

Thanks
Henri

Hi,

I am not sure I understand what you are trying to achieve, but facets are used to create categories and are not meant to be large portions of text (you can check out this example where categories like ‘bathroom’, or colors are facets).

There is certainly a way to extract meaningful attributes to be used as facets in your data! Would you mind sharing a reproducible example (either screenshots, or even granting access to your account) of what you’re trying to achieve so we can better help you?

Hello,

my records contain Name, Firstname and Note (plus a few others).
I want to be able to search for a string in all three attributes.
Name and Firstname facets are an obvious help.
I want to know how many hits I have in the Note field.
If anything, in a Note facet, I would like to see the list (and count) of Names which have a hit in their Note field.
I will explore some more with tags, but I welcome suggestions.

Thanks
Henri

Hello,

Would you mind sharing your UI with us?
In the meantime, you might want to take a look at our snippeting feature (don’t forget to add the attribute name passed to the attributeName prop to “Attributes to snippet” on the Algolia dashboard. You can also configure it as attributesToSnippet via a set settings call to the Algolia API).

I hope this helps!

You can view my UI at
http://demo.geneweb.tuxfamily.org/gw7/gwd?b=Grimaldi700;w=wizard;lang=fr;pz=rainier+louis+henri+maxence+bertrand;nz=grimaldi;ocz=0;m=H;v=algolia_search

(in the url, change the lang=fr; param to lang=en to switch to english. No other language available yet for this interface, just a question of translation!!).
I would like the Notes facet to be limited to a snippet, possibly centered on the first hit.
(and I have set the attribute to snipper with the dashboard
29

Note also a second question relative to the number of hits associated with each date range. Is this possible?

Thanks
Henri

Hi Henri,

It’s quite simple to have the Notes limited to a snippet, however having the snippet centered around the first hit is much, much more complex, especially since I’m guessing you want to have it centered like so:

… some context highlighted query some other context…

Which is nigh impossible using pure css, but you can have some workaround in js

If you simply want a pure css solution that will truncate the Note afer 3 lines regardless of the position of the highlighted result, here is what you need to add to your css:

label.ais-refinement-list--label {
    max-height: 64px;
    overflow: hidden;
}

label.ais-refinement-list--label em {
  background-color: #ffb;
}

If you really want to experiment with centered ellipsis you can check out these few resources and see if you can piece out anything:

I hope this helps a bit!