Hi,

This is a clone of https://www.drupal.org/node/2454865

I am using getlocations fields to get the user to fill his location (and get geocoded data) and now I want to display a facet based on the city which we get from the getlocations fields. Also I want to display the name which we get from getlocations fields as a sub-facet for the corresponding city but I am unable to do it.

When I enable a facet for it, I get a lot of unnecessary key words. (Like, all my titles also appear in this list)

Could someone help me out with getting this work ?

Image : https://www.drupal.org/files/issues/get.png ... as you can see, other than the city, lots of other keywords appear in the facet !

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drunken monkey’s picture

Project: Search API » Search API Database Search
Status: Active » Needs review
FileSize
2.39 KB
1.32 KB

Thanks for reporting this problem!
After a quick look at the code it seems we have an error in our facetting code for fulltext fields, which means that facets on a fulltext field will combine the values of all those fields. (At least if I'm right in assuming you're using the "Database" service class for your server?)
Please test whether the attached patch (with no --test_only suffix) solves your problem!

The last submitted patch, 1: 2469547-1--fix_fulltext_field_facets.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 1: 2469547-1--fix_fulltext_field_facets--tests_only.patch, failed testing.

drunken monkey’s picture

drunken monkey’s picture

OK, the test is apparently not doing a very good job, and I see that we already have a solution (used in all other cases) for testing the returned facets. So, revised version attached.

drunken monkey’s picture

Component: User interface » Code
drunken monkey’s picture

Title: Problem with getlocations » Fix facets on fulltext fields

Status: Needs review » Needs work

The last submitted patch, 5: 2469547-5--fix_fulltext_field_facets--tests_only.patch, failed testing.

drunken monkey’s picture

Project: Search API Database Search » Search API
Version: 7.x-1.x-dev » 8.x-1.x-dev
Component: Code » Database backend
Status: Needs work » Patch (to be ported)
Issue tags: +Novice

Committed.
It seems the bug is there in D8, too, so moving the issue accordingly.

dragos-dumi’s picture

Ported the test for branch 8.x-1.x
Added patch only with the test - should fail and a complete patch

drunken monkey’s picture

Looks great, thanks for the help!
Committed. (Only removed the two new blank lines.)

drunken monkey’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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