-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
current_search is getting the wrong search #56
Comments
Can you clarify what you mean by "4 variants of index A"? How is that looking in the UI at admin/config/search/search_api? |
You should know that our content types have one type for Closed projects, and another that is for Open, with help requested and also Inactive. There are a huge number of fields on these content types, it's not practical currently to bring them into a single type. The fields for Closed have more differences than similarities with the other type. |
Thanks. Now please tell me how you are producing those list both in D7 and Backdrop. I assume the list you posted through that snapshot is not a view, since you say:
Are you using a custom module to create that output? |
yes, there is much custom code here. Both in D7 and Backdrop. Those 7 links are all created by custom code, not a view. Part of that process is to calculate the number to show as the count. The actual query that is sent to SOLR is affected by the user's chocies in the facets, and also by custom code in an implementation of hook_search_api_solr_query_alter. |
This seems like a complex problem to solve, and given that this is done with custom code, I'm not sure I can help much. Perhaps if you post the essential parts of your custom code? And also, how did you overcome this limitation in D7? Is search_api_facets substantially different in the D7 environment? From what I understand, the problem probably boils down to this:
So, back to how you are displaying the counts - are you relying on a Facet API token to do that? Without fully understanding the code, I could think of two solutions:
|
yes, I had come to your first suggestion too. It's a lot of work though, that index covers a huge list of fields and facets. |
I have a page that presents a search interface to the user. There are facets, the results are shown, and since our search is split into 7 main types of search, there are 7 links to go to those searches, one of which will be the search you are viewing right now. We have 4 search indexes. So of those 7 links, the first 4 are for differently filtered searches for the 1st index, and the other 3 are for the other three indexes. Imagine I have indexes A, B, C and D. A has four variants, so the links are:
I hope that makes some sense.
What I want to do is to show the counts of results that you would get for each one, e.g.
So to do that I am calling search_api_query().
For each one I pass the search index of course, A,B, C or D, and I pass a unique "search id".
That works fine.
However, the problem is that it affects the counts that I see on the facets shown in that page. E.g. beneath that list of 7 top items, I have the facets, e.g. a list of checkboxes with counts next to each one.
The facet options counts get it wrong when I view one of the first 4 searches, A.1 - A.4. Because they are all for the same search index. The facet options counts shown are the ones calculated for A.4 - the last search for that search index to be done.
Here's an example of the sort of facets we have, with counts showing:
![image](https://private-user-images.githubusercontent.com/1052281/284932202-3a1df94f-ddc1-42c7-a26b-18389341e3c2.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0NjYxNTMsIm5iZiI6MTczOTQ2NTg1MywicGF0aCI6Ii8xMDUyMjgxLzI4NDkzMjIwMi0zYTFkZjk0Zi1kZGMxLTQyYzctYTI2Yi0xODM4OTM0MWUzYzIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTNUMTY1NzMzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YWI3NGE1NzllMjM0YmJjZDJlNjY2YzY0Zjc2NTg5MGU5YTExNTBmZWEyODQ1YmI4ZDVjZTgyNDhkODU4NmQ0YiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.ujt9QMGqHTBPyktmV6vjj7zKAaN72-4YkSvAzmFtWqI)
In this file:
modules/search_api/contrib/search_api_facetapi/plugins/facetapi/adapter.inc
I think this is where the diffculty is. Each time I call search_api_query() I give a unique 'search id' in the $options array, but the top four all use the same search index, so that is the same for them.
The text was updated successfully, but these errors were encountered: