Hello --
An approach that uses db:create and file:descendant doesn't seem to work; the file paths have all been truncated to the name part of the path in the document-uri property of the individual documents in the DB.
I'm using 9.6.4 with Oracle Java 1.8.0_211 on a Windows 10 machine. (I have no control over any of the environment.)
Is there a way to keep the full path (relative or absolute) in the document uri property? I'm trying to inspect files with identical names in different directories, so I need the directory name to tell the files apart.
Thanks! Graydon
Hi Graydon,
It’s sufficient to supply the directory path as second argument:
db:create('db', '/path')
If you want to filter the input paths before passing them on to db:create, you can supply the paths as both inputs and database paths:
let $files := file:descendants('/path') [file:is-file(.)] [contains(file:read-text(.), 'abalaba')] return db:create('db', $files, $files)
Best, Christian
On Wed, Mar 30, 2022 at 8:52 PM Graydon Saunders graydonish@gmail.com wrote:
Hello --
An approach that uses db:create and file:descendant doesn't seem to work; the file paths have all been truncated to the name part of the path in the document-uri property of the individual documents in the DB.
I'm using 9.6.4 with Oracle Java 1.8.0_211 on a Windows 10 machine. (I have no control over any of the environment.)
Is there a way to keep the full path (relative or absolute) in the document uri property? I'm trying to inspect files with identical names in different directories, so I need the directory name to tell the files apart.
Thanks! Graydon
Hello Christian --
On Thu, Mar 31, 2022 at 02:45:34PM +0200, Christian Grün scripsit:
It’s sufficient to supply the directory path as second argument:
db:create('db', '/path')
What I've been trying is
db:create('DB', file:descendants($path)[ends-with(.,$suffix), (), $paramsMap)
and I now realize that I can't do that with the third param.
If you want to filter the input paths before passing them on to db:create, you can supply the paths as both inputs and database paths:
let $files := file:descendants('/path') [file:is-file(.)] [contains(file:read-text(.), 'abalaba')] return db:create('db', $files, $files)
That works!
Thank you!
-- Graydon
basex-talk@mailman.uni-konstanz.de