stan.ieugen at gmail
Jan 24, 2012, 12:34 PM
Post #2 of 2
2012/1/24 nuessler <shane.nuessler [at] canberra>:
> Hi all,
> I'm new to Lucene and would like to know the query to find "2012" in
> "1/01/2012 0:00"?
> I'm a user of Equella, a learning object repository, and it uses Lucene as
> it's search engine. I need to find objects from a particular year. The year
> field is a text field (could have been a date field but long story).
> At the moment we build a query like this due to wildcard at start of query
> Query: WHERE Year LIKE "1*2012* OR 2*2012* OR 3*2012* ......... OR
> I want to search for *2012* but cannot because this feature is disabled as
> per default.
> How do other Lucene users find anything with e.g. "hat" in the text without
> know the first character?
> Thanks for any help out there.
> View this message in context: http://lucene.472066.n3.nabble.com/finding-2012-in-1-01-2012-0-00-tp3683433p3683433.html
> Sent from the Lucene - General mailing list archive at Nabble.com.
I can't give you an exact solution but you have to use a parser that
understand the date and index it properly.
For the second part, If you wish to find hat in words like "ahate",
then the only way to do this is to use word N-grams and also index the
reverse of the word also with N-grams:
For "ahate" you get:
1-gram: a, h, t, e
3-gram: aha, hat,ate
1-grame: -the same as above-
2-grame: et, ta,ah,ha,
When a user searches with double wildcard you will search for the word
and also it's reveres.
Warning: This will increase your index size considerably !!!!!!! You
can avoid this if you are interested only in dates and enable n-grams
only for the date part, if you can figure it out at parsing time.
For more details about this please read the chapters in
Ioan Eugen Stan