Feature Proposal: Make topic summary optionally based on search terms

Or: how to better scan search results for relevancy.

Motivation

When doing a search if is often hard to decide if a found topic is relevant. Deciding would be easier if the topic summary showed the searched terms in context (sentence fragments). This is how Google presents search results.

Specification

  • Add a searchcontext parameter to $summary: $summary(searchcontext)

Implementation

When searchcontext is used:
  • raw summarized text is used (after calling Render::makeTopicSummary)
  • the topic text is scanned for the search terms
    • for each occurrence (following Google convention) 18 words around the text are used. If less than 9 word before the search term are available, the remainder amount of words after the term are used (so when after 6 words the search term is encountered, this will be displayed: 6 words before, term, 12 words after)
  • after each "line" triple dots are displayed
  • a maximum number of n characters will be used, so searching will stop when n characters are stored
  • the resulting text will be parsed for occurrences of the search terms: these will be bolded

-- Contributors: ArthurClemens

Discussion

Good point.

On syntax, the existing tokens can be combined, for example $summary(100, showvarnames, noheader). Expanding on that seems logical, such as $summary(searchcontext), $summary(100, searchcontext), etc.

-- PeterThoeny - 13 Mar 2007

Noone has disagreed here. The originator never reacted to Peters proposed spec.

Who will drive the implementation?

-- KennethLavrsen - 08 Apr 2007

$summary(searchcontext) seems logical to me. I am not sure if I can do it by myself.

-- ArthurClemens - 08 Apr 2007

I amended the spec accordingly. Seems like a go, but we need a driver.

-- PeterThoeny - 09 Apr 2007

Signing up for driver.

-- ArthurClemens - 23 Apr 2007

Excellent, thanks Arthur!

-- PeterThoeny - 24 Apr 2007

I've written the #Implementation text.

-- ArthurClemens - 02 May 2007

Sounds like a very good spec to me.

-- KennethLavrsen - 05 May 2007

Accepted by 14-day rule

-- KennethLavrsen - 07 May 2007

Great!

Question: Is it aware of the number of chars in the summary, e.g. $summary(200, searchcontext)?

-- PeterThoeny - 08 May 2007

I'm very keen to use this. Is it available yet? What do I need to do?

-- TamsinTweddell - 01 Jun 2007

There's been no work on it yet, AFAIK. However a client of mine has come up with a similar request, so I may do some work on it.

-- CrawfordCurrie - 02 Jun 2007

Did not make it before feature freeze. So this should not be checked in before after 4.2.0 is released.

-- KennethLavrsen - 03 Jun 2007

Supported with a monkey patch in SearchSummaryPlugin. Code should be reusable for the core when 4.2 is out.

CC

Thanks Crawford. When we take this into the core I think it is better to add a $summary(searchcontext) switch instead of a SEARCHSUMMARYPLUGIN_CONTEXT preferences variable. The summary already groks $summary(50, showvarnames, noheader).

-- PeterThoeny - 06 Jun 2007

Good point, Peter. I was obviously focused on my clients requirements, so didn't need to support this.

-- CrawfordCurrie - 08 Jun 2007

I look forward to this being supported and would venture that this should be the default.

-- MartinCleaver - 17 Nov 2008

Yes, the plugin is definitely an improvement, so I can recommend to use the code.

-- ArthurClemens - 17 Nov 2008 - 16:57

makeTopicSummary (renamed to summariseText) is now in Meta.pm. Simple solution: use the code from SearchSummaryPlugin and call that when searchcontext is used. Better is to integrate this into makeTopicSummary and do the extra things in that sub.

Implementation task Tasks.Item8627.

-- ArthurClemens - 26 Feb 2010

Implemented. In the end I have rewritten the SearchSummaryPlugin code completely.

-- ArthurClemens - 28 Feb 2010
Topic revision: r6 - 28 Feb 2010, ArthurClemens
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy