lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Quarterman" <da...@corexe.com>
Subject RE: Feature & design question: use autocomple?te to search on 2 different fields, and return 2 different data groups
Date Thu, 01 Nov 2012 13:45:55 GMT
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.

Mime
View raw message