On 01/06/2010 04:11 PM, Milind Kamble wrote:
Hi. After much searching around the XWiki
documentation, Apache
Lucene documentation and googling, I have not succeeded in finding a
solution to the following questions:
1. How does one locate all attachments with an extension say 'xls'? I
am thinking that the query should look like "filename: *.xls", but
Lucene query syntax does not allow * to be the first character of a
search
2. Many times users remember some portion of the attachment filename.
What would be the syntax to locate such attachments. Something like
"filename: *Report*.doc"
Unfortunately, as you said, Lucene doesn't allow * at the start of the
word. There's nothing we can do about it, since Lucene is a standalone
project, developed at the Apache Foundation.
A workaround is to search using all of the letters at the start of the
search term, followed by *, as in:
a*.pdf OR b*.pdf OR c*.pdf OR...
3. The SearchApplicationLuceneSearchQueryHelp page on
code.xwiki.org
does not mention how to constrain a search to a given space. What is
the field name for specifying a space. For example trying to locate
the homepage of users with first name John by using "space:XWiki
name:John*" does not work
The lucene plugin uses the old terminology of "web" instead of
"space".
So, "web:XWiki" returns all the documents in the XWiki space.
4. Going one step further, is there a way to specify a
regular
expression syntax for a Lucene search query? The range operator
syntax is not quite self-explanatory. For a query like "name:[Aida TO
Carmen]", what does it mean to locate all pages whose name are
between Aida and Carmen? Would it match AidaSummerVacation? I tried
"filename:[A TO Z]*.xls" to locate an attachment name 'Test.xls' but
that didn't work.
Indeed, that doesn't seem to work.
If anyone can shed light on educating the finer
details of using the
full power of Lucene search, I would very much appreciate that.
The best documentation is on the Lucene project itself, and it seems
that you've already read their query syntax page. You could ask more
questions on their mailing list:
http://lucene.apache.org/mail.html
--
Sergiu Dumitriu
http://purl.org/net/sergiu/