I think I know the answer to this already but putting the question out there just in case.
I have a number of custom types that contain a boolean field called bArchived. When this field is true the record shouldn’t appear in search results.
Are the following my only two options to stop these records from being indexed?
Create a custom contentToIndex function for every type, that checks that the flag is false
OR
Allow the records to be in the indexed but do “something” with the search form to tell it to filter the results to only records with this field set to false
None of these types use the FC publishing draft/approved workflow.
You might also be able to extend solrProContentType.cfc into your
project, then override the getRecordsToIndex() method (copy from line
~673) and change the query on line 699 to cater for your content types
(check if bArchive prop exists for that content type, then filter by it).
Ideally that query could be moved into its own method in the FCSP plugin,
e.g. defaultContentToIndex(), that way you could override a much smaller
piece of code and it would still work globally – but obviously that would
require the plugin to be changed.
I’m already part way through extending an abstract component but if they doesn’t work that well I’ll certainly try extending solrProContentType…although after typing that out it has me thinking that the second option might be better as it saves stuffing around with the existing content types.
If I stick with the first option - I can’t see that the typename is passed when contentToIndex is called which is a bummer. Thinking I might need to still create a contentToIndex function in each type, set a typename variable and call super.contentToIndex.
Ideally that query could be moved into …
I’ve already got some modifications to the FCSP plugin anyway so some more probably isn’t going to make any difference