Ejemplo n.º 1
0
		CNormsBytes*	CInMemoryIndexBarrelReader::norms(fieldid_t fid)
		{
			if(m_pNormsReader == NULL)
				m_pNormsReader = m_pIndexBarrelWriter->m_pNormsWriter->normsReader(m_pIndexBarrelWriter->getFieldsInfo());
			FIRTEX_ASSERT(m_pNormsReader,_T("Get norms reader failed."));
			return m_pNormsReader->getNorms(fid);			
		}
Ejemplo n.º 2
0
		void CPostingMerger_WL::mergeWith(docid_t baseDocID,CInMemoryPosting* pInMemoryPosting)
		{
			CInMemoryPosting_WL* pInMemoryPostingWL = static_cast<CInMemoryPosting_WL*>(pInMemoryPosting);
			FIRTEX_ASSERT(pInMemoryPostingWL,_T("dynamic cast failed."));

			///flush last doc
			pInMemoryPostingWL->flushLastDoc(true);
			
			CBitVector* pFilter = pInMemoryPosting->getFilter();
			if(pFilter && pFilter->hasSmallThan((size_t)pInMemoryPostingWL->m_nLastDocID))///there are deleted documents
			{					
				PostingChunk* pChunk = pInMemoryPostingWL->m_pDocFreqList->m_pHeadChunk;
				if(pChunk)
				{
					uint8_t* bp = &(pChunk->data[0]);
					docid_t firstDocID = CCompressedPostingList::decodePosting32(bp);
					if(!pFilter->hasBiggerThan(firstDocID))///no deleted documents in this posting
					{
						mergeWith_(baseDocID,pInMemoryPostingWL);
					}
					else //may be there are some deleted documents in this posting
					{
						mergeWith_GC(baseDocID,pInMemoryPostingWL,pFilter);
					}
				}
			}
			else 
			{
				mergeWith_(baseDocID,pInMemoryPostingWL);
			}
		}
Ejemplo n.º 3
0
df_t IndexReader::getMaxDocs()const
{
    BarrelsInfoPtr pBarrelsInfo = m_pBarrel->getBarrelsInfo();

    FIRTEX_ASSERT((pBarrelsInfo != NULL), _T("The index has not opened yet."));

    return pBarrelsInfo->getDocCount();
}
Ejemplo n.º 4
0
void CIndex::setDocSchema(CDocumentSchema* pSchema)
{
    FIRTEX_ASSERT((m_pWriter==NULL),_T("Call setDocSchema() before calling acquireWriter()"));
    if(m_pDocSchema)
        delete m_pDocSchema;
    m_pDocSchema = NULL;
    m_pDocSchema = new CDocumentSchema(*pSchema);
}
Ejemplo n.º 5
0
		void CMMapIndexInput::close()
		{			
#ifdef WIN32
			if ( m_pData != NULL )
			{
				if ( ! UnmapViewOfFile(m_pData) )
				{
					FIRTEX_ASSERT( false, _T("UnmapViewOfFile(m_pData) failed"));
				}
			}
            
			if (m_hMap != NULL )
			{
				if ( ! CloseHandle(m_hMap) )
				{
					FIRTEX_ASSERT( false, _T("CloseHandle(mmaphandle) failed"));
				}
			}
			if ( m_hFile != NULL )
			{
				if ( !CloseHandle(m_hFile) )
				{
					FIRTEX_ASSERT( false, _T("CloseHandle(fhandle) failed"));
				}
			}
			m_hMap = NULL;
			m_hFile = NULL;
#else
			if ( m_pData != NULL )
				::munmap(m_pData, m_length);
			if ( m_hFile > 0 )
				::fileClose(m_hFile);
			m_hFile = 0;
#endif			
			m_pData = NULL;
			m_nPos = 0;
		}	
Ejemplo n.º 6
0
		void CPostingMerger_WL::mergeWith(docid_t baseDocID,COnDiskPosting* pOnDiskPosting)
		{
			COnDiskPosting_WL* pOnDiskPostingWL = static_cast<COnDiskPosting_WL*>(pOnDiskPosting);
			FIRTEX_ASSERT(pOnDiskPostingWL,_T("static cast failed."));
			
			CBitVector* pFilter = pOnDiskPostingWL->getFilter();
			if(pFilter && pFilter->hasSmallThan((size_t)pOnDiskPostingWL->m_chunkDesc.lastdocid))///there are deleted documents			
			{				
				mergeWith_GC(baseDocID,pOnDiskPostingWL,pFilter);
			}
			else 
			{
				mergeWith_(baseDocID,pOnDiskPostingWL);
			}
		}
Ejemplo n.º 7
0
CFactoryFinder*	CIndex::getFactoryFinder()
{
    if(m_pFactoryFinder)
        return m_pFactoryFinder;
    if((m_accessMode & ACCESS_CREATE) != ACCESS_CREATE)
    {
        m_pFactoryFinder = createFactoryFinderFromExistIndex();
    }
    if( (m_pFactoryFinder == NULL) && ( (m_accessMode & ACCESS_APPEND) || (m_accessMode & ACCESS_CREATE)))
    {
        if(m_pWriter == NULL)
            return NULL;
        m_pFactoryFinder = m_pWriter->createFactoryFinder();
    }
    FIRTEX_ASSERT( m_pFactoryFinder,_T("Create field factories failed."));
    return m_pFactoryFinder;
}
Ejemplo n.º 8
0
tstring IndexReader::getIndexVersion() const
{
    BarrelsInfoPtr pBarrelsInfo = m_pBarrel->getBarrelsInfo();
    FIRTEX_ASSERT((pBarrelsInfo != NULL), _T("The index has not opened yet."));
    return pBarrelsInfo->getIndexVersion();
}
Ejemplo n.º 9
0
		CFieldsInfo& CInMemoryIndexBarrelReader::getFieldsInfo()
		{			
			FIRTEX_ASSERT(m_pIndexBarrelWriter->m_pFieldsInfo,_T("Get fields info failed."));
			return (*m_pIndexBarrelWriter->m_pFieldsInfo);
		}