Then your best bet would be to actually check what is in the index itself. There's a chance your tokenizer could be messing up because of the hyphens in your search terms. If you run Luke, the Lucene Index Toolbox, you'll be able to look at exactly what is in each field, top terms in each field, and do some test queries. http://www.getopt.org/luke/ Open up your index in that program, and in the main tab click on the "categories_url" field. Then click top terms. First thing is to make sure it actually has terms, then make sure that the terms are what you're expecting. Your searches look fine to me, but it is possible that your index isn't built quite right yet. It took me several tries to make sure all of my fields were being indexed the way I intended.
>>> Sergio Rinaudo <[email protected]> 4/20/2009 12:49:35 PM >>> Thank you MSchraeder for your reply! However I tried like you said but it is not working ( or maybe I'm mistaking something.. ), I'll post here a full example: I have a Lucene field, named 'categories_url' where I store all the categories for a certain page, eg. categories_url => audiovideo-PC-telefonia , varie-regali , compro-vendo I do a search, looking for 'compro-vendo' $term = new Zend_Search_Lucene_Index_Term($c, 'categories_url'); $query = new Zend_Search_Lucene_Search_Query_Term($term); $results = $index->find($query,'dateCreated',SORT_REGULAR,SORT_DESC); where $c is obviously compro-vendo If I do an 'echo' of the $query variable I get categories_url:compro-vendo $results array is empty, if I do Zend_Debug::dump($results); I get array(0) { }All this block is inside a try..catch statement. I've also tried to remove the 'dateCreated',SORT_REGULAR,SORT_DESC' arguments, same result. Any advices? Thank you Sergio Rinaudo Date: Mon, 20 Apr 2009 08:20:18 -0500 From: [email protected] To: [email protected]; [email protected] Subject: RE: [fw-general] Zend_Search_Lucene_Search_Query_Wildcard working with zf 1.7.0 but not with 1.7.7+ .ExternalClass .EC_hmmessage P{padding:0px;}.ExternalClass body.EC_hmmessage{font-size:10pt;font-family:Verdana;}It looks like wildcards preceeding the term are even more broken than wildcards after the term. Vote up the wildcard issues I linked, and include more information about the errors you're seeing. Hopefully it'll be fixed in the next version or two. If you want to search if a full term is included, you only have to search for the term. Wildcards are used for partial terms, such as searching for ha*y returning both harry and happy as search terms. If you want to search for the term happy, just do a search for happy. The only time that will not work is in a keyword field, where it searches the entire field as if it is one term. >>> Sergio Rinaudo <[email protected]> 4/18/2009 4:11:59 AM >>> Thanks for the reply, I didn't know about those issues page. However the query I've done is still not working bacause I use two '*', before and after the term, as I want to search if the term is 'included' in a certain field of the Lucene index. Correct me if I mistake, but I think that using only one at the end of the term is like search a sentence that starts with the term. So my question is, what do I have to do if I want to search if the term is 'included' in 1.7.8? Thank you Sergio Rinaudo Date: Fri, 17 Apr 2009 08:14:45 -0500 From: [email protected] To: [email protected] Subject: Re: [fw-general] Zend_Search_Lucene_Search_Query_Wildcard working with zf 1.7.0 but not with 1.7.7+ .ExternalClass .EC_hmmessage P{padding:0px;}.ExternalClass body.EC_hmmessage{font-size:10pt;font-family:Verdana;}I had the same problem when upgrading from 1.6.8 to 1.7.8. Each term needs to have at least 3 characters alongside the wild card in order to work. So the search "ha*" will fail, but "har*" works fine. The easiest work around is to just make sure each term with a wildcard in it has at least 3 characters. There are a few bug reports in the issue tracker already related to this: http://framework.zend.com/issues/browse/ZF-6290 http://framework.zend.com/issues/browse/ZF-4653 >>> Sergio Rinaudo <[email protected]> 4/15/2009 3:10:16 PM >>> Hello, hope anybody could help with the Search Lucene component. This code: $request = $this->getRequest(); $params = $request->getParams(); $c = isset($params['c']) ? $params['c'] : ''; $term = new Zend_Search_Lucene_Index_Term('*'.$c.'*','categories_url'); $query = new Zend_Search_Lucene_Search_Query_Wildcard($term); $results = $index->find($query,'dateCreated',SORT_REGULAR,SORT_DESC); works with zf 1.7.0 but NOT with zf 1.7.7 and 1.7.8, andI get this exception: exception 'Zend_Search_Lucene_Exception' with message 'At least 3 non-wildcard terms are required.' I've read the documentation http://framework.zend.com/manual/en/zend.search.lucene.query-api.html but I were unable to find where is specified about the 3 non-wildcard terms required. I appreciate any suggestion. Thanks. Sergio Rinaudo Il remix esclusivo di Messenger. Scaricalo gratis! Dillo con le Emoticon! Scarica il nuovo Messenger 2009 Il remix esclusivo di Messenger. Scaricalo gratis! 25 GB di spazio gratuito su Internet! Prova SkyDrive 25 GB di spazio gratuito su Internet! Prova SkyDrive
