You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Velaboy V <ve...@ymail.com> on 2009/05/13 10:45:32 UTC

How can i restrict search to only some documents.

Hi,

I am new to Lucene.

I have a document repository laid out like this:
\docsdir
   \doc1dir\
   \doc2dir\
   \doc3dir\
    ...

Every docNdir contains several files (xml).

While searching, i want to restrict the search Only to a set of documents (this is because the user who is searching has rights on only some documents).

What is the best way to go about this?
(I haven't even thought of how index will be created yet...).

Regards,
velaboy



      Explore and discover exciting holidays and getaways with Yahoo! India Travel http://in.travel.yahoo.com/

Re: How can i restrict search to only some documents.

Posted by Anshum <an...@gmail.com>.
Hi,

There are several ways to do it, easier ones:
1. While indexing, you could store the directory and then filter results on
directory while searching.
2. Run a prefix query while searching in case you can't index the directory,
though I wouldn't have a reason to justify this approach.

The above solution is considering that you have restrictions on directory
basis. If it involves a rather open restriction i.e. document/file basis,
you would have to categorize documents while indexing i.e. also index, for
each document, a field that specifies groups who have permission on this
doc.
Hope this helps.

--
Anshum Gupta
Naukri Labs!
http://ai-cafe.blogspot.com

The facts expressed here belong to everybody, the opinions to me. The
distinction is yours to draw............


On Wed, May 13, 2009 at 2:15 PM, Velaboy V <ve...@ymail.com> wrote:

> Hi,
>
> I am new to Lucene.
>
> I have a document repository laid out like this:
> \docsdir
>    \doc1dir\
>    \doc2dir\
>    \doc3dir\
>     ...
>
> Every docNdir contains several files (xml).
>
> While searching, i want to restrict the search Only to a set of documents
> (this is because the user who is searching has rights on only some
> documents).
>
> What is the best way to go about this?
> (I haven't even thought of how index will be created yet...).
>
> Regards,
> velaboy
>
>
>
>      Explore and discover exciting holidays and getaways with Yahoo! India
> Travel http://in.travel.yahoo.com/