You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by "fernando.beck" <fe...@gmail.com> on 2012/11/01 14:39:43 UTC

Feature & design question: use autocomple​te to search on 2 different fields, and return 2 different data groups

Hello,

 

 we're facing a new feature request, and we can't get the right way to come
up with a working solution. 

 

Context: we have a list of businesses . For each business we have: name,
category, address, city.
 
One business may have 1 or more categories.

 

Example:

Name: Outback SteakHouse

Category: Restaurants , American

Address: xxxxxx

City: Rio de Janeiro

  

Name: Starbucks

Category: Bar, Coffee

Address: yyyyy

City: Rio de Janeiro

 

Name:  Pizza Hut

Category: Restaurant, Pizza

Address: xxxx
 
City: New York

 

and so on.

 

What we need to do:  create an "autocomplete" feature; whenever someone
starts to type, we will need to search the term BOTH on CompanyName AND
Category.
 
Example:  I type pizz

 

and the result should be coming back in 2 groups.

Group 1: Categories  (displaying  Pizza)

Group 2:  all those businesses featuring pizza on their name , ie Pizza Hut.
 
 

Right now we can not find a way to get this done.

 

Schema (since we're running a portuguese based application, there are 2
fieldType added for it):

 


<?xml version="1.0" encoding="UTF-8" ?>
<schema name="Guia-DEV" version="1.5"> 
  <types>
    -->

    
    <fieldType name="string" class="solr.StrField" sortMissingLast="true" />
 
    
    <fieldType name="boolean" class="solr.BoolField"
sortMissingLast="true"/>
    
     <fieldtype name="binary" class="solr.BinaryField"/>


    
    <fieldType name="int" class="solr.TrieIntField" precisionStep="0"
positionIncrementGap="0"/>
    <fieldType name="float" class="solr.TrieFloatField" precisionStep="0"
positionIncrementGap="0"/>
     <fieldType name="long" class="solr.TrieLongField" precisionStep="0"
positionIncrementGap="0"/>
    <fieldType name="double" class="solr.TrieDoubleField" precisionStep="0"
positionIncrementGap="0"/>
 
   
    <fieldType name="tint" class="solr.TrieIntField" precisionStep="8"
positionIncrementGap="0"/>
    <fieldType name="tfloat" class="solr.TrieFloatField" precisionStep="8"
positionIncrementGap="0"/>
     <fieldType name="tlong" class="solr.TrieLongField" precisionStep="8"
positionIncrementGap="0"/>
    <fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8"
positionIncrementGap="0"/>
 
  
    <fieldType name="date" class="solr.TrieDateField" precisionStep="0"
positionIncrementGap="0"/>

    
     <fieldType name="tdate" class="solr.TrieDateField" precisionStep="6"
positionIncrementGap="0"/>


    <fieldType name="pint" class="solr.IntField"/>
     <fieldType name="plong" class="solr.LongField"/>
    <fieldType name="pfloat" class="solr.FloatField"/>
    <fieldType name="pdouble" class="solr.DoubleField"/>
     <fieldType name="pdate" class="solr.DateField" sortMissingLast="true"/>


   
    <fieldType name="sint" class="solr.SortableIntField"
sortMissingLast="true" omitNorms="true"/>
     <fieldType name="slong" class="solr.SortableLongField"
sortMissingLast="true" omitNorms="true"/>
    <fieldType name="sfloat" class="solr.SortableFloatField"
sortMissingLast="true" omitNorms="true"/>
     <fieldType name="sdouble" class="solr.SortableDoubleField"
sortMissingLast="true" omitNorms="true"/>


    <fieldType name="random" class="solr.RandomSortField" indexed="true" />
 

    
    <fieldType name="text_general" class="solr.TextField"
positionIncrementGap="100">
      <analyzer type="index">
        <tokenizer class="solr.StandardTokenizerFactory"/>
         <filter class="solr.StopFilterFactory" ignoreCase="true"
