Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 320669

Summary: [Help][Search] Allow pre/post processesing steps to the Help Search button
Product: [Eclipse Project] Platform Reporter: Chris Austin <ChrisAustin>
Component: User AssistanceAssignee: Chris Austin <ChrisAustin>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: cgold, esirois, zhhaohh
Version: 3.7   
Target Milestone: 3.7 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 326001    
Attachments:
Description Flags
Initial implementation patch
none
Implementation V2.0
none
Implementation V3.0 none

Description Chris Austin CLA 2010-07-22 17:02:02 EDT
The Help Search button should have an associated extension point that allows products to define pre-processing steps.  These steps could allow for term-mapping (EHS -> 'Eclipse Help System?') or adding a spell checker to check the search phrase.
Comment 1 Hao Zhang CLA 2010-09-02 02:10:47 EDT
That's great.

I also think about this. I hope that, search input box should be more like google.
If you input 'app', then maybe 'apple' and 'application' wil be shown in drop-down list, which will be more useful for user to choose proper search phrase.

Your proposal just provides such solution. And I think we should also think about more enhancement of search phrase hinting.
Comment 2 Chris Goldthorpe CLA 2010-10-20 18:44:31 EDT
Do you envisage the preprocessing taking place in a user defined method which takes the search string ( and possibly also locale ) as a parameter and returns another string as the result?
Comment 3 Chris Austin CLA 2010-11-30 17:23:09 EST
Created attachment 184194 [details]
Initial implementation patch

I have created an initial implementation of this, which allows a developer to use the 'org.eclipse.help.searchProcessor' extension point to contribute an AbstractScopeProcessor class.  This class has preSearch() and postSearch() methods which return a String that can be used in the search frame.

Unfortunately, I do not have a good way to duplicate this effort for the help view - I cannot have a preSWTSearch which returns a Composite because then help would depend on the eclipse ui, which is not what we want at all.  So any suggestions on a good solution are welcome.  Perhaps some kind of pseduo markup language that the help view could interpret and turn into a ui?  Might be too large for this bug.
Comment 4 Chris Goldthorpe CLA 2010-12-02 14:16:37 EST
I looked at the attachment briefly - a few comments:

You need @since tags in the API classes. You can turn on API checking in the preference page for Plug-in Development/API Baselines and set the API baseline to Eclipse 3.6. With API checking enabled this is reported as an error.

I don't like the idea that the extension point would work differently in the help Webapp and in the Help View - we should be working to reduce the number of differences between Webapp and Help View, not increase them.

I understand the preSearch() function but not postSearch(). I would think that the most useful thing you could do post search would be to allow the extension point to change the weight of each search result or exclude results completely.
Comment 5 Chris Austin CLA 2010-12-17 13:40:22 EST
(In reply to comment #4)
> I looked at the attachment briefly - a few comments:
> 
> You need @since tags in the API classes. You can turn on API checking in the
> preference page for Plug-in Development/API Baselines and set the API baseline
> to Eclipse 3.6. With API checking enabled this is reported as an error.


Thanks for the feedback Chris.  I will add the tags and turn on API checking.

> I don't like the idea that the extension point would work differently in the
> help Webapp and in the Help View - we should be working to reduce the number of
> differences between Webapp and Help View, not increase them.

I agree - id prefer the extension point be the same, so I am open to suggestions on how to handle this

> I understand the preSearch() function but not postSearch(). I would think that
> the most useful thing you could do post search would be to allow the extension
> point to change the weight of each search result or exclude results completely.

There are a few ideas in Rational that would use postSearch.  For example, one would be to never have an empty result set.  If 0 hits came back to the postSearch method, a link to something else can be put up in its place.  Or, a set of sponsored results of terms that are commonly associated with certain important topics.
Comment 6 Chris Austin CLA 2010-12-17 15:11:43 EST
What if we made swt an optional dependency of org.eclipse.help?  This way, if the help is being run without the ui, the preSWTSearch, postSWTSearch would just not be called.  Thoughts?
Comment 7 Chris Austin CLA 2011-01-10 16:58:56 EST
Created attachment 186441 [details]
Implementation V2.0

I have changed the AbstractSearchProcessor class to now return a SearchProcessorInfo class, which can change the search query or supply alternative search expressions.  The Web UI and Help View can both consume the alternates and display them appropriately, without the need for ui dependencies as I had originally thought.

In this patch, the search processor has the opportunity to modify a search string, provide alternate search expressions, or modify the search result set.
Comment 8 Chris Goldthorpe CLA 2011-01-11 18:47:05 EST
I'm working on building a client based on the initial patch. Here are some things I noticed.

In the schema the class implements org.eclipse.help.AbstractSearchProcessor, this should be extends, not implements.

searchView.jsp has a compilation error.

I was able to test in the help view and it was easy to create a client. The user interface was well designed and user friendly.

I felt like I needed more Javadoc for the methods in AbstractSearchProcessor, particularly for methods like getId() and getParticipantId().

The other question is where the extension point should live - org.eclipse.help or org.eclipse.help.base. Right now we seem to have an approximately equal number of extension points in each of these two bundles. There is a slight preference for putting things in org.eclipse.help.base ( which already has a package org.eclipse.help.search )since some RCPs which do not use the help system still have a dependency on org.eclipse.help but this is not a major issue.
Comment 9 Chris Austin CLA 2011-01-18 12:20:22 EST
(In reply to comment #8)
> In the schema the class implements org.eclipse.help.AbstractSearchProcessor,
> this should be extends, not implements.

Agreed - fixed for next patch.

> searchView.jsp has a compilation error.

I don't see a compilation error in my env - can you elaborate on what you see?

> I felt like I needed more Javadoc for the methods in AbstractSearchProcessor,
> particularly for methods like getId() and getParticipantId().

These fields are in the Lucene hits, and I am not sure what they do or if they are even needed in the results view.  Maybe we should remove them from the ISearchResult interface?

> The other question is where the extension point should live - org.eclipse.help
> or org.eclipse.help.base. Right now we seem to have an approximately equal
> number of extension points in each of these two bundles. There is a slight
> preference for putting things in org.eclipse.help.base ( which already has a
> package org.eclipse.help.search )since some RCPs which do not use the help
> system still have a dependency on org.eclipse.help but this is not a major
> issue.

Slight preference is enough for me to move it to base - thanks for the tip.
Comment 10 Chris Austin CLA 2011-01-19 17:28:01 EST
Created attachment 187159 [details]
Implementation V3.0
Comment 11 Chris Austin CLA 2011-01-19 17:28:48 EST
Comment on attachment 186441 [details]
Implementation V2.0

Fixed compile error, left participant and id alone.
Comment 12 Chris Austin CLA 2011-01-19 17:29:59 EST
Patch committed to HEAD
Comment 13 Chris Austin CLA 2011-04-28 17:31:25 EDT
*** Bug 308579 has been marked as a duplicate of this bug. ***