org.apache.lucene.document.Fieldable Java Examples

The following examples show how to use org.apache.lucene.document.Fieldable. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DocumentUtil.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public static boolean isLocal(@NonNull final Document doc) {
    Fieldable fld = doc.getFieldable(FIELD_BINARY_NAME);
    if (fld == null) {
        return false;
    } else {
        final String binName = fld.stringValue();
        switch (binName.charAt(binName.length()-1)) {
            case EK_LOCAL_ANNOTATION:
            case EK_LOCAL_CLASS:
            case EK_LOCAL_ENUM:
            case EK_LOCAL_INTERFACE:
                return true;
            default:
                return false;
        }
    }
}
 
Example #2
Source File: LogSearch.java    From exhibitor with Apache License 2.0 6 votes vote down vote up
public SearchItem toResult(int documentId) throws IOException
{
    Document        document = searcher.doc(documentId);

    String          type = document.getFieldable(FieldNames.TYPE).stringValue();
    NumericField    date = (NumericField)document.getFieldable(FieldNames.DATE);
    Fieldable       path = document.getFieldable(FieldNames.PATH);
    NumericField    version = (NumericField)document.getFieldable(FieldNames.VERSION);
    return new SearchItem
    (
        Integer.parseInt(type),
        path.stringValue(),
        (version != null) ? version.getNumericValue().intValue() : -1,
        new Date(date.getNumericValue().longValue())
    );
}
 
Example #3
Source File: ClusteredIndexables.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public String getValue(String key) {
    for (Fieldable field : fields) {
        if (field.name().equals(key)) {
            return field.stringValue();
        }
    }
    return null;
}
 
Example #4
Source File: ClusteredIndexables.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public String[] getValues(String key) {
    final List<String> result = new ArrayList<String>();
    for (Fieldable field : fields) {
        if (field.name().equals(key)) {
            result.add(field.stringValue());
        }
    }
    return result.toArray(result.isEmpty() ? EMPTY : new String[result.size()]);
}
 
Example #5
Source File: DocumentUtil.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public static String getSimpleName(final Document doc) {
    final Fieldable field = doc.getFieldable(FIELD_SIMPLE_NAME);
    return field == null ?
            null :
            field.stringValue();
}
 
Example #6
Source File: IndexDocumentImpl.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("deprecation") //NOI18N
private static Fieldable sourceNameField(String relativePath) {
    return new Field(FIELD_PRIMARY_KEY, relativePath, Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS);
}
 
Example #7
Source File: ClusteredIndexables.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public List<Fieldable> getFields() {
    return fields;
}
 
Example #8
Source File: ClusteredIndexables.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private Fieldable sourceNameField(@NonNull String primaryKey) {
    return new Field(FIELD_PRIMARY_KEY, primaryKey, Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS);
}
 
Example #9
Source File: ClusteredIndexables.java    From netbeans with Apache License 2.0 4 votes vote down vote up
ReusableIndexDocument(@NonNull final MemIndexDocument memDoc) {
    Parameters.notNull("memDoc", memDoc);   //NOI18N
    for (Fieldable field : memDoc.getFields()) {
        doc.add(field);
    }
}