//-------------------------------------------------------------------------- // given a group we retreive a list of words locations that match the query // words in the group public bool GetWordsLocationDetails( Group group, GetWordsLocationDetailsCallback callback) { if (callback == null) { return(false); } return(_workerThread.PostTask(_ => { try { // now query the locations List <WordLocationDetails> result = ContainsService.Instance.Query(group); callback(result, true, null); } catch (Exception e) { callback(null, false, e.Message); } })); }
//-------------------------------------------------------------------------- // given document properties and word location properties - we retreive a // list of words locations that match the query public bool GetWordsLocationDetails( List <DocumentProperty> documentProperties, List <WordLocationProperty> wordLocationProperties, GetWordsLocationDetailsCallback callback) { if (callback == null) { return(false); } return(_workerThread.PostTask(_ => { try { // first query documents List <Document> documents = new List <Document>(); // an empty documentProperties list means ALL documents, so we can // skip querying the documents and pass an empty list of documents to // the next query (ContainsService) if (documentProperties.Count > 0) { documents = DocumentsService.Instance.Query(new List <string>(), documentProperties); if (documents.Count == 0) { // if we didn't get any document, then we can stop // otherwise, we'll query the entire DB... callback(new List <WordLocationDetails>(), true, null); return; } } // now query the locations List <WordLocationDetails> result = ContainsService.Instance.Query(documents, wordLocationProperties); callback(result, true, null); } catch (Exception e) { callback(null, false, e.Message); } })); }