[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/runtime/nepomuk/strigibackend
From: Sebastian Trueg <sebastian () trueg ! de>
Date: 2008-08-05 10:11:40
Message-ID: 1217931100.443708.32121.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 842412 by trueg:
Support non-file URLs and do not convert them to paths.
We will need this soon to index webpages that are not stored locally.
M +1 -0 CMakeLists.txt
M +32 -32 sopranoindexreader.h
M +14 -7 sopranoindexwriter.cpp
--- trunk/KDE/kdebase/runtime/nepomuk/strigibackend/CMakeLists.txt #842411:842412
@@ -43,6 +43,7 @@
${SOPRANO_CLIENT_LIBRARIES}
${QT_QTCORE_LIBRARY}
${CLUCENE_LIBRARY}
+ ${KDE4_KDECORE_LIBS}
)
install(TARGETS sopranobackend LIBRARY DESTINATION ${LIB_INSTALL_DIR}/strigi)
--- trunk/KDE/kdebase/runtime/nepomuk/strigibackend/sopranoindexreader.h \
#842411:842412 @@ -1,5 +1,5 @@
/*
- Copyright (C) 2007 Sebastian Trueg <trueg@kde.org>
+ Copyright (C) 2007-2008 Sebastian Trueg <trueg@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -34,41 +34,41 @@
class Query;
namespace Soprano {
- class IndexReader : public Strigi::IndexReader
- {
- public:
- IndexReader( ::Soprano::Model* );
- ~IndexReader();
+ class IndexReader : public Strigi::IndexReader
+ {
+ public:
+ IndexReader( ::Soprano::Model* );
+ ~IndexReader();
- int32_t countHits( const Query& query );
- std::vector<IndexedDocument> query( const Query&, int off, int max );
- void getHits( const Strigi::Query& query,
- const std::vector<std::string>& fields,
- const std::vector<Strigi::Variant::Type>& types,
- std::vector<std::vector<Strigi::Variant> >& result,
- int off, int max );
+ int32_t countHits( const Query& query );
+ std::vector<IndexedDocument> query( const Query&, int off, int max );
+ void getHits( const Strigi::Query& query,
+ const std::vector<std::string>& fields,
+ const std::vector<Strigi::Variant::Type>& types,
+ std::vector<std::vector<Strigi::Variant> >& result,
+ int off, int max );
- void getChildren( const std::string& parent,
- std::map<std::string, time_t>& children );
+ void getChildren( const std::string& parent,
+ std::map<std::string, time_t>& children );
- int32_t countDocuments();
- int32_t countWords();
- int64_t indexSize();
- time_t mTime( const std::string& uri );
- std::vector<std::string> fieldNames();
- std::vector<std::pair<std::string,uint32_t> > histogram( const std::string& \
query,
- const std::string& fieldname,
- const std::string& labeltype );
- int32_t countKeywords( const std::string& keywordprefix,
- const std::vector<std::string>& fieldnames);
- std::vector<std::string> keywords( const std::string& keywordmatch,
- const std::vector<std::string>& fieldnames,
- uint32_t max, uint32_t offset );
+ int32_t countDocuments();
+ int32_t countWords();
+ int64_t indexSize();
+ time_t mTime( const std::string& uri );
+ std::vector<std::string> fieldNames();
+ std::vector<std::pair<std::string,uint32_t> > histogram( const \
std::string& query, + \
const std::string& fieldname, + \
const std::string& labeltype ); + int32_t countKeywords( const \
std::string& keywordprefix, + const \
std::vector<std::string>& fieldnames); + std::vector<std::string> \
keywords( const std::string& keywordmatch, + \
const std::vector<std::string>& fieldnames, + \
uint32_t max, uint32_t offset );
- private:
- class Private;
- Private* d;
- };
+ private:
+ class Private;
+ Private* d;
+ };
}
}
--- trunk/KDE/kdebase/runtime/nepomuk/strigibackend/sopranoindexwriter.cpp \
#842411:842412 @@ -37,6 +37,8 @@
#include <QtCore/QThread>
#include <QtCore/QDateTime>
+#include <KUrl>
+
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
@@ -76,28 +78,33 @@
// such as tar:/ or zip:/
// Here we try to use KDE-compatible URIs for these indexed files the best \
we can // everything else defaults to file:/
+ QUrl uri;
QString path = QFile::decodeName( idx->path().c_str() );
- QUrl url = QUrl::fromLocalFile( QFileInfo( path ).absoluteFilePath() );
+ if ( KUrl::isRelativeUrl( path ) )
+ uri = QUrl::fromLocalFile( QFileInfo( path ).absoluteFilePath() );
+ else
+ uri = KUrl( path ); // try to support http and other URLs
+
if ( idx->depth() > 0 ) {
QString archivePath = findArchivePath( path );
if ( QFile::exists( archivePath ) ) {
if ( archivePath.endsWith( QLatin1String( ".tar" ) ) ||
archivePath.endsWith( QLatin1String( ".tar.gz" ) ) ||
archivePath.endsWith( QLatin1String( ".tar.bz2" ) ) ) {
- url.setScheme( "tar" );
+ uri.setScheme( "tar" );
}
else if ( archivePath.endsWith( QLatin1String( ".zip" ) ) ) {
- url.setScheme( "zip" );
+ uri.setScheme( "zip" );
}
}
}
// fallback for all
- if ( url.scheme().isEmpty() ) {
- url.setScheme( "file" );
+ if ( uri.scheme().isEmpty() ) {
+ uri.setScheme( "file" );
}
- return url;
+ return uri;
}
class FileMetaData
@@ -211,7 +218,7 @@
// qDebug() << "deleteEntries query:" << query;
- QueryResultIterator result = d->repository->executeQuery( query, \
::Soprano::Query::QUERY_LANGUAGE_SPARQL ); + QueryResultIterator result = \
d->repository->executeQuery( query, ::Soprano::Query::QueryLanguageSparql ); if ( \
result.next() ) { Node indexGraph = result.binding( "g" );
result.close();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic