I was hoping for a way to index an items entityqueue membership in our search api solr install. Is there a way to do that? When selecting fields to index I don't see any option to index anything about the enityqueues the entity belongs to. If it could be indexed it some way it would make it very easy to then create faceted search blocks of queues that items belong in which I would imagine would be useful to many people.
Thanks,
Issue fork entityqueue-3004722
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
iknowbryan commentedWould love this as well for D8/9 version!
Comment #3
mlncn commentedSee also #3016821: Sort by Entityqueue
Comment #4
mlncn commentedThis issue fork could really use some initial review from people knowledgeable about Entityqueue and Search API.
It works for my purpose but definitely needs work (in particular needs to deal appropriately with the eventuality that the same entity gets added to more than one entityqueue).
Comment #5
mlncn commentedThis does not trigger an update to the index when an item is added, removed, or re-ordered in an update queue.
Possible code i'm hoping for Search API advice on in https://www.drupal.org/project/search_api/issues/3016821#comment-16054098
Comment #8
martijn snapper commentedIt seems that when removing an entity from the queue, the index is not updated. In the
hook_updateonly the entities of the current list are included in the entity update ofsearch_api.entity_datasource.tracking_manager.If I also include the entities that are removed, the overview updated correctly. I don't know if this is the best way.
Comment #10
asghar commentedHere is patch
Comment #11
asghar commentedHere is the updated patch. It removes the item if it has been removed from the Entity Queue.
Comment #12
asghar commentedThis patch applying fine
Comment #13
megakeegman commentedThe issue I am having, and don't understand how to solve, is that while one item can be in multiple subqueues, that item's entity_queue weight delta value only gets stored in the index for one of those subqueues (and does not specify which one). mlncn mentioned this above in comment #4. Is it possible to fix this?
Here are some queries to demonstrate what I am looking at:
The 8 value in the latter table corresponds to the delta in the first row of the former.
For items only in a single subqueue, this patch is working fine.
Comment #14
megakeegman commentedI think this search api issue is addressing how to do this: https://www.drupal.org/project/search_api/issues/3034182
Comment #15
megakeegman commentedSo if I understand correctly, we need a custom datasource plugin, and we need our search api item_id to include the subqueue entity id. So in my example, instead of
entity:node/6307:und, the item id should (maybe?) look likeentity:subqueue/exhibition_artworks__6299:6307:und. Maybe subqueue_item would be more appropriate. I wonder if we would be able to accomplish this by extending the content entity datasource plugin (defined in search api).In this example, I have assumed a custom datasource plugin
entity:subqueue, and added the subqueue id to the item_idexhibition_artworks__6299. Of course the datasource plugin id could be changed, and the subqueue id does not necessarily have to come first, but I think it makes sense.It may be worth experimenting with https://www.drupal.org/project/search_api_revisions and using the code there for reference, while trying to understand how to implement and use a custom datasource that can index the same node multiple times. FWIW this one does extend the content entity datasource as I mentioned above.
Comment #16
megakeegman commentedI guess the issue with extending the content entity datasource is that entity queue is able to handle configuration entities as well. Any thoughts on the implications here? For simplicity, it might still make sense to start out by extending the content entity datasource. I don't think config and content items can both exist in the same queue anyway.
Comment #17
amateescu commentedThat's correct :) And I think the approach with extending the content entity datasource is great, a followup issue can be opened if someone needs Search API support/integration for config entities.
Comment #18
megakeegman commentedComment #19
megakeegman commentedNo new work yet, just rebasing ^
Comment #20
megakeegman commentedHere is the new patch (same thing, just matching the issue fork)