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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.