⌈⌋ ⎇ branch:  freshcode


Check-in [a2cad88cbe]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Compare search term also against plain project `name`.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a2cad88cbe7c3fcd381828198f6b5066dc3ec73d
User & Date: mario 2014-12-19 22:46:45
Context
2014-12-23
05:06
Text: clear up that CC-BY-SA only covers the project description/text, not the project itself check-in: fa55b2f072 user: mario tags: trunk
2014-12-19
22:46
Compare search term also against plain project `name`. check-in: a2cad88cbe user: mario tags: trunk
2014-12-07
21:21
UI-tag as 0.7.7 check-in: 9a076b186e user: mario tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to page_search.php.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
/**
 * type: page
 * title: Search function
 * description: Scans packages for description, tags, license, user names
 * license: AGPL
 * version 0.2
 * 
 * Builds a search query from multiple input params:
 *   → ?user=
 *   → ?tags[]= or ?tag=
 *   → ?trove[]= for ANDed tags
 *   → ?license=
 *   → ?q= for actual text search






|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
/**
 * type: page
 * title: Search function
 * description: Scans packages for description, tags, license, user names
 * license: AGPL
 * version 0.2.2
 * 
 * Builds a search query from multiple input params:
 *   → ?user=
 *   → ?tags[]= or ?tag=
 *   → ?trove[]= for ANDed tags
 *   → ?license=
 *   → ?q= for actual text search
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

65
66
67
68
69
70
71
               version, image, homepage, download, submitter, submitter_image,
               release.tags AS tags, scope, changes,
               license, state, t_published, flag, hidden, deleted, MAX(t_changed)
          FROM release
         WHERE NOT deleted AND flag < 5
      GROUP BY release.name
        HAVING 1=1
               :*  :*  :*  :*  :*  :*
      ORDER BY t_published DESC, t_changed DESC
         LIMIT 100 ",
            // expr :* placeholders only interpolate when inner array contains params
            [" AND description LIKE ? ",  $search],
            [" AND submitter LIKE ? ", $user],
            [" AND license IN (??) ",   $license],
            [" AND name IN (SELECT name FROM tags WHERE tag IN (??)) ", $tags],
            [" AND name IN (SELECT name FROM tags WHERE tag IN (??)
               GROUP BY name HAVING COUNT(tag) = 1*?) ", $trove],
            // project name == tags

            [" OR name IN (??)", $tags]
    );



    // Show sidebar + long project description
    foreach ($result as $entry) {







|










>







47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
               version, image, homepage, download, submitter, submitter_image,
               release.tags AS tags, scope, changes,
               license, state, t_published, flag, hidden, deleted, MAX(t_changed)
          FROM release
         WHERE NOT deleted AND flag < 5
      GROUP BY release.name
        HAVING 1=1
               :* :*  :*  :*  :*  :*  :*
      ORDER BY t_published DESC, t_changed DESC
         LIMIT 100 ",
            // expr :* placeholders only interpolate when inner array contains params
            [" AND description LIKE ? ",  $search],
            [" AND submitter LIKE ? ", $user],
            [" AND license IN (??) ",   $license],
            [" AND name IN (SELECT name FROM tags WHERE tag IN (??)) ", $tags],
            [" AND name IN (SELECT name FROM tags WHERE tag IN (??)
               GROUP BY name HAVING COUNT(tag) = 1*?) ", $trove],
            // project name == tags
            [" OR name LIKE ? ",  $search],
            [" OR name IN (??)", $tags]
    );



    // Show sidebar + long project description
    foreach ($result as $entry) {