words="stopwords.txt" enablePositionIncrements="true" />
        
        <filter class="solr.LowerCaseFilterFactory"/>
       </analyzer>
      <analyzer type="query">
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true"
words="stopwords.txt" enablePositionIncrements="true" />
         <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"
ignoreCase="true" expand="true"/>
        <filter class="solr.LowerCaseFilterFactory"/>
       </analyzer>
    </fieldType>

        
<fieldType name="textCategoryName" class="solr.TextField"
positionIncrementGap="100">
       <analyzer type="index">
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.WordDelimiterFilterFactory"
generateWordParts="1" generateNumberParts="1" catenateWords="1"
catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
         <filter class="solr.ASCIIFoldingFilterFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
  <filter class="solr.SnowballPorterFilterFactory" language="Portuguese"/>
      </analyzer>
      <analyzer type="query">
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
         <filter class="solr.SynonymFilterFactory"
synonyms="pt_categories.txt" ignoreCase="true" expand="false"/>
        <filter class="solr.WordDelimiterFilterFactory"
generateWordParts="1" generateNumberParts="1" catenateWords="0"
catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
         <filter class="solr.ASCIIFoldingFilterFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
  <filter class="solr.SnowballPorterFilterFactory" language="Portuguese"/>
      </analyzer>
</fieldType>

   


    
     <fieldType name="lowercase" class="solr.TextField"
positionIncrementGap="100">
      <analyzer>
        <tokenizer class="solr.KeywordTokenizerFactory"/>
         <filter class="solr.LowerCaseFilterFactory" />
      </analyzer>
    </fieldType>

    <fieldType name="text_path" class="solr.TextField"
positionIncrementGap="100">
       <analyzer>
        <tokenizer class="solr.PathHierarchyTokenizerFactory"/>
      </analyzer>
    </fieldType>
    

    
    
    <fieldType name="text_pt" class="solr.TextField"
positionIncrementGap="100">
       <analyzer type="index"> 
 <charFilter class="solr.HTMLStripCharFilterFactory"/> 
        <tokenizer class="solr.StandardTokenizerFactory"/>
         <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true"
words="lang/stopwords_pt.txt" format="snowball"
enablePositionIncrements="true"/>
  <filter class="solr.ASCIIFoldingFilterFactory"/>
      </analyzer>
      <analyzer type="query">
 <charFilter class="solr.HTMLStripCharFilterFactory"/> 
         <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true"
words="lang/stopwords_pt.txt" format="snowball"
enablePositionIncrements="true"/>
  <filter class="solr.ASCIIFoldingFilterFactory"/>
      </analyzer>
    </fieldType>
</fieldType>   
  </types> 

 <fields>
   <field name="LocalBusinessId" type="int" indexed="true" stored="true"
required="true" />
    <field name="CompanyName" type="text_pt" indexed="true" stored="true" />
   <field name="LocationName" type="text_pt" indexed="true" stored="true" />
    <field name="StreetAddress" type="text_pt" indexed="true" stored="true"
/>
   <field name="City" type="text_pt" indexed="true" stored="true" />
    <field name="RelatedCategoriesKeywords" type="textCategoryName"
indexed="true" stored="true" multiValued="true" />
 </fields>

 
 <uniqueKey>LocalBusinessId</uniqueKey>
 
</schema>


 

Thanks,

 

F



--
View this message in context: http://lucene.472066.n3.nabble.com/Feature-design-question-use-autocomple-te-to-search-on-2-different-fields-and-return-2-different-dats-tp4017528.html
Sent from the Solr - User mailing list archive at Nabble.com.

RE: Feature & design question: use autocomple?te to search on 2 different fields, and return 2 different data groups

Posted by David Quarterman <da...@corexe.com>.
Fernando,

