Package org.dlese.dpc.schemedit
Class RecordList
java.lang.Object
org.dlese.dpc.schemedit.RecordList
Class to manage a list of records (e.g. search results) as a list of RECORD
IDS, rather than as ResultDoc arrays. We don't want to keep sets of
ResultDocs around because they take up memory and also because they can
become stale over time.
- Author:
- ostwald
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor for the RecordList objectRecordList(String[] ids, SimpleLuceneIndex index) Constructor for the RecordList object given an array of idsRecordList(String query, SimpleLuceneIndex index) Contructor for the RecordList object given a query string and a lucene indexRecordList(ResultDocList resultDocs, SimpleLuceneIndex index) Constructor for the RecordList object given a ResultDocList and a SimpleLuceneIndex.RecordList(SimpleLuceneIndex index) Constructor for the RecordList object -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd the id to this RecordLists's itemsbooleanreturns true of the provided id is managed by this RecordListId of the current record.intIndex of the current record in the result list.Gets the current record as a ResultDoc instance.getHits()Returns the records as a list of ResultDocsgetHits(int start, int length) Returns a list of recordDocs for the specified range.intgetIndexOf(String id) Returns the index of the specified id, or -1 if it is not managed by this RecordListbooleanGets the isEmpty attribute of the RecordList objectgetItems()List of record ids returned by the last query.getRecId(int recIndex) Gets the recId attribute of the RecordList objectgetResultDoc(String id) Gets the ResultDoc given a record id via the index.getResultDoc(String id, SimpleLuceneIndex index) Gets the resultDoc for a particular record by searching the index.intgetSize()Gets the size attribute of the RecordList objectbooleanisEmpty()Gets the empty attribute of the RecordList objectiterator()Returns an iterator for the current record list.voidSets the currentRecId attribute of the RecordList objectvoidsetIndex(SimpleLuceneIndex index) Sets the index attribute of the RecordList objectintsize()The number of items
-
Constructor Details
-
RecordList
public RecordList()Constructor for the RecordList object -
RecordList
Constructor for the RecordList object- Parameters:
index- the index
-
RecordList
Contructor for the RecordList object given a query string and a lucene index- Parameters:
query- the queryindex- a lucene index
-
RecordList
Constructor for the RecordList object given a ResultDocList and a SimpleLuceneIndex. The record IDs are extracted from ResultDocList items and stored.- Parameters:
resultDocs- the resultDocListindex- the index
-
RecordList
Constructor for the RecordList object given an array of idsBatchOperations.handleRemoveRecords() uses this method for the values returned by request.getParameterValues().
- Parameters:
ids- An array of RecordIdsindex- the index
-
-
Method Details
-
size
public int size()The number of items- Returns:
- the number of ids (items) managed by this RecordList
-
getSize
public int getSize()Gets the size attribute of the RecordList object- Returns:
- The size value
-
iterator
Returns an iterator for the current record list.- Returns:
- an iterator over this recordList's ids
-
contains
returns true of the provided id is managed by this RecordList- Parameters:
id- id to check against items- Returns:
- true if this RecordList's items contains specified id
-
add
Add the id to this RecordLists's items- Parameters:
id- id to add
-
isEmpty
public boolean isEmpty()Gets the empty attribute of the RecordList object- Returns:
- The empty value
-
getIsEmpty
public boolean getIsEmpty()Gets the isEmpty attribute of the RecordList object- Returns:
- The isEmpty value
-
getIndexOf
Returns the index of the specified id, or -1 if it is not managed by this RecordList- Parameters:
id- a record id to find the index of in this ResultList- Returns:
- The indexOf value
-
getItems
List of record ids returned by the last query.- Returns:
- The items value
-
setIndex
Sets the index attribute of the RecordList object- Parameters:
index- The new index value
-
getHits
Returns the records as a list of ResultDocs- Returns:
- The hits value
-
getHits
Returns a list of recordDocs for the specified range.- Parameters:
start- beginning indexlength- length of range- Returns:
- The hits value
-
getCurrentRecId
Id of the current record.- Returns:
- The currentRecId value
-
setCurrentRecId
Sets the currentRecId attribute of the RecordList object- Parameters:
id- The new currentRecId value
-
getCurrentRecIndex
public int getCurrentRecIndex()Index of the current record in the result list.- Returns:
- The currentRecIndex value
-
getCurrentResult
Gets the current record as a ResultDoc instance.- Returns:
- The currentResult value
-
getResultDoc
Gets the ResultDoc given a record id via the index.- Parameters:
id- the id for which to obtain a ResultDoc- Returns:
- The resultDoc value
-
getResultDoc
Gets the resultDoc for a particular record by searching the index.- Parameters:
id- record idindex- the index- Returns:
- The resultDoc value
-
getRecId
Gets the recId attribute of the RecordList object- Parameters:
recIndex- NOT YET DOCUMENTED- Returns:
- The recId value
-