Hello

Im trying to facet by taxonomy fields but i see just the id, not the name of the term, why?

Im getting this:

3 (76)
4 (35)
176 (7)
167 (6)
177 (5)
168 (4)
5 (2)
163 (1)
7 (1)

and it show be

Casa (76)
Depto (35)
Duplex (7)
...

Any ideas?

CommentFileSizeAuthor
#24 Screen Shot 2016-06-06 at 3.24.56 PM.png164.06 KBlilbebel

Comments

nick_vh’s picture

Are you sure you have achieved this by using Facet api 6.x-3.x and apachesolr 6.x-3.x? If so you would probably want to help in the facetapi backport. I'm sure there is still lots of work to do there :-)

nick_vh’s picture

Status: Active » Postponed (maintainer needs more info)
nick_vh’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)
alanom’s picture

Project: Apache Solr Search » Facet API
Version: 6.x-3.x-dev » 7.x-1.1
Status: Closed (works as designed) » Active

I'm seeing this issue with Facet API 7.x-1.1, Search API, and Search API Solr 7.x-1.0-rc2. Seems like an issue between Facets, taxonomy and Solr back end rather than either Apache Solr or Search API Solr modules (unless they both have an identical rarely spotted bug...).

Other potentially relevant notes: I'm using Taxonomy Edge (rebuilding edges made no difference), and the vocabulary in question has a hierarchy 4 steps deep. The terms have some custom text fields but that shouldn't affect anything. Also, I suspect like the original poster, my vocab has a number of terms in the low to mid hundreds.

It's also worth saying - the exact current config was working fine (showing term names). Then I emptied the taxonomy, added fields (text fields) and re-inputted it all. Now it's doing this.

Any ideas about what could cause this, where to look, etc? I'm out of leads and ideas.

Thanks

cpliakas’s picture

Project: Facet API » Search API
Component: Code » Facets

Hi alanomaly.

The Facet API module only provides the interface for mapping, and that works. I would see what "map callback" defined in the hook_facetapi_facet_info() implementation the backend is using and go from there.

Thanks,
Chris

alanom’s picture

Priority: Major » Normal
Status: Active » Postponed (maintainer needs more info)

It looks like in my case, this was caused by entries for terms that were deleted not being removed from the indexing. Needs some further investigation to figure out why that didn't happen and if this is indeed the cause.

Edit: Related issue: #1627312: Deleting taxonomy terms doesn't update entities with term reference fields (issue closed as duplicate of Core bug that looks unlikely to be fixed for months at least).

Chaz Cheadle’s picture

I just ran into a similar issue as well, with the Facetapi 7.x and apachesolr.
I had one term reference field being indexed and showing properly in a facet:
- term-name (count)
But when I added a new term reference field to the node type, it came out as:
- term-tid (count).
I looked and found the working reference used 'select box' as its widget type and the new non working facet was a checkbox widget. I deleted and recreated the term reference field as a 'select box' and now it shows up with the term name in the facets.

Hope this helps.
chaz

mindbat’s picture

I'm seeing this issue as well. In my case, only one facet is displaying as term ids instead of term names. The others work fine.

As far as I can tell, the widget type for the field doesn't make a difference. One of the working facets is set to use the checkbox widget for its field type on the nodes it's attached to.

UPDATE: turns out it was a mis-match between the solr index and the db (solr index was being generated by live site, db was local and out of sync).

mudasirweb’s picture

Issue summary: View changes

Hi,
Has anyone found solution to this issue, i am facing the same issue in Facet Api 7.x, 1.5., Before it was alright, I tried to delete some of the terms from my taxonomy and added few new terms to it, when I checked the page its showing term id's in place of term name. Please comment if anyone has solved it.

drunken monkey’s picture

Status: Postponed (maintainer needs more info) » Active

Is it showing TIDs only for some or for all term facet links? Did you already re-index the content? Clear the cache?

scuba_fly’s picture

Got this same issue as well.

Term Id's show up in the facets after I enable the facetapi_i18n module.

drunken monkey’s picture

Term Id's show up in the facets after I enable the facetapi_i18n module.

Good to know, thanks for reporting!
Does anyone else having this issue also use that module? Then it may be a problem with that module – maybe it's not designed to work with Search API, or wasn't tested with taxonomy term references.

tommann’s picture

Maybe this is a twist on the same issues or should be reported as new, let me know. Without any updates the site began to display two extra term that are not in the taxonomy, and it displays them by id and not any term name. I have cleared caches, reindexed and it still persists. Any thoughts?

SEARCH TOPICS
30 (new unwanted terms!)
64 (new unwanted terms!)

Development
Equality of Women and Men
Human Rights
Religion in Society
Reports filter . . .

https://www.bic.org/documents-and-news

brockfanning’s picture

@tommann, I'm having the same issue. It may be a different cause then what this thread is about - my hunch is that it happens when terms are deleted. So far our fix has been to select the facet, and re-save all the content in the results, and then re-index. I'm still trying to track down a better solution though.

tommann’s picture

I had the exact same resolution, although I grabbed the rows from the database with orphaned taxonomy terms so I could get every node that was causing the issue. I had to resave 200+ node which is no optimal way to go. It seem like it should only use those terms still in effect.

drunken monkey’s picture

It seems to me this is rather a problem in the underlying data – if a taxonomy term is deleted, it should be removed from all nodes that use it, otherwise your database becomes corrupt. Applying a workaround at the level of the Search API would just cover up one symptom of the problem, but it might cause others, too.

taz382’s picture

I am having the same issue.

Blowing my little mind.

brockfanning’s picture

We are using the solution of keeping Field Reference Delete enabled. This helps avoid the problem. As a one-time cleanup of the existing orphaned field data, we also ran the drush command provided by the Taxonomy Orphanage module (just enabling it long enough to run the drush command, and then disabling it).

