Hi All,

Thank for this great module that can help to build such a facet search engine. I follow this article http://envisioninteractive.com/drupal/drupal-7-views-with-faceted-filter... from Mark Sims that I can build facet style search engine.

In that article Mark create an index of type "node" while I did it using type "file", I then have an issue that can't figure out how to fix it.

Each link under each facet filter having a count. This number is somehow include files that are not used. I mean if the file is uploaded using a content type and then when the node is deleted, the file still there and index. Or user just upload the file using the edit form but not saving it, that file is also index.

Is there a way to exclude these
Thanks

Comments

drunken monkey’s picture

Title: Index files that are not use » Only show files that are in use for search on "File" index
Category: Bug report » Support request

Hm, no, there doesn't seem to be an easy way (= a way not involving coding) to do this. Probably the best option would be to have unused files deleted somehow (unless there is a reason not to).
The way to fix this with Search API would probably be to use a data alteration to add an additional field for indexing containing the "is in use" state of the file, to index that and use it for filtering in the search. Or to just throw out all unused files during indexing. In both cases, you would have to take care to call search_api_track_item_change() when that state changes (i.e., when a node (or something else) references the file, or ceases to do so).

Hope that helps, sorry it's not easily possible (as far as I can see).

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.