lucene-lucene-net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicolas Brel" <nicolas.b...@gmail.com>
Subject Re: Leading wildcard in Lucene.Net 1.9?
Date Thu, 13 Jul 2006 14:35:36 GMT
Indeed, this approach only works if you're not using trailng and leading
wildcards together.
There is also WildcardQuery class but there is a performance issue when
using leading wildcards:
"Supported wildcards are  * which matches any character sequence (including
the empty one), and ?, which matches any single character. Note this query
can be slow, as it needs to iterate over many terms. In order to prevent
extremely slow WildcardQueries, a Wildcard term should not start with one of
the wildcards * or ? "


On 7/13/06, Nathan Haywood <nathanh@cormine.com> wrote:
>
> I thought about using the reversed field approach, but I don't believe
> that really works. Here's an example (our system is a product catalog
> for industrial and manufacturing clients)...
>
> User searches for: phillip driver
> We assume he means: +*phillip* +*driver*
> Item description contains: set of six phillips screwdrivers
> Reversed description: srevirdwercs spillihp xis fo tes
>
> Item *should* show as a hit
>
> Boolean = +(Desc:phillip* RevDesc:pillihp*) +(Desc:driver*
> RevDesc:revird*)
>
> Desc:phillip* = true
> RevDesc:pillihp* = false
> (Desc:phillip* RevDesc:pillihp*) = true
>
> ForDesc:driver* = false
> RevDesc:revird* = false
> (Desc:driver* RevDesc:revird*) = false
>
> +(Desc:phillip* RevDesc:pillihp*) +(Desc:driver* RevDesc:revird*) =
> false
>
> Item does not show in the hits collection
>
> Has anyone gotten this to work correctly? Does anyone have any
> RegExpQuery snippets they could send me?
>
> -----Original Message-----
> From: Nicolas [mailto:nicolas.brel@gmail.com]
> Sent: Thursday, July 13, 2006 6:18 AM
> To: lucene-net-user@incubator.apache.org
> Subject: Re: Leading wildcard in Lucene.Net 1.9?
>
> As far as I know, PrefixQuery only allows trailing wildcards.
> If you intend to do so the solution I've adopted is to index the term in
> reverse order on another field.
> if you mean to search  *def and you want to match abcdef  just create 2
> fields regularField where you index a term in its natural order that is
> to say abcdef reverseField where you index a term in the refverse order
> that is to say fedcba then you'll have to transform the query
> regularField:*def  in reverseField:fed*.
> Concerning *abc*, maybe you can investigate RegExpQuery...
> Regards,
> Nicolas
>
>
>
> On 7/13/06, Nathan Haywood <nathanh@cormine.com> wrote:
> >
> > Our search instance needs to be able to search for a query as a
> > substring of a term... For example, hex (as *hex*). I looked on the
> > Lucene board and saw that there was a simple change to make to support
>
> > this in the JAVA code, but the JAVA token syntax seems to have
> > vanished into a helper class in the port.
> >
> > Has anyone enables *abc* queries in their system? Any pointers, types,
>
> > code snippets?
> >
> > Thank you,
> > Nathan Haywood
> > Senior Software Engineer
> > CorMine, LLC
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message