/solr-plugins

Brightsolid's solr plugins

Primary LanguageJava

Brightsolid solr plugins

Features

  • Due to distributed search requirements the plugin disables idf and querynorm.
  • The plugin enables query time boosting on the position of a term in text and implements a name search query parser.

Installation

  1. get source.
  2. build with 'ant compile'.
  3. add to solr home lib directory.

Configure

  1. in solr's schema.xml add the similarity class
   <similarity class="brightsolid.solr.plugins.BrightSolidSimilarity" />
  1. in the solr's solrconfig.xml add the custom parser.
   <queryParser name="namequery" class="brightsolid.solr.plugins.NameQueryPlugin"/>

Use

In query url include a name query, for example here it uses the nested query syntax.

	&q=_query_:"{!namequery f=field }my name"

Available local params that you can pass

  • f root field name to use for the search

  • tie (0.00) the tiebreaker used by the DisjunctionMaxQuery of each clause

  • exactboost (1.01) the boost to apply to the analysed field subsearch

  • useexact (false) add synonym search

  • anboost (0.9) the boost to apply to the analysed field subsearch

  • usesyn (true) add synonym search

  • synboost (0.8) the boost to apply to the synonym subsearch

  • useinitial (true) add inital search

  • initialboost (0.42) the boost to apply to the search for initials of the search term

  • usephonetic (true) add phonetic subsearch

  • phoneticboost (0.75) boost to apply to the phonetic subsearch

  • usefuzzy (false) add fuzzy subsearch

  • fuzzyboost (0.2) the boost to apply to the fuzzy subsearch

  • usenull (true) add null search (actually search for -)

  • nullboost (0.01) the boost to apply to null boost (actually search for -)

  • gendervalue value for a prohibited gender term query added to the fuzzy, initial, null and phontic subseraches

  • genderfield (Gender__facet_text) field for a prohibited gender term query added to the fuzzy, initial, null and phontic subseraches

In essence the parser works as follows, for each clause in the query it will create a DisjunctionMaxQuery containing a number of subqueries, each with varying boosts, there is also an aditional boost for where the position of the term in the field matches the clause in the query. Each disjunction is then added to a boolean must occur query.

For example the query:

&q=query:"{!namequery f=name__fname } my name"

would parse to this form of query:

+( spanTargPos(name__fname:my) |
//straight search, target position 0
spanTargPos(name__fname_an:my,0.9) |
//straight analysed search, target position 0
spanTargPos(name__fname_syn:my,0)^0.8 |
//synonym search, target position 0, boost 0.8
spanTargPos(name__fname_an:m,0)^0.3 |
//initial search, target position 0, boost 0.2
spanTargPos(name__fname_an_rs:my,0)^0.2 |
//phonetic search, target position 0, boost 0.1
spanTargPos(SpanMultiTermQueryWrapper(name__fname_an:my~1),0)^0.2
//fuzzy search, target position 0, boost 0.2
spanTargPos(name__fname:-,0)^0.01)0.01 |
//null search, target position 0, boost 0.01
+( spanTargPos(name__fname_an:name,1) |
spanTargPos(name__fname_syn:name,1)^0.8 |
spanTargPos(name__fname_an:n,1)^0.3 |
spanTargPos(name__fname_an_rs:name,1)^0.2 |
spanTargPos(SpanMultiTermQueryWrapper(name__fname_an:name
1),1)^0.2 |
spanTargPos(name__fname:-,1)^0.01)~0.01