/usr/share/php/LetoDMS/Lucene/Search.php is in php-letodms-lucene 1.1.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | <?php
/**
* Implementation of search in lucene index
*
* @category DMS
* @package LetoDMS_Lucene
* @license GPL 2
* @version @version@
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2010, Uwe Steinmann
* @version Release: 1.1.1
*/
/**
* Class for searching in a lucene index.
*
* @category DMS
* @package LetoDMS_Lucene
* @version @version@
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2011, Uwe Steinmann
* @version Release: 1.1.1
*/
class LetoDMS_Lucene_Search {
/**
* @var object $index lucene index
* @access protected
*/
protected $index;
/**
* Create a new instance of the search
*
* @param object $index lucene index
* @return object instance of LetoDMS_Lucene_Search
*/
function __construct($index) { /* {{{ */
$this->index = $index;
$this->version = '1.1.1';
if($this->version[0] == '@')
$this->version = '3.0.0';
} /* }}} */
/**
* Search in index
*
* @param object $index lucene index
* @return object instance of LetoDMS_Lucene_Search
*/
function search($term, $owner, $status='', $categories=array(), $fields=array()) { /* {{{ */
$query = '';
if($fields) {
} else {
if($term)
$query .= trim($term);
}
if($owner) {
if($query)
$query .= ' && ';
$query .= 'owner:'.$owner;
}
if($categories) {
if($query)
$query .= ' && ';
$query .= '(category:"';
$query .= implode('" || category:"', $categories);
$query .= '")';
}
$hits = $this->index->find($query);
$recs = array();
foreach($hits as $hit) {
$recs[] = array('id'=>$hit->id, 'document_id'=>$hit->document_id);
}
return $recs;
} /* }}} */
}
?>
|