org.gcube.search.datafusion
Class DataFusion

java.lang.Object
  extended by org.gcube.search.datafusion.DataFusion
All Implemented Interfaces:
Serializable

public class DataFusion
extends Object
implements Serializable

Author:
Alex Antoniadis
See Also:
Serialized Form

Constructor Summary
DataFusion(URI[] locators, String query)
          Instantiates data fusion for the records in the locators and the given query
DataFusion(URI[] locators, String query, Integer count)
          Instantiates data fusion for the records in the locators and the given query and returns up to the count records
 
Method Summary
 URI operate()
           
 URI rerank()
          Wrapper for the static rerankRecords(java.util.Iterator, java.lang.String, int, java.util.List, java.lang.Boolean)
static URI rerankRecords(Iterator<PositionalRecordWrapper> iter, String query, int count, List<String> snippetFields, Boolean includePosition)
          Takes an iterator of PositionalRecordWrappers and puts them in a lucene index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataFusion

public DataFusion(URI[] locators,
                  String query)
           throws gr.uoa.di.madgik.grs.reader.GRS2ReaderException
Instantiates data fusion for the records in the locators and the given query

Parameters:
locators -
query -
Throws:
gr.uoa.di.madgik.grs.reader.GRS2ReaderException

DataFusion

public DataFusion(URI[] locators,
                  String query,
                  Integer count)
           throws gr.uoa.di.madgik.grs.reader.GRS2ReaderException
Instantiates data fusion for the records in the locators and the given query and returns up to the count records

Parameters:
locators -
query -
count -
Throws:
gr.uoa.di.madgik.grs.reader.GRS2ReaderException
Method Detail

operate

public URI operate()
            throws Exception
Returns:
gRS2 locator of the result
Throws:
Exception

rerank

public URI rerank()
           throws Exception
Wrapper for the static rerankRecords(java.util.Iterator, java.lang.String, int, java.util.List, java.lang.Boolean)

Returns:
gRS2 locator of the reranked records
Throws:
Exception

rerankRecords

public static URI rerankRecords(Iterator<PositionalRecordWrapper> iter,
                                String query,
                                int count,
                                List<String> snippetFields,
                                Boolean includePosition)
                         throws Exception
Takes an iterator of PositionalRecordWrappers and puts them in a lucene index. Then it performs the query to rerank the records and returns the URI of the gRS of the result. The query is performed on an extra field that is either included the payload of the record field in the list of snippetFields or the actual payload of the record (if none of the snippetFields are included in the record). The actual payload is retrieved from the objectID field which is a URI (text extraction is used to parse the response). After the records are reranked based on the query we can rearrange the results based on their initial position of each record by setting includePosition to true. This rearrangement is done in RankedRecord.recalculateScores(java.util.Map, java.util.Map, java.lang.Boolean) and the actual calculation of the final score based on the lucene score and the initial position is done in RankedRecord.calcScore(org.gcube.search.datafusion.datatypes.RankedRecord)

Parameters:
iter -
query -
count -
snippetFields -
includePosition -
Returns:
the URI of the gRS of the result
Throws:
Exception


Copyright © 2013. All Rights Reserved.