We're updating the issue view to help you get more done. 

@Field( groups=... )

Description

To search on multiple fields, one ugly solution is to concatenate all the entity's searchable fields in a big text that is indexed.

A cleaner solution is to use an org.apache.lucene.queryParser.MultiFieldQueryParser
This parser requires a String[] of the fields to search on.
To avoid having to give this (long) list of files to every query, and to have to manage it by hand, the idea is to have field "groups".
So you could add a parameter to the @Field annotation as in this example :

@Entity
@Indexed
public CV {

@Field( Indexed.TOKENIZED, queryGroups={"all"} )
String name;

@Field( Indexed.TOKENIZED, queryGroups={"accounting"} )
String bankAccount;

@Field( Indexed.TOKENIZED, queryGroups={"accounting","backOffice"} )
String address;

@SearchableEmbeddeable( queryGroups={"accounting","backOffice"} )
MedicalInfo mi;
}

Those groups could be used like security roles in servlets.
In the above examples, you could ask for the list of searchable fields for the accountants :

String[] searchableFieldsForAccountants = ContextHelper( session ).getDocumentBuilder( CV.class ).getFieldsForGroup( "accountants" );

Then you could construct the query parser :
luceneQuery = new MultiFieldQueryParser( searchableFieldsForAccountants getAnalyzer() );

Environment

None

Status

Assignee

Unassigned

Reporter

Sylvain Vieujot

Labels

None

Suitable for new contributors

None

Pull Request

None

Feedback Requested

None

Components

Affects versions

3.0.0.beta1

Priority

Major