Oh, pardon me: "contextual filters" …
Anyways, just had a look (I normally don't use this) and the options form looks really nasty. Should be revised to only contain those options (and maybe some additional ones) that make sense.

CommentFileSizeAuthor
#18 search_api_term_depth.png34.51 KBmaico de jong

Comments

drunken monkey’s picture

Reminder: When doing this, maybe include #1141488: Allow multiple values for contextual filters.

Shadlington’s picture

There are many argument handlers missing too.
I'm not sure if this is something that will be handled by other changes you're making on the views side of things so I thought I would mention it. I'll also happily raise a separate issue if you wish.

Personally the ones I would most like to have are the missing term arguments (I was hoping to use them to replace my term pages with Search API). They are:

"Content: Has taxonomy term ID
Display content if it has the selected taxonomy terms.

Content: Has taxonomy term ID (with depth)
Display content if it has the selected taxonomy terms, or children of the selected terms. Due to additional complexity, this has fewer options than the versions without depth.

Content: Has taxonomy term ID depth modifier
Allows the "depth" for Taxonomy: Term ID (with depth) to be modified via an additional contextual filter value."

EDIT: Actually, after giving it more thought I don't think I should be trying to use terms arguments for this purpose. Still, I think the point still stands.

drunken monkey’s picture

So this allows you to filter on a taxonomy term that may be in any field on the entity? And the version with depth also searches the parents or, equivalently, also matches on children of the given term?
I guess this wouldn't be too hard to implement.

Still, in principle, I'll only add those handlers that are needed, as I can't just add all of them (or all that can possibly be added) without months of work. Views is a humongous thing that has grown over years, I can't really mirror all DB functionality there for the Search API.

Shadlington’s picture

Oh yes I realise that. There are loads of them - I just wanted to see where you stood on adding missing ones as you've said you don't really use them yourself.

You've pretty much got it right on how those arguments are used. You can set a depth (can be positive, 0 or negative for children, just the term or parents, respectively) or pass it a depth via the depth modifier argument.
That said, the depth modifier is probably less widely used as the static setting on the term with depth argument is normally all that is required.

zambrey’s picture

Hi, filtering by taxonomy (with depth) would be a nice feature.

I'm just wondering if this could somehow be done by defining relationships in views.
Then automatically we have all fields defined by node and can do additional filtering on them.

I'm not familiar with all internal views stuff so just shooting.

drunken monkey’s picture

No, I don't think it's possible this way, as the internal query is of an entirely different sort. But maybe #1172970: provide a unified way to retrieve result entities will help there.

dmiric’s picture

Yeah I also had the same idea to use search api and solr for showing taxonomy pages. Managed to do everything so far and now I got to the same problem no depth support.

Does anyone have an idea how to do this ? Even if it would be a messy solution just to get it working for now.

How about if I would use multiple selection and then select both parent and child. Would that work with the way solr is made now?

drunken monkey’s picture

I'm probably gonna create a data alteration which would add all parent terms of a taxonomy term to the index soon (cf. #1213698: Add a data alteration for indexing complete hierarchies). Then, you could just use a normal contextual filter on this new field to accomplish this.
I could also add an optional depth restriction there – only the third contextual filter, "Has taxonomy term ID depth modifier", wouldn't be possible to do this way.

dmiric’s picture

That would solve my use case.

Ty.

blackice2999’s picture

Hi,

any news on this ?

best regards

andrewbelcher’s picture

Would also be good to include #1407844: Allow exclude for contextual filters when working on the argument handlers.

bigsyke’s picture

I am also stuck here, and need some sort of depth modifier.

kayelle’s picture

Also looking for this. Thanks!

marcoka’s picture

i am not sure if it helps until this is done but what i did is add an aggregated field and add all vocabulary ids, then i used that field as contextual filter for taxonomy. result is that every single taxonomy link triggers a "search api page/result"

chirhotec’s picture

Any progress on this?

I could really use the "Content: Has taxonomy term ID" contextual filter to override my taxonomy pages to be search results table

orakili’s picture

For a "Content: Has taxonomy term ID"-like contextual filter, please have a look at #1696434: Search API views argument handler for all indexed taxonomy term fields..

bigsyke’s picture

Aside from taxonomy, a way to hook into the location:proximity filter argument is highly needed. The actual Search API location module looks dead, and the Location argument would allow our websites to keep up with the big boys.

maico de jong’s picture

StatusFileSize
new34.51 KB

I managed to set up my taxonomy pages using search api & taxonomy term id with depth:

  • Create a search index including the needed taxonomy field to use as an argument
  • Set up the search index view with path taxonomy/term/*
  • Use taxonomy_display module to let the vocabulary use the created view
  • Add the argument Indexed Node: [indexed vocabulary name]

In the argument, specify the following php validation criteria:

$children = array_keys(taxonomy_get_children($handler->argument));
if(!empty($children)) $handler->argument .= '+' . implode('+', $children);

return TRUE;

Don't forget to check 'allow multiple values'!

harryascent’s picture

Thank MDJ Webdiensten, its worked for me.

drunken monkey’s picture

Category: bug » support
Status: Active » Fixed

OK, then it seems this is fixed?
Also check out the tutorial in the handbook – and please add your own findings there!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Enemy’s picture

Issue summary: View changes

#18 worked for me
And what about the redefinition of the title?