Pretty much the problem we came up against. We had a basic AC running
using SpellChecker a while ago but it was the grouping that floored us
and sent us elsewhere. Again, multiple queries seemed like the only
possible answer but in an AC scenario, even with SOLR's speed, probably
too slow under load.

Best,

DQ

-----Original Message-----
From: fernando.beck [mailto:fernando.beck@gmail.com] 
Sent: 01 November 2012 13:55
To: solr-user@lucene.apache.org
Subject: RE: Feature & design question: use autocomple?te to search on 2
different fields, and return 2 different data groups

David,

 appreciate the suggestion.  Our current autocomplete feature is
actually working pretty good.
No perfomance issues; functionally is providing 100% results as
expected.
I checked sematext and also http://www.cominvent.com; they are great,
and our budget to go get them is 0.

At this time, and given the presented schema, my question would be: is
even possible to get it done somehow? with 1 query, and "group" those
results while autocompleting on 2 different search fields?



--
View this message in context:
http://lucene.472066.n3.nabble.com/Feature-design-question-use-autocompl
e-te-to-search-on-2-different-fields-and-return-2-different-dats-tp40175
28p4017534.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Feature & design question: use autocomple?te to search on 2 different fields, and return 2 different data groups

Posted by "fernando.beck" <fe...@gmail.com>.
Otis, you are right: think + dev + try + test + keep iterating until it
works.
We've come up with a different approach: change the way we're thinking the
schema.

Until now we have 1 document per "business" and each business is related to
one category.

Instead, we can think that each document could be either a business OR a
category, and we could add a "docType" field.

Going this way, we'll be able to easily autocomplete on the common "name"
field , which may have either a CompanyName or a CategoryName, and group by
docType (where 1=company and 2=category).

Does that make any sense?


On Thu, Nov 1, 2012 at 6:02 PM, Otis Gospodnetic-5 [via Lucene] <
ml-node+s472066n4017663h49@n3.nabble.com> wrote:

> Hi,
>
> On Thu, Nov 1, 2012 at 9:54 AM, fernando.beck <[hidden email]<http://user/SendEmail.jtp?type=node&node=4017663&i=0>>wrote:
>
>
> > David,
> >
> >  appreciate the suggestion.  Our current autocomplete feature is
> actually
> > working pretty good.
> > No perfomance issues; functionally is providing 100% results as
> expected.
> > I checked sematext and also http://www.cominvent.com; they are great,
> and
> > our budget to go get them is 0.
> >
>
> Not really, if you count the research, dev, troubleshoot, debug, etc.
> time.
> :)
>
>
> > At this time, and given the presented schema, my question would be: is
> even
> > possible to get it done somehow? with 1 query, and "group" those results
> > while autocompleting on 2 different search fields?
> >
>
> Hm, I checked http://wiki.apache.org/solr/FieldCollapsing to see if that
> could help, but it looks like grouping can be done on just 1 field.
> Maybe group.query could be used?
>
> Otis
> --
> Search Analytics - http://sematext.com/search-analytics/index.html
> Performance Monitoring - http://sematext.com/spm/index.html
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://lucene.472066.n3.nabble.com/Feature-design-question-use-autocomple-te-to-search-on-2-different-fields-and-return-2-different-dats-tp4017528p4017663.html
>  To unsubscribe from Feature & design question: use autocomplete to
> search on 2 different fields, and return 2 different data groups, click
> here<http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4017528&code=ZmVybmFuZG8uYmVja0BnbWFpbC5jb218NDAxNzUyOHwxNjU3NTg0NzQx>
> .
> NAML<http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://lucene.472066.n3.nabble.com/Feature-design-question-use-autocomple-te-to-search-on-2-different-fields-and-return-2-different-dats-tp4017528p4017674.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Feature & design question: use autocomple?te to search on 2 different fields, and return 2 different data groups

Posted by Otis Gospodnetic <ot...@gmail.com>.
Hi,

On Thu, Nov 1, 2012 at 9:54 AM, fernando.beck <fe...@gmail.com>wrote:

