public static List<Entry<String, Object>> getKeyValueList( Object obj, boolean fulltextIndex ) { return getKeyValueList( null, obj, fulltextIndex ); }
public static Map<String, List<Object>> getKeyValues( String path, Object obj, boolean fulltextIndex ) { Map<String, List<Object>> keys = new LinkedHashMap<String, List<Object>>(); buildKeyValueSet( obj, keys, path, fulltextIndex ); return keys; }
public static List<Map.Entry<String, Object>> getKeyValueList( String path, Object obj, boolean fulltextIndex ) { Map<String, List<Object>> map = getKeyValues( path, obj, fulltextIndex ); List<Map.Entry<String, Object>> list = new ArrayList<Map.Entry<String, Object>>(); for ( Entry<String, List<Object>> entry : map.entrySet() ) { for ( Object value : entry.getValue() ) { list.add( new AbstractMap.SimpleEntry<String, Object>( entry.getKey(), value ) ); } } return list; }
@SuppressWarnings("unchecked") Collection<Object> c = ( Collection<Object> ) node; for ( Object o : c ) { buildKeyValueSet( o, keyValues, path, fulltextIndex, newHistory ); buildKeyValueSet( e.getValue(), keyValues, newPath, fulltextIndex, newHistory ); ArrayNode c = ( ArrayNode ) node; for ( JsonNode o : c ) { buildKeyValueSet( o, keyValues, path, fulltextIndex, newHistory ); buildKeyValueSet( e.getValue(), keyValues, newPath, fulltextIndex, newHistory ); buildKeyValueSet( toJsonNode( node ), keyValues, path, fulltextIndex, history ); List<Object> keywords = cast( keywords( ( String ) node ) );
@Test public void testKeywords() { String test = "Dragons, the policeman knew, were supposed to breathe fire and occasionally get themselves " + "slaughtered."; List<String> keywords = IndexUtils.keywords( test ); assertEquals( 11, keywords.size() ); for ( String keyword : keywords ) { logger.info( keyword ); } }
public MessageIndexUpdate( Message message ) { this.message = message; if ( message.isIndexed() ) { propertyEntryList = new HashMap<String, List<Map.Entry<String, Object>>>(); for ( Map.Entry<String, Object> property : message.getProperties().entrySet() ) { if ( !MESSAGE_PROPERTIES.containsKey( property.getKey() ) && validIndexableValueOrJson( property.getValue() ) ) { List<Map.Entry<String, Object>> list = getKeyValueList( property.getKey(), property.getValue(), FULLTEXT ); propertyEntryList.put( property.getKey(), list ); } } } else { propertyEntryList = null; } }
public void dumpJson( String path, Object json ) { List<Map.Entry<String, Object>> list = IndexUtils.getKeyValueList( path, json, true ); for ( Map.Entry<String, Object> e : list ) { logger.info( e.getKey() + " = " + e.getValue() ); } }
@Test public void testKeyValue() throws Exception { User user = new User(); user.setUsername( "edanuff" ); user.setEmail( "ed@anuff.com" ); Activity activity = Activity.newActivity( Activity.VERB_POST, null, "I ate another sammich", null, user, null, "tweet", null, null ); List<Entry<String, Object>> l = IndexUtils.getKeyValueList( activity, false ); for ( Entry<String, Object> e : l ) { logger.info( e.getKey() + " = " + e.getValue() ); } assertEquals( 7, l.size() ); } }
List<Map.Entry<String, Object>> list = getKeyValueList( entryName, entryValue, false );