Tags:
create new tag
view all tags

SID-02153: Query Search Help

Status: Answered Answered TWiki version: 6.0.1 Perl version: 5.10.1
Category: CategorySearch Server OS: CentOS release 6.5, kernel 2.6.32-431.29.2.e16.x86_64 Last update: 7 years ago

I'm trying to run a query search that searches specific topics and will provide the name of the attachment that was most recently added. I've looked at QuerySearch and FormattedSearch

Search: name~'TestingFormTop*'

undef

Number of topics: 1

I've tried various other format= $query(attachments[3]) <-- this is a direct copy from QuerySearch $query(attachments.name[1]) and various others and cannot seem to get this working.

The output that I get is a comma separated list of all attachment names in the topic.

The long term goal is to be able to provide a link in a search to the most recent attachment in each topic that is hit: [[SID-02153] [https://twiki.org/p/pub/Support/SID-02153/undef]]

I believe I need to change the %s within the format=" " to $percnt however I haven't made it that far yet.

-- Jani Hamalainen - 2016-02-12

Discussion and Answer

The query language can be quite tricky, especially with deep structures. Maybe best to study a working example: See raw text of WebSearchAttachments.

-- Peter Thoeny - 2016-02-14

Thanks for the example Peter. It was helpful. I've added the search below for anyone having the same challenge and have also added it as an example to QuerySearch.

 %SEARCH{ "parent.name = 'Family'" type="query" nonoise="on"
format="| [[%PUBURL%/%WEB%/$topic/$percntCALC{\"$LISTITEM($LISTSIZE($query(attachments.name)), $query(attachments.name))\"}$percnt][$topic]] |" }%

-- Jani Hamalainen - 2016-02-23

      Change status to:
ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
SupportForm
Status Answered
Title Query Search Help
SupportCategory CategorySearch
TWiki version 6.0.1
Server OS CentOS release 6.5, kernel 2.6.32-431.29.2.e16.x86_64
Web server

Perl version 5.10.1
Browser & version

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2016-02-23 - JaniHamalainen
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.