> David,
>
>  appreciate the suggestion.  Our current autocomplete feature is actually
> working pretty good.
> No perfomance issues; functionally is providing 100% results as expected.
> I checked sematext and also http://www.cominvent.com; they are great, and
> our budget to go get them is 0.
>

Not really, if you count the research, dev, troubleshoot, debug, etc. time.
:)


> At this time, and given the presented schema, my question would be: is even
> possible to get it done somehow? with 1 query, and "group" those results
> while autocompleting on 2 different search fields?
>

Hm, I checked http://wiki.apache.org/solr/FieldCollapsing to see if that
could help, but it looks like grouping can be done on just 1 field.
Maybe group.query could be used?

Otis
-- 
Search Analytics - http://sematext.com/search-analytics/index.html
Performance Monitoring - http://sematext.com/spm/index.html

RE: Feature & design question: use autocomple?te to search on 2 different fields, and return 2 different data groups

Posted by "fernando.beck" <fe...@gmail.com>.
David,

 appreciate the suggestion.  Our current autocomplete feature is actually
working pretty good.
No perfomance issues; functionally is providing 100% results as expected.
I checked sematext and also http://www.cominvent.com; they are great, and
our budget to go get them is 0.

At this time, and given the presented schema, my question would be: is even
possible to get it done somehow? with 1 query, and "group" those results
while autocompleting on 2 different search fields?



--
View this message in context: http://lucene.472066.n3.nabble.com/Feature-design-question-use-autocomple-te-to-search-on-2-different-fields-and-return-2-different-dats-tp4017528p4017534.html
Sent from the Solr - User mailing list archive at Nabble.com.

RE: Feature & design question: use autocomple?te to search on 2 different fields, and return 2 different data groups

Posted by David Quarterman <da...@corexe.com>.
We had a similar requirement and found the best solution (unfortunately)
was to spend a small amount of money. Have a look at Sematext's site
(www.sematext.com). Their Autocomplete is awesome and we have a
fantastic looking AC now on our development site, grouped by category,
product & brand with product pictures to boot!

It's very, very quick in operation too.

Best,

DQ

-----Original Message-----
From: fernando.beck [mailto:fernando.beck@gmail.com] 
Sent: 01 November 2012 13:40
To: solr-user@lucene.apache.org
Subject: Feature & design question: use autocomple?te to search on 2
different fields, and return 2 different data groups

Hello,

 

 we're facing a new feature request, and we can't get the right way to
come up with a working solution. 

 

Context: we have a list of businesses . For each business we have: name,
category, address, city.
 
One business may have 1 or more categories.

 

Example:

Name: Outback SteakHouse

Category: Restaurants , American

Address: xxxxxx

City: Rio de Janeiro

  

Name: Starbucks

Category: Bar, Coffee

Address: yyyyy

City: Rio de Janeiro

 

Name:  Pizza Hut

Category: Restaurant, Pizza

Address: xxxx
 
City: New York

 

and so on.

 

What we need to do:  create an "autocomplete" feature; whenever someone
starts to type, we will need to search the term BOTH on CompanyName AND
Category.
 
Example:  I type pizz

 

and the result should be coming back in 2 groups.

Group 1: Categories  (displaying  Pizza)

Group 2:  all those businesses featuring pizza on their name , ie Pizza
Hut.
 
 

Right now we can not find a way to get this done.

 

Schema (since we're running a portuguese based application, there are 2
fieldType added for it):

 


<?xml version="1.0" encoding="UTF-8" ?>
<schema name="Guia-DEV" version="1.5">
  <types>
    -->

    
    <fieldType name="string" class="solr.StrField"
sortMissingLast="true" />
 
    
    <fieldType name="boolean" class="solr.BoolField"
sortMissingLast="true"/>
    
     <fieldtype name="binary" class="solr.BinaryField"/>


    
    <fieldType name="int" class="solr.TrieIntField" precisionStep="0"
