[TYPO3-Solr] Advanced search with SOLR

Christian Bleicher - DieLobby Werbeagentur Gmbh c.bleicher at die-lobby.de
Tue Jul 31 15:17:40 CEST 2012


Hi Ingo,

thanks for your suggestions.

>* To search specific fields simply query for fieldName:fieldValue. You
might want to prefix the field internally so the user doesn't need to
know the field names. You probably do not want/need to use filters.

How does this work? If i try to search using the "q" parameter and type
in "firstname_stringS:christian" He also finds people that match
christian at lastname. It doesn't seem that SOLR takes care of the
parameter. How does it work to query for 2 paramaters like firstname and
lastname? "firstname:test AND lastname:test1"

Should this work? If yes, I only need to prepare the query with
javascript and send it to the backend then. That would be great.

Greets
Christian

Am 31.07.2012 11:45, schrieb Ingo Renner:
> Am 26.07.12 14:13, schrieb Christian Bleicher - DieLobby Werbeagentur
> Gmbh:
>
> Hi Christian,
>
>> I try to implement an advanced search using SOLR. I want to search for
>> Website users and they are already indexed. If i search using the q
>> paramenter it works great.
>> But now I have to implement a advanced search using special field like
>> firstname, lastname and city. If I search for Regensburg in the city
>> field, I won't find someone who is called Regensburg (lastname).
>> Now I tryed to use the filter options from SOLR.
>>
>> It works with an 100% match if I try it with this link (simply like the
>> tx_solr filters)
>> http://.../search.html?tx_solr[q]=*&tx_solr[filter][1]=city%3ARegensburg
>>
>> But if I search for 'Regensb' it doesn't find anything. * and % didn't
>> help here.
>> http://petnology.rigardi.com/en/network/search.html?tx_solr[q]=*&tx_solr[filter][1]=city%3ARegensb
>>
>>
>> Is there a way to implement a fuzzy search? It would be ok if it works
>> like a mysql query like '%Regensb%'.
>
> There are several things here: First and foremost I would like to
> advise simply dropping the idea of building an "advanced" form. Nobody
> wants to use them anyway...
>
> If you absolutely have/want to go this route, here're some pointers.
>
> * To search specific fields simply query for fieldName:fieldValue. You
> might want to prefix the field internally so the user doesn't need to
> know the field names. You probably do not want/need to use filters.
> * Do not (unless you really know what you're doing) modify the
> schema.xml. Use dynamic fields instead. [1]
> * For "advanced" forms you should use the standard query request
> handler, by default we use the Dismax request handler.
> * Wildcards are supported by using the asterisk character (*), but not
> for leading wildcards.
> * The 100% only matches is an issue of your choice of field types. My
> guess is you're using a string field here, whereas you probably want a
> text type field.
> * You will have to implement most of the things through different
> hooks. Each hook in EXT:solr has an interface. So by looking into
> EXT:solr/interfaces/ you should get an idea of what can be extended.
> By looking up where an interface is used in the code you'll also see
> how to use it.
>
>
> HTH,
> Ingo
>
> [1] http://forge.typo3.org/projects/extension-solr/wiki/Dynamic_Fields
>




More information about the TYPO3-project-solr mailing list