Help regarding choosing Indexing Stratergies
In my Application currently I am indexing Object with One Field[ID] to Hold ID of the Object which is stored and attributes of Object into Another Field [Content] to hold attribute information seperated by space and this Field is tokenized. When I search for information related to the Object I get result as ID and using that ID I fetech the information from backend and I show it as search result.
Now the requirement is for some user of the application who don't have access to attributes in Object and search on that attribute information, then Object should not be included in the result.
The reason why I see is not possible is as I am not Storing each attribute as Field instead Instead I am indexing many small text fields, aggregate the text into a single "contents" field and index only that.
So is there any better approach for Indexing? Please help me out.
Code Snippet:
Document doc = new Document(..);
Field objField = new Field("ID", objId, Field..STORE.YES)
String attrValue = "";
for(Attribute att: allAttributes){
attrValue += att.getValue() + " ";
}
Field attField = new Field("content", attrValue, Field.STORE.NO, Field.Index.TOKENIZED)
Attributes are shown to user based on their access.