lucene-solr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ryan McKinley (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (SOLR-357) Prefixing Filter Factory -- for 'suggest'
Date Tue, 18 Sep 2007 00:46:55 GMT

     [ https://issues.apache.org/jira/browse/SOLR-357?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Ryan McKinley resolved SOLR-357.
--------------------------------

    Resolution: Invalid

Yes, this is a subset of EdgeNGramFilter.

For more discussion, see: http://www.nabble.com/%27suggest%27-query-sorting-tf4450280.html

Hoss points out that KeywordTokenizerFactory may be a more appropriate tokenizer.  If you
do need to complete internal tokens, use two fields.

I found this works well:


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

<fieldType name="prefix_token" class="solr.TextField" positionIncrementGap="1">
  <analyzer type="index">
    <tokenizer class="solr.WhitespaceTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory" />
    <filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="20"/>
  </analyzer>
  <analyzer type="query">
    <tokenizer class="solr.WhitespaceTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory" />
  </analyzer>
</fieldType>

...
   <field name="prefix1" type="prefix_full"  indexed="true" stored="false"/>
   <field name="prefix2" type="prefix_token" indexed="true" stored="false"/>
...
   <copyField source="name" dest="prefix1"/>
   <copyField source="name" dest="prefix2"/>

If you query both fields, it boosts the first names that start with the query over the others:

http://localhost:8983/solr/select?fl=name,id&q=prefix1:ca%20prefix2:ca




> Prefixing Filter Factory -- for 'suggest' 
> ------------------------------------------
>
>                 Key: SOLR-357
>                 URL: https://issues.apache.org/jira/browse/SOLR-357
>             Project: Solr
>          Issue Type: New Feature
>            Reporter: Ryan McKinley
>         Attachments: SOLR-357-PrefixingFilter.patch
>
>
> The PrefixingFilter builds a token for each prefix in the original token.  It is appropriate
for a type-ahead suggest style function.
> Given the token "solr", this will build a token for "s","so","sol","solr".  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message