use of org.apache.lucene.document.IntField in project entando-core by entando.
the class IndexerDAO method indexAttribute.
private void indexAttribute(Document document, AttributeInterface attribute, Lang lang) throws ApsSystemException {
attribute.setRenderingLang(lang.getCode());
if (attribute instanceof IndexableAttributeInterface) {
String valueToIndex = ((IndexableAttributeInterface) attribute).getIndexeableFieldValue();
String indexingType = attribute.getIndexingType();
String fieldName = lang.getCode();
if (attribute instanceof ResourceAttributeInterface) {
fieldName += IIndexerDAO.ATTACHMENT_FIELD_SUFFIX;
}
if (null != indexingType && IndexableAttributeInterface.INDEXING_TYPE_UNSTORED.equalsIgnoreCase(indexingType)) {
document.add(new TextField(fieldName, valueToIndex, Field.Store.NO));
}
if (null != indexingType && IndexableAttributeInterface.INDEXING_TYPE_TEXT.equalsIgnoreCase(indexingType)) {
document.add(new TextField(fieldName, valueToIndex, Field.Store.YES));
}
}
if (attribute.isSearchable()) {
List<Lang> langs = new ArrayList<Lang>();
langs.add(lang);
AttributeTracer tracer = new AttributeTracer();
tracer.setLang(lang);
String name = tracer.getFormFieldName(attribute);
List<AttributeSearchInfo> searchInfos = attribute.getSearchInfos(langs);
if (null != searchInfos) {
for (int i = 0; i < searchInfos.size(); i++) {
AttributeSearchInfo info = searchInfos.get(i);
Field field = null;
if (null != info.getDate()) {
field = new TextField(name, DateTools.timeToString(info.getDate().getTime(), DateTools.Resolution.MINUTE), Field.Store.YES);
} else if (null != info.getBigDecimal()) {
field = new IntField(name, info.getBigDecimal().intValue(), Field.Store.YES);
} else {
field = new TextField(name, info.getString(), Field.Store.YES);
}
document.add(field);
}
}
}
}
use of org.apache.lucene.document.IntField in project gitblit by gitblit.
the class TicketIndexer method toDocField.
private void toDocField(Document doc, Lucene lucene, int value) {
doc.add(new IntField(lucene.name(), value, Store.YES));
doc.add(new NumericDocValuesField(lucene.name(), value));
}
Aggregations