This commit is contained in:
parent
76bd8b76e4
commit
b102ebf9fb
@ -62,6 +62,15 @@ class Doctrine_Search extends Doctrine_Plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function search($query)
|
||||||
|
{
|
||||||
|
$q = new Doctrine_Search_Query($this->_options['pluginTable']);
|
||||||
|
|
||||||
|
$q->search($query);
|
||||||
|
|
||||||
|
return $q->execute();
|
||||||
|
}
|
||||||
|
|
||||||
public function analyze($text)
|
public function analyze($text)
|
||||||
{
|
{
|
||||||
return $this->_options['analyzer']->analyze($text);
|
return $this->_options['analyzer']->analyze($text);
|
||||||
@ -93,7 +102,6 @@ class Doctrine_Search extends Doctrine_Plugin
|
|||||||
|
|
||||||
$index->save();
|
$index->save();
|
||||||
} else {
|
} else {
|
||||||
print 'joo';
|
|
||||||
foreach ($fields as $field) {
|
foreach ($fields as $field) {
|
||||||
|
|
||||||
$value = $data[$field];
|
$value = $data[$field];
|
||||||
|
@ -59,6 +59,7 @@ class Doctrine_Search_Analyzer_Standard implements Doctrine_Search_Analyzer_Inte
|
|||||||
'any',
|
'any',
|
||||||
'are',
|
'are',
|
||||||
'area',
|
'area',
|
||||||
|
'arent',
|
||||||
'around',
|
'around',
|
||||||
'as',
|
'as',
|
||||||
'at',
|
'at',
|
||||||
@ -263,12 +264,15 @@ class Doctrine_Search_Analyzer_Standard implements Doctrine_Search_Analyzer_Inte
|
|||||||
'will',
|
'will',
|
||||||
'with',
|
'with',
|
||||||
'would',
|
'would',
|
||||||
|
'yet',
|
||||||
'you',
|
'you',
|
||||||
'your',
|
'your',
|
||||||
|
'yours'
|
||||||
);
|
);
|
||||||
|
|
||||||
public function analyze($text)
|
public function analyze($text)
|
||||||
{
|
{
|
||||||
|
$text = preg_replace('/[\'`´"]/', '', $text);
|
||||||
$text = preg_replace('/[^A-Za-z0-9]/', ' ', $text);
|
$text = preg_replace('/[^A-Za-z0-9]/', ' ', $text);
|
||||||
$text = str_replace(' ', ' ', $text);
|
$text = str_replace(' ', ' ', $text);
|
||||||
|
|
||||||
|
@ -57,6 +57,10 @@ class Doctrine_Search_File extends Doctrine_Search
|
|||||||
RecursiveIteratorIterator::LEAVES_ONLY);
|
RecursiveIteratorIterator::LEAVES_ONLY);
|
||||||
|
|
||||||
foreach ($it as $file) {
|
foreach ($it as $file) {
|
||||||
|
if (strpos($file, DIRECTORY_SEPARATOR . '.svn') !== false) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$this->updateIndex(array('url' => $file->getPathName(),
|
$this->updateIndex(array('url' => $file->getPathName(),
|
||||||
'content' => file_get_contents($file)));
|
'content' => file_get_contents($file)));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user