You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Gupta, Chandrashekhar (CAP, ELCOE)" <Ch...@gecis.ge.com> on 2003/04/03 08:45:10 UTC
Searching using lucene!
Hi Guru's
I have indexed the top level folder in which search is to happen..I have a query ..How can I search these indexex so that my search would limit to a subfolder inside the top level
folder indexed. Is there any API for the same?
Any help would be extremely useful..
Regards
Chandrashekhar
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
Re: Searching using lucene!
Posted by Tatu Saloranta <ta...@hypermall.net>.
On Wednesday 02 April 2003 23:45, Gupta, Chandrashekhar (CAP, ELCOE) wrote:
> Hi Guru's
>
> I have indexed the top level folder in which search is to happen..I have a
> query ..How can I search these indexex so that my search would limit to a
> subfolder inside the top level folder indexed. Is there any API for the
> same?
You may need to read all the documentation to fully understand how Lucene
works. It has no concept of folders or even files. It just indexes set of
documents with one or more fields each, and allows for searching based on
contents of one or more of those fields. So in a way, answer is no, there's
no such API. However, implementing what you want is fairly easy with Lucene.
In your case you need to recursively index contents of all the fields, and add
one or more fields detailing actual file hierarchy used to get the files.
One possibility is to store filename in one non-tokenizable field, and then
use prefix query (in addition to actual query you want) to limit results to
just documents that match files in specified directory/ies. The query to
match filename/directory should be made required (not optional) to completely
filter out irrelevant results.
Hope this helps,
-+ Tatu +-
ps. I think your question would really belong to users list, not developers...
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org