Item1708: Unexpected behaviour when multiple="on" on a query search

pencil
Priority: Normal
Current State: No Action Required
Released In:
Target Release: n/a
Applies To: Engine
Component:
Branches:
Reported By: IngoKappler
Waiting For:
Last Change By: CrawfordCurrie
 Ingo Kappler wrote:
> Crawford Currie schrieb:
>   
>> Ingo Kappler wrote:
>>     
>>> Well, from that point of view it should work. So is it something for the
>>> task web if the following fails?
>>>
>>> SEARCH{ "WorkStatus='Current' AND text ~ '*- TTTT*' " type="query"
>>> web="%USERSWEB%" nonoise="on" multiple="on" format="$text" }%
>>>   
>>>       
>> Well, you have to ask yourself what you mean :-)
>>
>> The documentation for multiple="on" reads:
>>
>> "Multiple hits per topic. Each hit can be formatted
>> <http://foswiki.org/System/FormattedSearch>. The last token is used in
>> case of a regular expression ";" /and/ search"
>>
>> Now, since a query search specifically matches an entire topic, then
>> there is *no way* to express a query search to return multiple hits on a
>> single topic.
>>
>> There are circumstances in which it would make sense to do so; for example,
>>
>> SEARCH{ "attachments[size>100].name" type="query" multiple="on" }%
>>
>> should arguably return multiple results, one for each attachment that is
>> greater than 100 bytes. However that's not what you asked for, above.
>>     
>
> 1. What I understand from your responses, it is valid to combine a query
> search with multiple="on".
>   
Correct. However it is pointless, as a query will only ever return a single result for a topic.
> 2. It can be expected that on each returned topic the multiple option
> will look for all matching lines and should return them.
>   
No. See above.
> 3. I am trying to ask for any line in the found topics which holds the
> text '- TTTT'.
Then you need a text search. What you have said is "get me topics that contain the text - TTT"
> So I want them all to be shown in the results and yes I
> want the multiple to be on. I am not concerned that maybe the search is
> not 100% correct but that I am getting and internal server error instead
> of an empty page with no found results in case of a syntax issue or
> wrong search definition:
>   
Well, that's news; and a Task needs to be raised to report that.
> "500 Internal Server Error
> The server encountered an internal error or misconfiguration and was
> unable to complete your request."
>
> The following query e.g. works, so I'd expect the above should also do
> the job (even better because of the additional metadata verification):
>
> %SEARCH{ " - TTTT" type="literal" web="%USERSWEB%" nonoise="on"
> multiple="on" format="$text" }%
>
> BTW, when changing the failing search from:
>
> SEARCH{ "WorkStatus='Current' AND text ~ '*- TTTT*' " type="query"
> web="%USERSWEB%" nonoise="on" multiple="on" format="$text" }%
>
> to:
>
> SEARCH{ "WorkStatus='Current' AND text ~ '- TTTT' " type="query"
> web="%USERSWEB%" nonoise="on" multiple="on" format="$text" }%
>
> ...the error will not show up but nothing is found too. So it looks the
> issue is related to the wildcard match at least when using * characters,
> being part of the text search in query mode.
>   
Please include that information in your report.

Regards,

C.

Summary:

No issues with:
%SEARCH{ " - TTTT" type="literal" web="%USERSWEB%" nonoise="on" multiple="on" format="$text" }%

Fails:
%SEARCH{ "WorkStatus='Current' AND text ~ '*- TTTT*' " type="query" web="%USERSWEB%" nonoise="on" multiple="on" format="$text" }%
with:
"500 Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request."

Does not fail but also not provide any result (only * removed):
%SEARCH{ "WorkStatus='Current' AND text ~ '- TTTT' " type="query" web="%USERSWEB%" nonoise="on" multiple="on" format="$text" }%

-- IngoKappler - 10 Jun 2009

I'm unable to reproduce this on Release01x00 or Foswiki 1.0.5, so I'm having to push it back for more information - for example, what is in the server logs? The form? The topics being searched?

-- CrawfordCurrie - 16 Jun 2009

I now retested on 1.0.5 and 1.0.6 and it looks like it now partially works (don't get the error). I used:
%SEARCH{ "WorkStatus='Current' AND text ~ '*- InternalWiki*' " type="query" web="%USERSWEB%" nonoise="on" multiple="on" format="$text" }%

Not sure why the error disappeared but I've updated some plugins in the meantime and restructured several lines inside the topics that are supposed to be found. Anyhow, the multiple="on" doesn't have an affect because the found topics are displayed completely and not just the found lines.

-- IngoKappler - 26 Jun 2009

Partially works? So what is outstanding?

If there are no outstanding problems specific to this report, please close it "No Action Required"

-- CrawfordCurrie - 10 Aug 2009

When looking at
%SEARCH{ "WorkStatus='Current' AND text ~ '*- InternalWiki*' " type="query" web="%USERSWEB%" nonoise="on" multiple="on" format="$text" }%
there is the wildcard search AND text ~ '*- InternalWiki*' combined with multiple="on". Expectation was this should result in displaying only the lines holding - InternalWiki. Instead it displays the whole topic text (including every other line before or after - InternalWiki). This could be justified by the wildcard * but I'd expect it should handle the * in case of multiple on to be limited to the specific line only.

Regards,

-- IngoKappler - 31 Aug 2009

This is a different problem, so I changed the headline accordingly. It was "Wildcards in a text query search in combination with multiple="on" lead to server error".

A query search is not performed line-by-line; '*' is a greedy match specifier that matches across newlines. However in this case that's irrelevant; the requested format is $text, which would return the entire topic text whatever you did.

TBH I don't think multiple ever make sense with a query search. Query searcches don't work line-by-line, and it would be exceptionally difficult to make them do so.

No action.

-- CrawfordCurrie - 20 Sep 2009

ItemTemplate edit

Summary Unexpected behaviour when multiple="on" on a query search
ReportedBy IngoKappler
Codebase 1.0.6, 1.0.5
SVN Range Foswiki-1.0.0, Thu, 08 Jan 2009, build 1878
AppliesTo Engine
Component
Priority Normal
CurrentState No Action Required
WaitingFor
Checkins
TargetRelease n/a
ReleasedIn
Topic revision: r6 - 20 Sep 2009, CrawfordCurrie
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