positionIncrementGap="0"/>
    <fieldType name="float" class="solr.TrieFloatField"
precisionStep="0"
positionIncrementGap="0"/>
     <fieldType name="long" class="solr.TrieLongField" precisionStep="0"
positionIncrementGap="0"/>
    <fieldType name="double" class="solr.TrieDoubleField"
precisionStep="0"
positionIncrementGap="0"/>
 
   
    <fieldType name="tint" class="solr.TrieIntField" precisionStep="8"
positionIncrementGap="0"/>
    <fieldType name="tfloat" class="solr.TrieFloatField"
precisionStep="8"
positionIncrementGap="0"/>
     <fieldType name="tlong" class="solr.TrieLongField"
precisionStep="8"
positionIncrementGap="0"/>
    <fieldType name="tdouble" class="solr.TrieDoubleField"
precisionStep="8"
positionIncrementGap="0"/>
 
  
    <fieldType name="date" class="solr.TrieDateField" precisionStep="0"
positionIncrementGap="0"/>

    
     <fieldType name="tdate" class="solr.TrieDateField"
precisionStep="6"
positionIncrementGap="0"/>


    <fieldType name="pint" class="solr.IntField"/>
     <fieldType name="plong" class="solr.LongField"/>
    <fieldType name="pfloat" class="solr.FloatField"/>
    <fieldType name="pdouble" class="solr.DoubleField"/>
     <fieldType name="pdate" class="solr.DateField"
sortMissingLast="true"/>


   
    <fieldType name="sint" class="solr.SortableIntField"
sortMissingLast="true" omitNorms="true"/>
     <fieldType name="slong" class="solr.SortableLongField"
sortMissingLast="true" omitNorms="true"/>
    <fieldType name="sfloat" class="solr.SortableFloatField"
sortMissingLast="true" omitNorms="true"/>
     <fieldType name="sdouble" class="solr.SortableDoubleField"
sortMissingLast="true" omitNorms="true"/>


    <fieldType name="random" class="solr.RandomSortField" indexed="true"
/>
 

    
    <fieldType name="text_general" class="solr.TextField"
positionIncrementGap="100">
      <analyzer type="index">
        <tokenizer class="solr.StandardTokenizerFactory"/>
         <filter class="solr.StopFilterFactory" ignoreCase="true"
words="stopwords.txt" enablePositionIncrements="true" />
        
        <filter class="solr.LowerCaseFilterFactory"/>
       </analyzer>
      <analyzer type="query">
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true"
words="stopwords.txt" enablePositionIncrements="true" />
         <filter class="solr.SynonymFilterFactory"
synonyms="synonyms.txt"
ignoreCase="true" expand="true"/>
        <filter class="solr.LowerCaseFilterFactory"/>
       </analyzer>
    </fieldType>

        
<fieldType name="textCategoryName" class="solr.TextField"
positionIncrementGap="100">
       <analyzer type="index">
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.WordDelimiterFilterFactory"
generateWordParts="1" generateNumberParts="1" catenateWords="1"
catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
         <filter class="solr.ASCIIFoldingFilterFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
  <filter class="solr.SnowballPorterFilterFactory"
language="Portuguese"/>
      </analyzer>
      <analyzer type="query">
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
         <filter class="solr.SynonymFilterFactory"
synonyms="pt_categories.txt" ignoreCase="true" expand="false"/>
        <filter class="solr.WordDelimiterFilterFactory"
generateWordParts="1" generateNumberParts="1" catenateWords="0"
catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
         <filter class="solr.ASCIIFoldingFilterFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
  <filter class="solr.SnowballPorterFilterFactory"
language="Portuguese"/>
      </analyzer>
</fieldType>

   


    
     <fieldType name="lowercase" class="solr.TextField"
