I was actually looking to exclude nodes Unpublished from indexing...Is there a way i can do it
I want to have it like in Apache Solr Search Integration Module where unpublished nodes are not indexed..
Thanks in Advance in helping me out
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 3patchedfiles.zip | 15.03 KB | janakiram |
| #4 | search_api-exlude_unpublished_nodes-1507882-4.patch | 2.44 KB | jsacksick |
| #1 | search_api-exlude_unpublished_nodes-1507882-1.patch | 2.49 KB | jsacksick |
Comments
Comment #1
jsacksick commentedWell you have to create an alter callback. Here is a patch. This doesn't update the index count but doesn't index unpublished nodes.
Speaking of which I think we should create a patch to alter the items count on the index tabs (This should take in account the callbacks).
Comment #2
jsacksick commentedPlus we may need a generic solution to be able to remove items which have a specific property or field value (This could be useful for other Entities). For example you may want to exclude other entities with a unpublished like property... and that shouldn't be so hard to implement
Comment #3
jadwigo commentedA possible workaround:
If you add the node status to the indexed fields you can filter the views with "Indexed node: status" = published.
Facets will also know about the correct number of nodes
The nodes will still be indexed, but they are not visible in your views
Comment #4
jsacksick commentedYes of course you can do that.
I'm uploading a new patch for coding standards correction.
Comment #5
janakiram commentedthanks for taking time and helping me out...
I had tried the patch...but there is no option found in workflow
I have tried both the patches above, run cron several times but it didnot show up
I am attaching the three files where patch is applied
Comment #6
jsacksick commentedDid you clear the cache ?
Comment #7
janakiram commentedthanks, after clearing the cache i was able to see the option,
I can see that the option is working, but in the count "All items have been indexed" the unpublished nodes are still counted
"Items which are removed from the array won't be indexed, but will be marked as clean for future indexing." What i was actually looking was to completely delete the unpublished nodes from the index and not even marking it as clean also. Like in Apache Solr Search Integration Module, where unpublished are not indexed at all.
So that it reflects in the count on status page.
Can u suggest us a way out to get this feature?
Comment #8
acouch commented@janakiram keep in mind that that index count is not reflective of the actual items that are included in the index or the number of items to check for indexing. See: http://drupal.org/node/1184610#comment-4588976
Comment #9
damien_vancouver commentedI am using Search Pages and not Search Views, it is not so easy to filter on Status, so the patch from #4 was needed. It works great, thank you!!
Here the steps I used:
Code looks clean and to standards as well, so I'm setting this to Reviewed & Tested by the Community.
Comment #10
Jason Dean commented#4 working great for me.
Note that I applied it using patch command, and had to manually move the new file callback_node_status.inc into the /includes directory for it to work.
Comment #11
drunken monkeyGreat patch, thanks a lot!
Looks perfect to me, and also seems to work: committed.
@ damien_vancouver: This was actually „fixed“ with the „Node access“ data alteration, which automatically adds node access filters to search queries for search pages, too. But I guess this still has some value, until we can introduce a way to do this on a more generic level. See, e.g., #939430: Integrate Rules conditions to filter indexed entities for an idea.
Comment #12.0
(not verified) commentedjust briefing it more properly
Comment #13
rahul_sankrit commented#4 Thank you worked for me.
We need to use a patch to change the behaviour in the workflow tab of the drupal7 search api:
here is the link for Index unpublished nodes : Index unpublished nodes.
Thanks again.