pyxio’s picture

I have the same problem but it is specifically associated with aggregated fields. The same term fields appear normally in the facet without being part of an aggregated field. However, aggregated fields are displaying the term ID instead of name. I have played around with as many settings as I can think of, but doesn't seem to work. any ideas would be appreciated. thanks!

drunken monkey’s picture

Version: 7.x-1.1 » 7.x-1.x-dev

I have the same problem but it is specifically associated with aggregated fields. The same term fields appear normally in the facet without being part of an aggregated field. However, aggregated fields are displaying the term ID instead of name. I have played around with as many settings as I can think of, but doesn't seem to work. any ideas would be appreciated. thanks!

That's to be expected, as there's nothing in the metadata of an aggregated field to suggest to the facetting code that data in that field should be interpreted as taxonomy term IDs. That's only the case for the term reference fields themselves.
Suggested solutions:
1) If term names are unlikely to change, include the term names instead of the IDs in the aggregated field.
2) Or, if adding custom code is not a problem and the aggregated field will only contain term IDs, use a data alteration to change the type of the aggregated field property to taxonomy_term.
3) Finally, you could also alter the facet information and add your own mapping and/or hierarchy callback for that facet.

lilbebel’s picture

Hello,

Could you please provide steps for solution number 1? My terms aren't going to change. I don't understand what "include the term names instead of the IDs in the aggregated field." means. Could you please explain how to do that?

Many thanks.

m

brockfanning’s picture

@lilbebel: When you're in the "Fields" tab of your search_api index, there is a drop-down at the bottom where you can add additional fields related to the taxonomy vocabulary. After making a selection there and submitting, there will be new fields available in that same tab - one of which should be something like "My Vocabulary >> Name" (for example). Once you've checked that and saved, it (the taxonomy term name) should be available in the configuration for the aggregated field back over in the "Filters" tab.

lilbebel’s picture

Thanks a million brockfanning. Much appreciated. However, I cannot see a:

drop-down at the bottom where you can add additional fields related to the taxonomy vocabulary

I am in /admin/config/search/search-api/index/default_index/fields (please see screenshot attached), and Country, City, Province/ state and Certification are the taxonomy fields I am using with facets. There is no drop down menu other than the 'Type' option. Am I missing something really obvious? Sorry.

Thanks.

M

lilbebel’s picture

StatusFileSize
new164.06 KB
brockfanning’s picture

Ah, sorry, my description was assuming Drupal 7. I don't have experience using this module in Drupal 8 yet, unfortunately.

lilbebel’s picture

No worries brockfanning. Thanks all the same.

M

lilbebel’s picture

Should I create a new issue for Drupal 8? It seems that this thread is for Drupal 7 and doesn't necessarily apply to Drupal 8. I also don't want to double post and I'm not sure what the protocol here would be. Any advice?

brockfanning’s picture

I gave it a quick try at simplytest.me, and it seems to work. At the top of the "Fields" tab you should see a link like:

(+) Content

You can click the (+) to drill down, and you keep drilling down into your taxonomy term field, and eventually click "Add" next to "Name".

lilbebel’s picture

Thank you brockfanning, I'll have a look at that as you suggested.

M

lilbebel’s picture

Hello brockfanning. That is what I already did to add my taxonomy terms. It doesn't allow one to choose the term name instead of the ID. It simply allows me to add the term. I followed this video:

http://drupalsun.com/node/51897

There is no way that I can see to make the term name show instead of the id. I initially did click + content and drilled down and selected my taxonomy but they show as integers. Still no way to make them text instead of numbers.

Thanks.

M

brockfanning’s picture

Did you try clicking the (+) next to the name of your vocabulary to continue drilling down?

lilbebel’s picture

StatusFileSize
new110.52 KB
new16.21 KB

Hello,

Once I have selected my taxonomy vocabularies using +, there is no further drill down option. Please see screen shot. When I do this, the facets only show the term IDs. There is only a dropdown option under 'Type' to change to 'full text' for example. When I try that, the facets don't show at all.

Thanks.

M

brockfanning’s picture

How about a screenshot of the point where you are clicking "Add" when you're on the "Fields" tab?

lilbebel’s picture

Good suggestion. Will do. I'm going to do a complete breakdown of the steps I take. I will post at some point today or tomorrow hopefully. Thank you for your patience. Sorry if I'm being silly and missing something really obvious. Growing pains. Always an adjustment when learning a newer version. Sometimes, it's right under your nose but you miss it.

M

drunken monkey’s picture

When adding the field, just expand the field instead of indxing it directly (i.e., click on the "+" next to the field) and then add the term name to the index, not its ID. Then you can include that field (the term name) in the aggregated field as well.

lilbebel’s picture

Thank you drunken monkey. I didn't get a chance to work on it yesterday but it's on my list of priorities. I will report back.

m

salaikrishnan’s picture

Hi

I do have similar kind of issue, I am using search_api_solr and exposed Taxonomy term fields as facet blocks. I do have a requirement of deleting the taxonomy terms. Currently after deleting taxonomy terms I see only term ids as facets until I do reindex and cache clear. Do we have any best option to hide the term ids until the reindexing is been done. Since my is commerce driven and will have lot merchandising so we wanted to avoid reindexing.

-Santa

brockfanning’s picture

@salaikrishnan Have you tried the Field Reference Delete module? We started using that a while back, and I haven't seen the problem since.

legolasbo’s picture

Status: Active » Closed (outdated)

This issue has not seen activity in over 2,5 years. I am therefore closing this issue to clean up the issue queue. Feel free to re-open and update this issue if you feel this issue is still relevant and of importance.