Here is a usecase of what I'd like to be able to do :
You want to exclude specific items from the index (don't index them) but you don't want to use the data alteration callbacks because :
1) Your items count is never going to be accurate.
2) This is happening sometimes too late.
3) You'd like to avoid loading of unnecessary entities (For the current site I'm working on, an entity load is painful because an entity can be overriden by multiple other entities).
4) Because of the 3, this slows dramatically the indexing time.

Comments

jsacksick’s picture

Status: Active » Needs review
StatusFileSize
new8.4 KB
jsacksick’s picture

I forgot to handle the insert operation...
Here is a new patch.

Status: Needs review » Needs work

The last submitted patch, search_api-allow-developers-to-untrack-items-1762142-2.patch, failed testing.

jsacksick’s picture

Status: Needs work » Needs review
StatusFileSize
new9.47 KB

Better with the correct signature ...

jsacksick’s picture

Forgot that drupal_alter only accepts three arguments, as we don't really need the id, here is a new patch.

jsacksick’s picture

After some testing, the patch was almost ok except on _search_api_index_reindex which was scheduling the items for indexing (Even if you didn't want to track them).

osopolar’s picture

What is the preferred way to exclude an items from indexing? This one (untrack or never track an item ) or how it is done in #1507882: Exclude Unpublished nodes from indexing?

osopolar’s picture

Issue summary: View changes

Update

legolasbo’s picture

Issue summary: View changes
Status: Needs review » 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.