Thank you Shalin, I'm in the process of implementing your suggestion,
and it works marvelously.  Had to upgrade to solr 1.3, and had to hack
up acts_as_solr to function correctly.

Is there a way to receive a search for a given field, and have solr
know to automatically check the two fields?  I suppose not.

I'm trying to avoid having to manipulate user input too much, so
hoping to be able to have a user search for:

title:phpGroupWare

and have it search the two fields automatically.  Right now, in
implementing your solution, I take their title search and convert it
to (titlew:(phpGroupWare) OR titlec:(phpGroupWare)) and it works
marvelously, but of course would be easier if I could just let it go
as is.

(titlew being wdf_wordparts and titlec being wdf_catenatewords)

Thank you kindly, we've grown to depend strongly on solr for OSVDB.org
and datalossdb.org -- it is a fantastic tool.

Dave

On Sat, Jan 17, 2009 at 5:08 AM, Shalin Shekhar Mangar
<shalinman...@gmail.com> wrote:
> Hi Dave,
>
> A quick experimentation found the following fieldtypes to be successful with
> your queries. Add one as a copyField to the other and search on both:
>
> <fieldtype name="wdf_wordparts" class="solr.TextField">
>      <analyzer>
>          <tokenizer class="solr.WhitespaceTokenizerFactory"/>
>          <filter class="solr.WordDelimiterFilterFactory"
> generateWordParts="1" generateNumberParts="1" catenateWords="0"
> catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"
> preserveOriginal="1"/>
>          <filter class="solr.LowerCaseFilterFactory"/>
>      </analyzer>
>    </fieldtype>
>
>    <fieldtype name="wdf_catenatewords" class="solr.TextField">
>      <analyzer>
>          <tokenizer class="solr.WhitespaceTokenizerFactory"/>
>          <filter class="solr.WordDelimiterFilterFactory"
> generateWordParts="0" generateNumberParts="0" catenateWords="1"
> catenateNumbers="1" catenateAll="1" splitOnCaseChange="1"
> preserveOriginal="0"/>
>          <filter class="solr.LowerCaseFilterFactory"/>
>      </analyzer>
>    </fieldtype>
>
> I added the following test to TestWordDelimiterFilter.java
>
> public void testDave() {
>
>    assertU(adoc("id", "191",
>            "wdf_preserve", "phpGroupWare"));
>    assertU(commit());
>
>    assertQ("preserving original word",
>            req("wdf_preserve:PHPGroupWare")
>            , "//resu...@numfound=1]"
>    );
>
>    assertQ("preserving original word",
>            req("wdf_wordparts:phpGroupWare wdf_catenatewords:phpGroupWare")
>            , "//resu...@numfound=1]"
>    );
>
>    assertQ("preserving original word",
>            req("wdf_wordparts:PHPGroupware wdf_catenatewords:PHPGroupware")
>            , "//resu...@numfound=1]"
>    );
>    assertQ("preserving original word",
>            req("wdf_wordparts:phpGroupware wdf_catenatewords:phpGroupware")
>            , "//resu...@numfound=1]"
>    );
>    assertQ("preserving original word",
>            req("wdf_wordparts:phpgroupware wdf_catenatewords:phpgroupware")
>            , "//resu...@numfound=1]"
>    );
>
>    assertQ("preserving original word",
>            req("wdf_wordparts:(php groupware) wdf_catenatewords:(php
> groupware)")
>            , "//resu...@numfound=1]"
>    );
>
>    assertQ("preserving original word",
>            req("wdf_wordparts:(php group ware) wdf_catenatewords:(php group
> ware)")
>            , "//resu...@numfound=1]"
>    );
>
>    assertQ("preserving original word",
>            req("wdf_wordparts:(PHPGroup ware) wdf_catenatewords:(PHPGroup
> ware)")
>            , "//resu...@numfound=1]"
>    );
>
>  }
>
> I'll let someone else comment if there is an easier way to do this (without
> two fields).
>

Reply via email to