Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> problem z zend search lucene
wiewiorek
post
Post #1





Grupa: Zarejestrowani
Postów: 247
Pomógł: 11
Dołączył: 5.09.2009

Ostrzeżenie: (0%)
-----


Usiłuję wykorzystać zend search lucene do wyszukiwania pełnotekstowego - w tym celu pobrałem bibliotekę ZF - umieściłem katalog Zend (w którym jest m. in. katalog Search a w nim katalog Lucene) na serwerze. W pliku index.php mam kod:
  1. require_once 'Zend/Search/Lucene.php';
  2.  
  3. // Create index
  4. $index = Zend_Search_Lucene::create('indexes/products');
  5.  
  6. mysql_connect ("localhost", "root", "");
  7. mysql_query("SET NAMES utf8;");
  8. $query = "SELECT id, tytul FROM strony";
  9. $result = mysql_query($query);
  10. while($row = mysql_fetch_array($result, MYSQL_ASSOC))
  11. {
  12. $doc = new Zend_Search_Lucene_Document();
  13.  
  14. // Store document URL to identify it in the search results
  15. $doc->addField(Zend_Search_Lucene_Field::UnIndexed('id', $row['id']));
  16.  
  17. // Index document title
  18. $doc->addField(Zend_Search_Lucene_Field::Text('tytul', $row['tytul']));
  19.  
  20. // Add document to the index
  21. $index->addDocument($doc);
  22. }
  23.  
  24. // Optimize index.
  25. $index->optimize();


I nie działa - mam błąd:
  1. Warning: Zend_Search_Lucene_Storage_Directory_Filesystem::require_once(Zend/Search/Lucene/Storage/File/Filesystem.php) [function.Zend-Search-Lucene-Storage-Directory-Filesystem-require-once]: failed to open stream: No such file or directory in C:\Program Files\WebServ\httpd\Zend\Search\Lucene\Storage\Directory\Filesystem.php on line 348
  2.  
  3. Fatal error: Zend_Search_Lucene_Storage_Directory_Filesystem::require_once() [function.require]: Failed opening required 'Zend/Search/Lucene/Storage/File/Filesystem.php' (include_path='.;C:\Program Files\WebServ\php\pear') in C:\Program Files\WebServ\httpd\Zend\Search\Lucene\Storage\Directory\Filesystem.php on line 348


O co może chodzić ?

Ten post edytował wiewiorek 21.09.2010, 18:57:27
Go to the top of the page
+Quote Post
darko
post
Post #2





Grupa: Zarejestrowani
Postów: 2 885
Pomógł: 463
Dołączył: 3.10.2009
Skąd: Wrocław

Ostrzeżenie: (0%)
-----


Spróbuj wymusić przez załączeniem bibliotek Zenda dodanie ścieżki do include_path:

  1. ini_set('include_path', 'C:\Program Files\WebServ\httpd\Zend:C:\Program Files\WebServ\httpd\Zend\Search:C:\Program Files\WebServ\httpd\Zend\Search\Lucene');


albo

  1. ini_set('include_path', 'C:/Program Files/WebServ/httpd/Zend:C:/Program Files/WebServ/httpd/Zend/Search:C:/Program Files/WebServ/httpd/Zend/Search/Lucene');


(nigdy nie pamiętam, w którą stronę są te ukośniki)

// edit
a jeśli z jakiś powodów masz zablokowaną funkcję ini_set to zedytuj plik konfigurcyjny php.ini, znajdź wpis include_path i dodawaj po dwukropku odseparowane kolejne ścieżki do załączania skryptów. Na końcu restart Apache'a i voila.

Ten post edytował darko 22.09.2010, 12:16:11
Go to the top of the page
+Quote Post
wiewiorek
post
Post #3





Grupa: Zarejestrowani
Postów: 247
Pomógł: 11
Dołączył: 5.09.2009

Ostrzeżenie: (0%)
-----


Dzięki wielkie - umieściłem katalog /library z ZF u siebie w głównym katalogu lokalnego serwera, do pliku index.php również położonego w głównym katalogu lokalnego serwera dodałem:
  1. ini_set('include_path', "C:\Program Files\WebServ\httpd\library");
  2. require_once 'Zend\Search\Lucene.php';

i działa - dzięki (IMG:style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 25.08.2025 - 05:27