Jothi
Jothi

Reputation: 15110

Filters in Lucene

Friends,

I am new to lucene full text search. i have developed page with full text seach. it works fine till. but now i want to add extra condition like where clause. how to do it.

The requirement given for me is, i have to list proposal which is created by logged in user. I have to add this condition in back end without user knowledge.

I heard about filter. Which filter is correct?how to apply that.Give me an sample. this evening i have demo. help me.

Upvotes: 0

Views: 576

Answers (1)

MattMcKnight
MattMcKnight

Reputation: 8290

First, you need to ensure that the user id is being added to the document in the index in a field when you index, let's call it user_id.

In a pinch, you can add a field to the query string entered by the user behind the scenes before you send it to the query parser. So, take whatever query was entered and add " AND user_id:4" (where 4 is the value of the variable containing the current user id) onto the end of it.

Upvotes: 2

Related Questions