Issue Details (XML | Word | Printable)

Key: CONF-16275
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Tony Atkins [Atlassian]
Votes: 7
Watchers: 5
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Confluence

Appending asterisk to search terms causes problems...

Created: 06/Jul/09 10:09 AM   Updated: Thursday 05:44 AM
Return to search
Component/s: Macros - Livesearch Macro
Affects Version/s: 3.0
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments: 1. File Laura_Hartman.vcf (0.2 kB) 06/Jan/10 01:05 PM - Laura Hartman

Issue Links:
Reference

Participants: Anatoli Kazatchkov [Atlassian], Igor Minar, Joe, Laura Hartman, Maik Vogel and Tony Atkins [Atlassian]
Since last comment: 5 days ago
Internal Complexity: Unknown
Internal Value: 3
Labels:


 Description  « Hide

The {livesearch} macro appends a wildcard character (asterisk) after the search terms entered. This is a problem in a number of cases:

  1. Appending an asterisk to a stemmed word (as in "management") returns far less results than expected:
    http://jira.atlassian.com/browse/CONF-5142
  2. Appending an asterisk to search terms that already end in an asterisk returns zero results
  3. Appending an asterisk to search terms that end in a phrase (as in "fail whale"*) returns an illegal search string error

In my testing, simply removing the asterisk from the beginning of line 182 of src/main/resources/templates/extra/livesearch/livesearch.js resolves this immediately, as in.

livesearchList.liveSearchReq.open(
                       "GET",
                       liveSearchRoot
                               + "/plugins/livesearch/livesearch.action?decorator=none"
                               + "&queryString=" + livesearchform.s.value
                               + "&spaceKey="
                               + livesearchform.spaceKey.value);


Anatoli Kazatchkov [Atlassian] added a comment - 20/Jul/09 01:05 AM

Joe added a comment - 06/Jan/10 12:59 PM

Here is a quick workaround for everyone struggling with the deficiencies of the livesearch macro. On the Confluence Admin screen, add this bit of code to the Custom HTML - At the end of BODY field:

<script type="text/javascript" language="javascript">
var chars = " OR ";
if (typeof document.getElementsByName("livesearchForm")[0] != "undefined") {
document.getElementsByName("livesearchForm")[0].setAttribute("onsubmit","document.getElementsByName(\"s\")[0].value = document.getElementsByName(\"s\")[0].value + chars + document.getElementsByName(\"s\")[0].value");
}
</script>

This will transform all searches from "keyword*" to "keyword OR keyword*" when the search is submitted.
This hack will only affect the first livesearch macro on each page.


Laura Hartman added a comment - 06/Jan/10 01:05 PM

Thanks Joe,

I'll ask our admin to take a look at this and add it, if possible.

Laura


Joe added a comment - 07/Jan/10 03:09 PM

With further testing, I've determined that my javascript does not work in IE6 (I had tested it in IE8 only). I'll let you know if I come up with something that works in more browsers.


Igor Minar added a comment - 07/Jan/10 06:56 PM

This issue was properly fixed in 2.11.1. The jar was however not published on PAS, so you'll have to check out the source code and build the jar on your own.


Maik Vogel added a comment - 04/Feb/10 05:44 AM

Hello,

when do we get a bugfix for this?