positionIncrementGap="100">
      <analyzer>
        <tokenizer class="solr.KeywordTokenizerFactory"/>
         <filter class="solr.LowerCaseFilterFactory" />
      </analyzer>
    </fieldType>

    <fieldType name="text_path" class="solr.TextField"
positionIncrementGap="100">
       <analyzer>
        <tokenizer class="solr.PathHierarchyTokenizerFactory"/>
      </analyzer>
    </fieldType>
    

    
    
    <fieldType name="text_pt" class="solr.TextField"
positionIncrementGap="100">
       <analyzer type="index">
 <charFilter class="solr.HTMLStripCharFilterFactory"/> 
        <tokenizer class="solr.StandardTokenizerFactory"/>
         <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true"
words="lang/stopwords_pt.txt" format="snowball"
enablePositionIncrements="true"/>
  <filter class="solr.ASCIIFoldingFilterFactory"/>
      </analyzer>
      <analyzer type="query">
 <charFilter class="solr.HTMLStripCharFilterFactory"/> 
         <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true"
words="lang/stopwords_pt.txt" format="snowball"
enablePositionIncrements="true"/>
  <filter class="solr.ASCIIFoldingFilterFactory"/>
      </analyzer>
    </fieldType>
</fieldType>   
  </types> 

 <fields>
   <field name="LocalBusinessId" type="int" indexed="true" stored="true"
required="true" />
    <field name="CompanyName" type="text_pt" indexed="true"
stored="true" />
   <field name="LocationName" type="text_pt" indexed="true"
stored="true" />
    <field name="StreetAddress" type="text_pt" indexed="true"
stored="true"
/>
   <field name="City" type="text_pt" indexed="true" stored="true" />
    <field name="RelatedCategoriesKeywords" type="textCategoryName"
indexed="true" stored="true" multiValued="true" />  </fields>

 
 <uniqueKey>LocalBusinessId</uniqueKey>
 
</schema>


 

Thanks,

 

F



--
View this message in context:
http://lucene.472066.n3.nabble.com/Feature-design-question-use-autocompl
e-te-to-search-on-2-different-fields-and-return-2-different-dats-tp40175
28.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Feature & design question: use autocomplete to search on 2 different fields, and return 2 different data groups

Posted by Erick Erickson <er...@gmail.com>.
You might be able to do something like append "tags" to the suggestions.
So, you'd actually index
pizza:cat
pizza hut:business

Then you app gets these back and can display them however is most pleasing
to the user.

But.... consider that all autosuggest is doing is searching the indexed
terms. So here in michigan we have "Cottage Inn Pizza". Since it doesn't
start with "pizza", it wouldn't be returned when doing an autosuggest on
"piz". You'd have to do something like index this "pizza cottage
inn:business:Cottage Inn Pizza" in order to get back something sensible to
display....

If your speed is sufficient, you could always to a straight Solr query and
use grouping. In that case you'd have to do something like index a field
"suggest_type" and group on that field. But this may be too slow....

Best
Erick


On Thu, Nov 1, 2012 at 9:39 AM, fernando.beck <fe...@gmail.com>wrote:

