thatnewcoder Posted July 22, 2010 Share Posted July 22, 2010 Hi, I'm using Zend_Search_Lucene to search an index. All is fine so far, except I can't get it to do partial searches without using a wildcard (such as *). Take the string 'i am testing this'. If I use the query 'testing', it will match If I use the query 'test', it will not match. Is there a way of getting Zend_Search_Lucene to, by default, match something like that, much like MySQL where you can use LIKE '%test%'? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/208487-zend-need-help-with-lucene-index-searching/ Share on other sites More sharing options...
thehippy Posted July 23, 2010 Share Posted July 23, 2010 I have to admit I'm just an amateur when it comes to lucene, but the default analyzer/tokenizer doesn't support partial matches. I think the developers of Lucene have opted to design for performance over flexibility with many things. Partial matching is frowned upon by upstream Lucene since index trees would explode in size if it were allowed. So, you'll have to use wildcard ('test*') matching. Quote Link to comment https://forums.phpfreaks.com/topic/208487-zend-need-help-with-lucene-index-searching/#findComment-1089990 Share on other sites More sharing options...
thatnewcoder Posted July 25, 2010 Author Share Posted July 25, 2010 I was hoping the reply would be "Of course it's possible!" It's a shame it's not possible, but I understand why. Is it possible to get Lucene to automatically place wildcards in the right places? For example: 'this is the "search term"' Would make something like: '*this*is*the*"search term"' So things like quotes are taken care of, as well as anything else it supports. Possible? Quote Link to comment https://forums.phpfreaks.com/topic/208487-zend-need-help-with-lucene-index-searching/#findComment-1091052 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.