Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install openc.excludesearch

How to install openc.excludesearch

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install openc.excludesearch
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.1.1 Available View build log
Windows (64-bit)
0.1.1 Available View build log
Mac OS X (10.5+)
0.1.1 Available View build log
Linux (32-bit)
0.1.1 Available View build log
Linux (64-bit)
0.1.1 Available View build log
 
License
GPL
Lastest release
version 0.1.1 on Jan 5th, 2011

Introduction

openc.excludesearch is designed to make it possible for an administrator to easily mark content as being hidden to searches.

NB: Requires dm's AdvancedQuery from http://www.dieter.handshake.de/pyprojects/zope/#AdvancedQuery

First off, install myself:

>>> self.addProduct("openc.excludesearch")

We set up an object that will show in searches for "foo":

>>> self.folder.invokeFactory('Document', 'foo', 'Foo Page')

System Message: ERROR/3 (<string>, line 18)

Inconsistent literal block quoting.

'foo' >>> self.folder['foo'] <ATDocument at .../foo> >>> self.folder['foo'].setText("I am a foo object from foosville.")

We name it foo for convenience:

>>> foo = self.folder['foo']

We can see its text fine:

>>> foo.getText()

System Message: ERROR/3 (<string>, line 32)

Inconsistent literal block quoting.

'<p>I am a foo object from foosville.</p>' >>> foo.reindexObject()

If we search for it, we find it:

>>> app.plone.restrictedTraverse("queryCatalog")({"SearchableText":"foo"})

System Message: ERROR/3 (<string>, line 39)

Inconsistent literal block quoting.

[<Products.ZCatalog.Catalog.mybrains object at ...>]

Once we activate the hiding functionality we don't:

>>> foo.getField('hidesearch').get(foo)

System Message: ERROR/3 (<string>, line 45)

Inconsistent literal block quoting.

False >>> foo.getField('hidesearch').set(foo, value=True) >>> foo.reindexObject() >>> foo.getField('hidesearch').get(foo) True >>> app.plone.restrictedTraverse("queryCatalog")({"SearchableText":"foo"}) []

This is because it has a new marker interface:

>>> from openc.excludesearch.interfaces import IExcludeFromSearch
>>> IExcludeFromSearch(foo)

System Message: ERROR/3 (<string>, line 58)

Inconsistent literal block quoting.

<ATDocument at .../foo>

If we remove this marker, we find it again:

>>> foo.getField('hidesearch').get(foo)

System Message: ERROR/3 (<string>, line 64)

Inconsistent literal block quoting.

True >>> foo.getField('hidesearch').set(foo, value=False) >>> foo.reindexObject() >>> foo.getField('hidesearch').get(foo) False >>> app.plone.restrictedTraverse("queryCatalog")({"SearchableText":"foo"}) [<Products.ZCatalog.Catalog.mybrains object at ...>]

As we no longer provide that interface:

>>> IExcludeFromSearch(foo)

System Message: ERROR/3 (<string>, line 76)

Inconsistent literal block quoting.

Traceback (most recent call last): ... TypeError: ('Could not adapt', <ATDocument at .../foo>, <InterfaceClass openc.excludesearch.interfaces.IExcludeFromSearch>)

Todo

1) Subclass/monkeypatch collections so they know to ignore things with the IExcludeFromSearch marker interface

Changelog

0.1 - Unreleased
  • Doctest

System Message: WARNING/2 (<string>, line 93)

Bullet list ends without a blank line; unexpected unindent.

[MatthewWilkes]

  • Added an adapter for archetypes.schemaextended to add a boolean field to the

System Message: WARNING/2 (<string>, line 96)

Bullet list ends without a blank line; unexpected unindent.

settings schema of any AT content type that adds/removes the marker interface when used. [MatthewWilkes]

  • Customised the queryCatalog script in a skin layer to drop all results

System Message: WARNING/2 (<string>, line 101)

Bullet list ends without a blank line; unexpected unindent.

providing IExludeFromSearch using AdvancedQuery [MatthewWilkes]

  • Added a marker interface called IExcludeFromSearch

System Message: WARNING/2 (<string>, line 105)

Bullet list ends without a blank line; unexpected unindent.

[MatthewWilkes]

Subscribe to package updates

Last updated Jan 5th, 2011

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.