0

I would like to write a specific fieldType that will work as shown at the example below:
Say we have a name: foo MooBar (f00B2r);

  • "f" => foo MooBar (f00B2r) (and others with a "f")
  • "foo moob" => foo MooBar (f00B2r) (and others with a "foo moob", etc.)
  • "foo (f0" => foo MooBar (f00B2r)
  • "moobar f" => foo MooBar (f00B2r)
  • "(f00b2r)" => foo MooBar (f00B2r)
  • "bar" => none
  • "moobar o" => none
  • "moob foo" => none

My problems:

  1. If i search for "moobar f" i'll get none;
  2. If i search for "(f00b2r)" i'll get none;

my fieldType in solr/conf/schema.xml:

<fieldType name="frontMatch" class="solr.TextField" positionIncrementGap="255">
  <analyzer type="index">
    <tokenizer class="solr.LowerCaseTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="255" side="front" />
  </analyzer>
  <analyzer type="query">
    <tokenizer class="solr.WhitespaceTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="255" side="front" />
  </analyzer>
</fieldType>

P.S.
Sorry for my English and Thanks;

ted
  • 5,219
  • 7
  • 36
  • 63
  • I don't know about the first issue but as far as the second is concerned -- have you tried escaping the parentheses? E.g., querying for `\(foob2r\)` instead of `(foob2r)`? – David Faber Mar 25 '12 at 02:28

1 Answers1

0

The solution for me:
Part of scheme.xml

<fieldType name="frontMatch" class="solr.TextField" positionIncrementGap="0" >
  <analyzer type="index">
    <tokenizer class="solr.WhitespaceTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="255" side="front" />
  </analyzer>
  <analyzer type="query">
    <tokenizer class="solr.WhitespaceTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="255" side="front" />
  </analyzer>
</fieldType>

That solves the second problem.
To solve the first one:
Every query should be done with Proximity;
Number 1000000 is equal to operator "AND" when searching.
So, the search query looks like: name:"moobar f"~1000000;
where name is the field we're searching in;

ted
  • 5,219
  • 7
  • 36
  • 63