示例#1
0
<?php

$rootpath = dirname(__FILE__);
require_once "../init.inc.php";
require_once "../lib/rss.class.inc.php";
$solr = new Solr();
if ($solr->connect($theme->getSolrHost(), $theme->getSolrPort(), $theme->getSolrBaseUrl(), $theme->getSolrCore())) {
    $crit = getRequestParam("q");
    $tag = getRequestParam("t");
    $querylang = getRequestParam("ql");
    $fqitms = array();
    $word_variations = getRequestParam("wv") == "1";
    $filter_lang = getRequestParam("lang");
    $filter_country = getRequestParam("country");
    $filter_mimetype = getRequestParam("mime");
    $filter_source = getRequestParam("org");
    $filter_tag = array();
    if ($tag != "") {
        $filter_tag = explode(",", $tag);
    }
    if ($filter_country != "" || $filter_lang != "" || $filter_mimetype != "" || $filter_source != "") {
        $mode = "advanced";
    } else {
        $mode = "simple";
    }
    $queryField = getQueryField($search_language_code);
    $response = $solr->query($crit, $queryField, $querylang, '', 0, 0, 100, $fqitms, $word_variations, $filter_lang, $filter_country, $filter_mimetype, $filter_source, $filter_collection, $filter_tag, '', '', '', '', '', true, false);
    if ($response->getHttpStatus() == 200) {
        //print_r( $response->getRawResponse() );
        $url = $config->get("application.url");
        $title = $config->get("application.title");
示例#2
0
function getSolrLexicons($solr_host, $solr_port, $solr_baseurl, $solr_corename)
{
    //if (!isset($_SESSION['lexicons'])) {
    if ($solr_baseurl == "undefined") {
        $solr_baseurl = "";
    }
    if ($solr_corename == "undefined") {
        $solr_corename = "";
    }
    $solr = new Solr();
    if ($solr->connect($solr_host, $solr_port, $solr_baseurl, $solr_corename)) {
        $lexicons = $solr->getFiedValues('language,country,contenttyperoot');
        return $lexicons;
    }
}