lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: Substring search and Sorting
Date Sat, 22 Nov 2003 15:17:18 GMT
This has been sitting in my draft mails for a while... did I send this 
already?

On Sunday, November 16, 2003, at 09:03  PM, Trevor Lee wrote:
> The two questions i have are:
> 1. How do i do substring searches in Lucene?. ie. a search for "heat" 
> will
> return "theatre".
> I don't have that much exposure to lucene and would prefer not to 
> change too
> much code.

Through the API, you'd use a WildcardQuery with the term value 
"*heat*".  If you are using QueryParser, though, wildcard prefixes are 
not allowed.

Depending on what you're after here and whether "substring" searches 
are the norm rather than an exception, you maybe should consider using 
some different analysis techniques to tokenize things on how you search 
for them.

> 2. I've downloaded the searchbean in the sandbox as well but when i 
> compile
> the HitsIterator class i get the following error message:
> The method id(int) is undefined for the type Hits.
> The method that generates this error is sortByField():
> :
> :
>         long first = System.currentTimeMillis();
>         for (int i=0; i<hitsCollection.length(); i++) {
>             int id = hitsCollection.id(i);
>             arrayOfIndividualHits[i] = new IndividualHit(i,
> sf.getFieldValue(id), hitsCollection.score(i));
>         }
> :

I haven't touched SearchBean in a while either, but I do recall having 
to fix compile errors when I last did.  Feel free to submit fixes for 
it, and I will be revisiting it in the very near future too and will 
certainly bring it back up to speed when I do.

	Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


Mime
View raw message