Thanks for this suggestion (thanks Gerald also: no, we're not using 
BlackLight-type prefixes).

I've set up an edgytext fieldType in schema.xml thus -

<fieldType name="edgytext" class="solr.TextField" positionIncrementGap="100">
 <analyzer type="index">
   <tokenizer class="solr.KeywordTokenizerFactory"/>
   <filter class="solr.LowerCaseFilterFactory"/>
   <filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="25" 
/>
 </analyzer>
 <analyzer type="query">
   <tokenizer class="solr.KeywordTokenizerFactory"/>
   <filter class="solr.LowerCaseFilterFactory"/>
 </analyzer>
</fieldType>

And defined a field name thus -

<dynamicField name="*author_mt"  type="edgytext"    indexed="true"  
stored="true" multiValued="true"/>

The results are mixed -

* searches such as "surname, f" and "surname, fre" (with quotations and commas) 
work well, retrieving "surname, f", "surname, Fred", "surname, Frederick" etc 
etc
* searches such as the above but without quotations don't work too well as they 
get parsed as author_mt:surname + author_mt:firstname, with solr reading the 
query as "author beginning with surname AND author beginning with firstname", 
which yields nil results. 

Is there an analyser that will strip the whitespace out altogether? Or another 
alternative?

bern

-----Original Message-----
From: Avlesh Singh [mailto:avl...@gmail.com] 
Sent: Monday, 26 October 2009 6:32 PM
To: solr-user@lucene.apache.org
Subject: Re: "begins with" searches

Read up of setting-up these kind searches here -
http://www.lucidimagination.com/blog/2009/09/08/auto-suggest-from-popular-queries-using-edgengrams/

Cheers
Avlesh

On Mon, Oct 26, 2009 at 7:43 AM, Bernadette Houghton <
bernadette.hough...@deakin.edu.au> wrote:

> We need to offer "begins with" type searches, e.g. a search for "surname,
> f" will retrieve "surname, firstname", "surname, f", "surname fm" etc.
>
> Ideally, the user would be able to enter something like "surname f*".
>
> However, wildcards don't work on phrase searches, nor do range searches.
>
> Any suggestions as to how best to search for "begins with" phrases; or, how
> to best configure solr to support such searches?
>
> TIA
> Bernadette Houghton, Library Business Applications Developer
> Deakin University Geelong Victoria 3217 Australia.
> Phone: 03 5227 8230 International: +61 3 5227 8230
> Fax: 03 5227 8000 International: +61 3 5227 8000
> MSN: bern_hough...@hotmail.com
> Email: bernadette.hough...@deakin.edu.au<mailto:
> bernadette.hough...@deakin.edu.au>
> Website: http://www.deakin.edu.au
> <http://www.deakin.edu.au/>Deakin University CRICOS Provider Code 00113B
> (Vic)
>
> Important Notice: The contents of this email are intended solely for the
> named addressee and are confidential; any unauthorised use, reproduction or
> storage of the contents is expressly prohibited. If you have received this
> email in error, please delete it and any attachments immediately and advise
> the sender by return email or telephone.
> Deakin University does not warrant that this email and any attachments are
> error or virus free
>
>

Reply via email to