> Hello,
>
>
>
>  we're facing a new feature request, and we can't get the right way to come
> up with a working solution.
>
>
>
> Context: we have a list of businesses . For each business we have: name,
> category, address, city.
>
> One business may have 1 or more categories.
>
>
>
> Example:
>
> Name: Outback SteakHouse
>
> Category: Restaurants , American
>
> Address: xxxxxx
>
> City: Rio de Janeiro
>
>
>
> Name: Starbucks
>
> Category: Bar, Coffee
>
> Address: yyyyy
>
> City: Rio de Janeiro
>
>
>
> Name:  Pizza Hut
>
> Category: Restaurant, Pizza
>
> Address: xxxx
>
> City: New York
>
>
>
> and so on.
>
>
>
> What we need to do:  create an "autocomplete" feature; whenever someone
> starts to type, we will need to search the term BOTH on CompanyName AND
> Category.
>
> Example:  I type pizz
>
>
>
> and the result should be coming back in 2 groups.
>
> Group 1: Categories  (displaying  Pizza)
>
> Group 2:  all those businesses featuring pizza on their name , ie Pizza
> Hut.
>
>
>
> Right now we can not find a way to get this done.
>
>
>
> Schema (since we're running a portuguese based application, there are 2
> fieldType added for it):
>
>
>
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <schema name="Guia-DEV" version="1.5">
>   <types>
>     -->
>
>
>     <fieldType name="string" class="solr.StrField" sortMissingLast="true"
> />
>
>
>     <fieldType name="boolean" class="solr.BoolField"
> sortMissingLast="true"/>
>
>      <fieldtype name="binary" class="solr.BinaryField"/>
>
>
>
>     <fieldType name="int" class="solr.TrieIntField" precisionStep="0"
> positionIncrementGap="0"/>
>     <fieldType name="float" class="solr.TrieFloatField" precisionStep="0"
> positionIncrementGap="0"/>
>      <fieldType name="long" class="solr.TrieLongField" precisionStep="0"
> positionIncrementGap="0"/>
>     <fieldType name="double" class="solr.TrieDoubleField" precisionStep="0"
> positionIncrementGap="0"/>
>
>
>     <fieldType name="tint" class="solr.TrieIntField" precisionStep="8"
> positionIncrementGap="0"/>
>     <fieldType name="tfloat" class="solr.TrieFloatField" precisionStep="8"
> positionIncrementGap="0"/>
>      <fieldType name="tlong" class="solr.TrieLongField" precisionStep="8"
> positionIncrementGap="0"/>
>     <fieldType name="tdouble" class="solr.TrieDoubleField"
> precisionStep="8"
> positionIncrementGap="0"/>
>
>
>     <fieldType name="date" class="solr.TrieDateField" precisionStep="0"
> positionIncrementGap="0"/>
>
>
>      <fieldType name="tdate" class="solr.TrieDateField" precisionStep="6"
> positionIncrementGap="0"/>
>
>
>     <fieldType name="pint" class="solr.IntField"/>
>      <fieldType name="plong" class="solr.LongField"/>
>     <fieldType name="pfloat" class="solr.FloatField"/>
>     <fieldType name="pdouble" class="solr.DoubleField"/>
>      <fieldType name="pdate" class="solr.DateField"
> sortMissingLast="true"/>
>
>
>
>     <fieldType name="sint" class="solr.SortableIntField"
> sortMissingLast="true" omitNorms="true"/>
>      <fieldType name="slong" class="solr.SortableLongField"
> sortMissingLast="true" omitNorms="true"/>
>     <fieldType name="sfloat" class="solr.SortableFloatField"
> sortMissingLast="true" omitNorms="true"/>
>      <fieldType name="sdouble" class="solr.SortableDoubleField"
> sortMissingLast="true" omitNorms="true"/>
>
>
>     <fieldType name="random" class="solr.RandomSortField" indexed="true" />
>
>
>
>     <fieldType name="text_general" class="solr.TextField"
> positionIncrementGap="100">
>       <analyzer type="index">
>         <tokenizer class="solr.StandardTokenizerFactory"/>
>          <filter class="solr.StopFilterFactory" ignoreCase="true"
> words="stopwords.txt" enablePositionIncrements="true" />
>
>         <filter class="solr.LowerCaseFilterFactory"/>
>        </analyzer>
>       <analyzer type="query">
>         <tokenizer class="solr.StandardTokenizerFactory"/>
>         <filter class="solr.StopFilterFactory" ignoreCase="true"
> words="stopwords.txt" enablePositionIncrements="true" />
>          <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"
> ignoreCase="true" expand="true"/>
>         <filter class="solr.LowerCaseFilterFactory"/>
>        </analyzer>
>     </fieldType>
>
>
> <fieldType name="textCategoryName" class="solr.TextField"
> positionIncrementGap="100">
>        <analyzer type="index">
>         <tokenizer class="solr.WhitespaceTokenizerFactory"/>
>         <filter class="solr.WordDelimiterFilterFactory"
> generateWordParts="1" generateNumberParts="1" catenateWords="1"
> catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
>          <filter class="solr.ASCIIFoldingFilterFactory"/>
>         <filter class="solr.LowerCaseFilterFactory"/>
>         <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
>   <filter class="solr.SnowballPorterFilterFactory" language="Portuguese"/>
>       </analyzer>
>       <analyzer type="query">
>         <tokenizer class="solr.WhitespaceTokenizerFactory"/>
>          <filter class="solr.SynonymFilterFactory"
> synonyms="pt_categories.txt" ignoreCase="true" expand="false"/>
>         <filter class="solr.WordDelimiterFilterFactory"
> generateWordParts="1" generateNumberParts="1" catenateWords="0"
> catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
>          <filter class="solr.ASCIIFoldingFilterFactory"/>
>         <filter class="solr.LowerCaseFilterFactory"/>
>         <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
>   <filter class="solr.SnowballPorterFilterFactory" language="Portuguese"/>
>       </analyzer>
> </fieldType>
>
>
>
>
>
>      <fieldType name="lowercase" class="solr.TextField"
> positionIncrementGap="100">
>       <analyzer>
>         <tokenizer class="solr.KeywordTokenizerFactory"/>
>          <filter class="solr.LowerCaseFilterFactory" />
>       </analyzer>
>     </fieldType>
>
>     <fieldType name="text_path" class="solr.TextField"
> positionIncrementGap="100">
>        <analyzer>
>         <tokenizer class="solr.PathHierarchyTokenizerFactory"/>
>       </analyzer>
>     </fieldType>
>
>
>
>
>     <fieldType name="text_pt" class="solr.TextField"
> positionIncrementGap="100">
>        <analyzer type="index">
>  <charFilter class="solr.HTMLStripCharFilterFactory"/>
>         <tokenizer class="solr.StandardTokenizerFactory"/>
>          <filter class="solr.LowerCaseFilterFactory"/>
>         <filter class="solr.StopFilterFactory" ignoreCase="true"
> words="lang/stopwords_pt.txt" format="snowball"
> enablePositionIncrements="true"/>
>   <filter class="solr.ASCIIFoldingFilterFactory"/>
>       </analyzer>
>       <analyzer type="query">
>  <charFilter class="solr.HTMLStripCharFilterFactory"/>
>          <tokenizer class="solr.StandardTokenizerFactory"/>
>         <filter class="solr.LowerCaseFilterFactory"/>
>         <filter class="solr.StopFilterFactory" ignoreCase="true"
> words="lang/stopwords_pt.txt" format="snowball"
> enablePositionIncrements="true"/>
>   <filter class="solr.ASCIIFoldingFilterFactory"/>
>       </analyzer>
>     </fieldType>
> </fieldType>
>   </types>
>
>  <fields>
>    <field name="LocalBusinessId" type="int" indexed="true" stored="true"
> required="true" />
>     <field name="CompanyName" type="text_pt" indexed="true" stored="true"
> />
>    <field name="LocationName" type="text_pt" indexed="true" stored="true"
> />
>     <field name="StreetAddress" type="text_pt" indexed="true" stored="true"
> />
>    <field name="City" type="text_pt" indexed="true" stored="true" />
>     <field name="RelatedCategoriesKeywords" type="textCategoryName"
> indexed="true" stored="true" multiValued="true" />
>  </fields>
>
>
>  <uniqueKey>LocalBusinessId</uniqueKey>
>
> </schema>
>
>
>
>
> Thanks,
>
>
>
> F
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Feature-design-question-use-autocomple-te-to-search-on-2-different-fields-and-return-2-different-dats-tp4017528.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>