Jump to content

Zend: Need help with Lucene index searching


thatnewcoder

Recommended Posts

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!

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.

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.