Hi,

I don't think that the suggester can output multiple fields. You would have to 
encode your data in a special way with separators.

Using the separate Solr core approach, you may return whatever fields you 
choose to the suggest Ajax component.
I've written up a blog post and uploaded an example to GitHub. See 
http://www.cominvent.com/2012/01/25/super-flexible-autocomplete-with-solr/

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com
Solr Training - www.solrtraining.com

On 3. jan. 2012, at 20:41, Dave wrote:

> I've got another question for anyone that might have some insight - how do
> you get all of your indexed information along with the suggestions? i.e. if
> each suggestion has an ID# associated with it, do I have to then query for
> that ID#, or is there some way or specifying a field list in the URL to the
> suggester?
> 
> Thanks!
> Dave
> 
> On Tue, Jan 3, 2012 at 9:41 AM, Dave <dla...@gmail.com> wrote:
> 
>> Hi Jan,
>> 
>> Yes, I just saw the answer. I've implemented that, and it's working as
>> expected. I do have Suggest running on its own core, separate from my
>> standard search handler. I think, however, that the custom QueryConverter
>> that was linked to is now too restrictive. For example, it works perfectly
>> when someone enters "brooklyn, n", but if they start by entering "ny" or
>> "new york" it doesn't return anything. I think what you're talking about,
>> suggesting from whole input and individual tokens is the way to go. Is
>> there anything you can point me to as a starting point? I think I've got
>> the basic setup, but I'm not quite comfortable enough with SOLR and the
>> SOLR architecture yet (honestly I've only been using it for about 2 weeks
>> now).
>> 
>> Thanks for the help!
>> 
>> Dave
>> 
>> 
>> On Tue, Jan 3, 2012 at 8:24 AM, Jan Høydahl <jan....@cominvent.com> wrote:
>> 
>>> Hi,
>>> 
>>> As you see, you've got an answer at StackOverflow already with a proposed
>>> solution to implement your own QueryConverter.
>>> 
>>> Another way is to create a Solr core solely for Suggest, and tune it
>>> exactly the way you like. Then you can have it suggest from the whole input
>>> as well as individual tokens and weigh these as you choose, as well as
>>> implement phonetic normalization and other useful tricks.
>>> 
>>> --
>>> Jan Høydahl, search solution architect
>>> Cominvent AS - www.cominvent.com
>>> Solr Training - www.solrtraining.com
>>> 
>>> On 3. jan. 2012, at 00:52, Dave wrote:
>>> 
>>>> Hi,
>>>> 
>>>> I'm reposting my StackOverflow question to this thread as I'm not
>>> getting
>>>> much of a response there. Thank you for any assistance you can provide!
>>>> 
>>>> 
>>> http://stackoverflow.com/questions/8705600/using-solr-autocomplete-for-addresses
>>>> 
>>>> I'm new to SOLR, but I've got it up and running, indexing data via the
>>> DIH,
>>>> and properly returning results for queries. I'm trying to setup another
>>>> core to run suggester, in order to autocomplete geographical locations.
>>> We
>>>> have a web application that needs to take a city, state / region,
>>> country
>>>> input. We'd like to do this in a single entry box. Here are some
>>> examples:
>>>> 
>>>> Brooklyn, New York, United States of America
>>>> Philadelphia, Pennsylvania, United States of America
>>>> Barcelona, Catalunya, Spain
>>>> 
>>>> Assume for now that every location around the world can be split into
>>> this
>>>> 3-form input. I've setup my DIH to create a TemplateTransformer field
>>> that
>>>> combines the 4 tables (city, state and country are all independent
>>> tables
>>>> connected to each other by a master places table) into a field called
>>>> "fullplacename":
>>>> 
>>>> <field column="fullplacename" template="${city_join.plainname},
>>>> ${region_join.plainname}, ${country_join.plainname}"/>
>>>> 
>>>> I've defined a "text_auto" field in schema.xml:
>>>> 
>>>> <fieldType class="solr.TextField" name="text_auto">
>>>>   <analyzer>
>>>>       <tokenizer class="solr.KeywordTokenizerFactory"/>
>>>>       <filter class="solr.LowerCaseFilterFactory"/>
>>>>   </analyzer>
>>>> </fieldType>
>>>> 
>>>> and have defined these two fields as well:
>>>> 
>>>> <field name="name_autocomplete" type="text_auto" indexed="true"
>>>> stored="true" multiValued="true" />
>>>> <copyField source="fullplacename" dest="name_autocomplete" />
>>>> 
>>>> Now, here's my problem. This works fine for the first term, i.e. if I
>>> type
>>>> "brooklyn" I get the results I'd expect, using this URL to query:
>>>> 
>>>> http://localhost:8983/solr/places/suggest?q=brooklyn
>>>> 
>>>> However, as soon as I put a comma and/or a space in there, it breaks
>>> them
>>>> up into 2 suggestions, and I get a suggestion for each:
>>>> 
>>>> http://localhost:8983/solr/places/suggest?q=brooklyn%2C%20ny
>>>> 
>>>> Gives me a suggestion for "brooklyn" and a suggestion for "ny" instead
>>> of a
>>>> suggestion that matches "brooklyn, ny". I've tried every solution I can
>>>> find via google and haven't had any luck. Is there something simple that
>>>> I've missed, or is this the wrong approach?
>>>> 
>>>> Just in case, here's the searchComponent and requestHandler definition:
>>>> 
>>>> <requestHandler name="/suggest"
>>>> class="org.apache.solr.handler.component.SearchHandler">
>>>>   <lst name="defaults">
>>>>       <str name="spellcheck">true</str>
>>>>       <str name="spellcheck.dictionary">suggest</str>
>>>>       <str name="spellcheck.count">10</str>
>>>>   </lst>
>>>>   <arr name="components">
>>>>       <str>suggest</str>
>>>>   </arr>
>>>> </requestHandler>
>>>> 
>>>> <searchComponent name="suggest" class="solr.SpellCheckComponent">
>>>>   <lst name="spellchecker">
>>>>       <str name="name">suggest</str>
>>>>       <str
>>> name="classname">org.apache.solr.spelling.suggest.Suggester</str>
>>>>       <str
>>> name="lookupImpl">org.apache.solr.spelling.suggest.tst.TSTLookup</str>
>>>>       <str name="field">name_autocomplete</str>`<br/>
>>>>   </lst>
>>>> </searchComponent>
>>>> 
>>>> Thanks for any assistance!
>>> 
>>> 
>> 

Reply via email to