Package gov.usgs.earthquake.indexer
Interface Associator
- All Known Implementing Classes:
DefaultAssociator
public interface Associator
Implement event association logic used by the indexer.
It is the associators job to describe how to find matching events, and then
choose the best matching event that was found.
The indexer uses the Associator to build a query used to search the
ProductIndex. After querying the ProductIndex, the indexer then calls the
chooseEvent method with any found events.
-
Method Summary
Modifier and TypeMethodDescriptionchooseEvent
(List<Event> events, ProductSummary summary) Choose the best matching event for a product summary from a list of events.boolean
eventsAssociated
(Event event1, Event event2) Check if two events are associated.getEventIdQuery
(String eventSource, String eventCode) Get a ProductIndexQuery that searches by eventid.getLocationQuery
(Date time, BigDecimal latitude, BigDecimal longitude) Get a ProductIndexQuery that searches by location.getSearchRequest
(ProductSummary summary) Create a SearchRequest that can be used to find related events.
-
Method Details
-
getSearchRequest
Create a SearchRequest that can be used to find related events.- Parameters:
summary
- the product summary being associated.- Returns:
- a SearchRequest that can be used to search the ProductIndex.
-
chooseEvent
Choose the best matching event for a product summary from a list of events. If no events match, returns null.- Parameters:
events
- a list of candidate events.summary
- the product summary being associated.- Returns:
- the best match event, or null if no matching event found.
-
eventsAssociated
Check if two events are associated.- Parameters:
event1
- the first eventevent2
- the second event- Returns:
- true if they refer to the same event, false otherwise.
-
getEventIdQuery
Get a ProductIndexQuery that searches by eventid.- Parameters:
eventSource
- relevant to eventeventCode
- relevant to event- Returns:
- a ProductIndexQuery that searches by eventid.
-
getLocationQuery
Get a ProductIndexQuery that searches by location.- Parameters:
time
- of eventlatitude
- of eventlongitude
- of event- Returns:
- a ProductIndexQuery that searches by location.
-