Skip to main content.
home | support | download

Back to List Archive

Option to *not* recurse directories

From: David Brown <dave(at)not-real.davidhbrown.us>
Date: Sat Sep 23 2006 - 02:13:07 GMT
Swish-e gurus,

Am I missing (in swish-e 2.4.3) a command line or configuration option to
index only files in the specified directory without recursing into
subdirectories?

I am thinking I will approximate this by adding the following to the
configuration file:

	FileRules directory contains regex /./

I suppose since I'm building this configuration file dynamically and will
know the starting path, I should be able to take advantage of "Directory
names do *not* have a trailing slash" and use

	FileRules dirname contains "$path/"

..where $path is replaced by the value of IndexDir. So if the dirname has
an extra slash beyond the starting path, it ought to be a subdirectory,
right? I think this will be faster, but it's less general-purpose. And there
might be issues with \ vs. / as delimiter under Windows?

Am I on the right track? Other suggestions? I guess I'll discover what works
soon enough.

Okay, I left that in "drafts" while finishing up the actual code. I went
with the "FileRules dirname" method -- using a forward slash under Windows
-- and it did what I want. 

Still seems like there ought to be an easier way to turn off recursion...
maybe something to consider for 3.0?

Thanks,
Dave

(Background for the curious...)
If the whole file structure -- thousands of PDFs -- is indexed at once, our
shared host runs out of resources (even with -e), so we want to index each
folder recursively and merge up back to the root. Merging partial indexes
has worked well for me before. For this application, the directory structure
is arbitrarily deep and wide; indexable files may exist in any directory.
The routine I'm writing will also check the mtimes on the indexes vs. files
to be indexed and so will be doing its own version of incremental indexing
(yup; I see that coming in 2.5/3.0).

--
David Brown
dave@davidhbrown.us 
Received on Fri Sep 22 19:13:12 2006