private HodSearchResult addDomain ( final Iterable < ResourceName > indexIdentifiers , final HodSearchResult document ) { // HOD does not return the domain for documents yet, but it does return the index final String index = document . getIndex ( ) ; String domain = null ; // It's most likely that the returned documents will be in one of the indexes we are querying (hopefully the // names are unique between the domains...) for ( final ResourceName indexIdentifier : indexIdentifiers ) { if ( index . equals ( indexIdentifier . getName ( ) ) ) { domain = indexIdentifier . getDomain ( ) ; break ; } } if ( domain == null ) { // If not, it might be a public index domain = PUBLIC_INDEX_NAMES . contains ( index ) ? ResourceName . PUBLIC_INDEXES_DOMAIN : getDomain ( ) ; } return document . toBuilder ( ) . domain ( domain ) . build ( ) ; }
Add a domain to a FindDocument given the collection of indexes which were queried against to return it from HOD