For the first Part of your Question:
> I don't think this is so. Search results should be filtered, yes, but I
don't think "AccessRights" is the way to do it. I already know what
documents a user can see; I'm just trying to figure out how to make lucene
filter to those documents.
You make your own filtering (and return some custom "array-of-result") to
the user in a HitCollector like below
public class MyResult
{
public string Title = "";
public string Text = "";
}
public class MyHitCollector : Lucene.Net.Search.HitCollector
{
Lucene.Net.Index.IndexReader Reader = null;
public MyHitCollector(Lucene.Net.Index.IndexReader r)
{
Reader = r;
}
public List<MyResult> Result = new List<MyResult>();
public override void Collect(int doc, float score)
{
MyResult m = new MyResult();
Lucene.Net.Documents.Document doc = Reader.Document(doc);
if(some logic)
{
m.Text="?";
m.Title= "?";
Result.Add(m);
}
}
}
DIGY.
-----Original Message-----
From: Brian Victor [mailto:[email protected]]
Sent: Wednesday, April 01, 2009 9:08 PM
To: [email protected]
Subject: Re: Filtering queries
On Wed, Apr 01, 2009 at 09:00:19PM +0300, Digy wrote:
>2- Search results should be filtered (in a loop while reading the docs from
>index?) before returning to user, utilizing the field "AccessRights".
I don't think this is so. Search results should be filtered, yes, but I
don't think "AccessRights" is the way to do it. I already know what
documents a user can see; I'm just trying to figure out how to make
lucene filter to those documents.
Let's make the problem easier for a moment. If I add a "DatabaseID"
field to every document, and I have a list of database IDs, can I tell
lucene to only return documents in that list? The list could be in the
magnitude of thousands.
--
Brian