community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1852849 - /comdev/helpwanted.apache.org/site/tasks.lua
Date Sun, 03 Feb 2019 20:25:14 GMT
Author: sebb
Date: Sun Feb  3 20:25:14 2019
New Revision: 1852849

URL: http://svn.apache.org/viewvc?rev=1852849&view=rev
Log:
COMDEV-304 - short code links don't work
Temporary work-round

Modified:
    comdev/helpwanted.apache.org/site/tasks.lua

Modified: comdev/helpwanted.apache.org/site/tasks.lua
URL: http://svn.apache.org/viewvc/comdev/helpwanted.apache.org/site/tasks.lua?rev=1852849&r1=1852848&r2=1852849&view=diff
==============================================================================
--- comdev/helpwanted.apache.org/site/tasks.lua (original)
+++ comdev/helpwanted.apache.org/site/tasks.lua Sun Feb  3 20:25:14 2019
@@ -38,9 +38,26 @@ function handle(r)
     if get.id then
         local doc = nil
         if #get.id == 8 and get.id:match("^([a-f0-9]+)$") then
-            docs = elastic.find('_id:' .. get.id .. "*", 1, 'item', 'created')
-            if docs and #docs == 1 then
-                doc = docs[1]
+--        Cannot use wild-card matching on _id field
+--            docs = elastic.find('_id:' .. get.id .. "*", 1, 'item', 'created')
+--            if docs and #docs == 1 then
+--                doc = docs[1]
+--            end
+            local json
+--          Find all the ids
+            json = elastic.raw {
+                _source = false,
+                size = 250
+            }
+            if json and json.hits and json.hits.hits then
+                for k, v in pairs(json.hits.hits) do
+--                  Find the first matching id
+--                  Should check for multiple matches, but the original code does not either
...
+                    if string.sub(v._id,1,8) == get.id then
+                        doc = elastic.get('item', v._id)
+                        break
+                    end
+                end
             end
         else 
             doc = elastic.get('item', get.id)



Mime
View raw message