search for subscribers breaks on certian phrases

Bug #633597 reported by Mr. Jolly
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Singing & Dancing
New
Undecided
Unassigned

Bug Description

The catalog throws an exception if certian phrases are used in the search for subscribers such as 'a' and 'it' plus other common words that are deemed to common to catalog. Obviously search for a would be common looking for all those people starting with a. 'it' maybe searching for italian sites. A quick fix would be to catch the errror and then append a '*' to the query eg.

line 262 in collective.dancing.browser.channel.py to something like:

        try:
            subscriptions = self.context.subscriptions.query(**query)
        except:
            query['fulltext'] = query['fulltext'] + '*'
            subscriptions = self.context.subscriptions.query(**query)

This will however pull in anything with an 'a' in it, so further coding would be needed maybe something as simple as organising the search results in alphabetical order something like...

        emails = [i.composer_data['email'] for i in subscriptions]
        emails.sort()

        for email in emails:
            for i in subscriptions:
                if i.composer_data['email'] == email:
                    subscription = i
                    if subscription.metadata['format'] == self.format:
                        items.append((str(subscription.secret), subscription))
        return items

its a bit of a fudge but any other solutions?

Revision history for this message
Mr. Jolly (simon-electrosoup) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.