Forums / General / Exclude objects from indexing

Exclude objects from indexing

Author Message

Andrew Kelly

Tuesday 26 June 2007 2:27:13 am

Hello all,

Occasionally I'd like to exclude objects from being indexed so that they can not and will not be part of any search results. Is this at all possible and if so, how?
Also, how can I remove object from currently existing indexes?

Andy

André R.

Tuesday 26 June 2007 2:44:53 am

One way would be to create a new class where all attributes are marked as not indexed, and then use the 'change class' extension to convert the existing once.

You might have to republish the objects you convert.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Andrew Kelly

Tuesday 26 June 2007 3:00:41 am

Hi André,

thanks for such a quick reply.

Unfortunately, this isn't a viable alternative. The class is well defined and heavily used, and changing things would create a lot of unnecessary work.
An analogy as an example of what I need would be this:
"Folder objects" are used heavily throughout the site, and the title and description should always be indexed and findable through searches. However, 3 such folders are completely meaningless (and in fact stupid) when they show up in a search and should be removed from search results.
That's not exactly the case here, but the analogy is completely analog.
Just blocking those item through the search template seems a fine idea, until they are part of return set large enough to require pagination, which then messes everything up.
The cleanest solution for me is to treat the items as non-existent in the context of a search.

Unless and until I'm informed of a better aproach, I think what I'm going to do is turn on delayed indexing, and then hack the reindexing script to skip items based on certain criteria.

So, I'm still open for a better solution on how NOT to index a normally indexable object, as well as a solution for removing individual objects which have already been indexed.

Andy

André R.

Tuesday 26 June 2007 3:07:00 am

Well thats not a hack if you create a copy of the 'delayed index script', and do what you want.
If you want to do it cleaner you can add a check box attribute on the class called something like 'Do not add to search engine'. And then look for that one in the indexing script.

EDIT: This is of course if you want your editors to control this, so you don't have to be bothered with it again..

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Andrew Kelly

Tuesday 26 June 2007 3:26:39 am

Yes,
I've been thinking about the checkbox approach, but I think this will happen far too infrequently to worry about.

So, is there a scripted way to remove already indexed objects, or am I going to need to modify the DB directly?

(and thanks again for your assistance in all this)
Andy

Andrew Kelly

Wednesday 27 June 2007 3:36:39 am

Forgive the self follow-up,

I just wanted to present a resolution in case anybody else ever has the same issue come up.

I was able to handle everything within cronjobs/indexcontent.php

To stop an object from being added to the search index, I wrapped the two lines:

eZSearch::removeObject( $object );
eZSearch::addObject( $object );

in a conditional statement, and didn't execute them if certain criteria were met. Basically I grabbed the datamap of the object, and checked the value of an attribute.

To remove already indexed objects, I cheated a little bit. I commented out the line:

eZSearch::addObject( $object );

and made sure that the only entries in ezpending_actions were for the object IDs of what needed to be removed.

Andy

dexen deVries

Wednesday 27 June 2007 3:56:23 am

IIRC, search results include only objects to which you have Read permission. Not sure, but ~90%. Thus, if you restrict access to some objects, you should be safe there.

André R.

Wednesday 27 June 2007 7:16:30 am

I think he still wanted them to be accessible, just not indexable.

But this could also be solved by using the limitation pram on search. Basically searching with a user with less rights then anonymous, for instance not rights to read content in 'Not indexable' section. But the limitation param is not well documented, so your a bit on your own there..

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

eZ debug

Timing: Jan 19 2025 15:24:39
Script start
Timing: Jan 19 2025 15:24:39
Module start 'content'
Timing: Jan 19 2025 15:24:40
Module end 'content'
Timing: Jan 19 2025 15:24:40
Script end

Main resources:

Total runtime0.6664 sec
Peak memory usage4,096.0000 KB
Database Queries211

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0055 588.9453180.8438
Module start 'content' 0.00550.5686 769.7891658.7500
Module end 'content' 0.57410.0922 1,428.5391345.0703
Script end 0.6664  1,773.6094 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00360.5332210.0002
Check MTime0.00150.2182210.0001
Mysql Total
Database connection0.00080.126210.0008
Mysqli_queries0.591888.79992110.0028
Looping result0.00140.21132090.0000
Template Total0.646397.020.3232
Template load0.00210.313320.0010
Template processing0.644396.671320.3221
Template load and register function0.00010.013710.0001
states
state_id_array0.00060.095610.0006
state_identifier_array0.00060.086020.0003
Override
Cache load0.00190.2911560.0000
Sytem overhead
Fetch class attribute can translate value0.00090.129640.0002
Fetch class attribute name0.00080.1193110.0001
XML
Image XML parsing0.00320.477240.0008
class_abstraction
Instantiating content class attribute0.00000.0040160.0000
General
dbfile0.00490.7326400.0001
String conversion0.00000.000930.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
8content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
8content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
13content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 38
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs