use of org.alfresco.solr.AlfrescoSolrDataModel.IndexedField in project SearchServices by Alfresco.
the class Solr4QueryParser method addContentAttributeQuery.
// TODO: correct field names
protected Query addContentAttributeQuery(PropertyDefinition pDef, String queryText, SubQuery subQueryBuilder, AnalysisMode analysisMode, LuceneFunction luceneFunction, String expandedFieldName, List<Locale> expandedLocales) throws ParseException {
BooleanQuery.Builder booleanQuery = new BooleanQuery.Builder();
for (Locale locale : expandedLocales) {
if (locale.toString().length() == 0) {
IndexedField indexedField = AlfrescoSolrDataModel.getInstance().getQueryableFields(pDef.getName(), null, FieldUse.FTS);
for (FieldInstance field : indexedField.getFields()) {
if (!field.isLocalised()) {
Query subQuery = subQueryBuilder.getQuery(field.getField(), queryText, analysisMode, luceneFunction);
if (subQuery != null) {
booleanQuery.add(subQuery, Occur.SHOULD);
}
}
}
} else {
StringBuilder builder = new StringBuilder(queryText.length() + 10);
builder.append("\u0000").append(locale.toString()).append("\u0000").append(queryText);
IndexedField indexedField = AlfrescoSolrDataModel.getInstance().getQueryableFields(pDef.getName(), null, FieldUse.FTS);
for (FieldInstance field : indexedField.getFields()) {
if (field.isLocalised()) {
Query subQuery = subQueryBuilder.getQuery(field.getField(), builder.toString(), analysisMode, luceneFunction);
if (subQuery != null) {
booleanQuery.add(subQuery, Occur.SHOULD);
}
}
}
}
}
return getNonEmptyBooleanQuery(booleanQuery.build());
}
Aggregations