lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Solr Wiki] Update of "TermsComponent" by YonikSeeley
Date Thu, 10 Mar 2011 23:57:53 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.

The "TermsComponent" page has been changed by YonikSeeley.
The comment on this change is: make real example URLs, change 1.5->3.1, remove JIRA issue
links, create realistic case-insensitive autosuggest.
http://wiki.apache.org/solr/TermsComponent?action=diff&rev1=22&rev2=23

--------------------------------------------------

  <<Anchor(distributed)>>
  = Distributed Search Support =
  
- <!> [[Solr1.5]]
+ <!> [[Solr3.1]]
  
  TermsComponent now supports distributed setups. Assuming that you are using the "/terms"
request handler, you should specify the following two parameters to make it work in a distributed
setup:
   * "shards" - See DistributedSearch
@@ -44, +44 @@

  The following examples use the Solr tutorial example located in the <Solr>/example
directory.
  
  == Simple ==
- {{{
+ 
- http://localhost:8983/solr/terms?terms.fl=name&terms.sort=index
+ [[http://localhost:8983/solr/terms?terms.fl=name&terms.sort=index]]
- }}}
+ 
  
  Get back the first ten terms in the name field. 
  
@@ -78, +78 @@

  
  == Specifying Lower Bound ==
  
- URL: 
- {{{
- http://localhost:8983/solr/terms?terms.fl=name&terms.lower=a&terms.sort=index
+ [[http://localhost:8983/solr/terms?terms.fl=name&terms.lower=a&terms.sort=index]]
- }}}
  
  Result:
  {{{
@@ -110, +107 @@

  }}}
  
  
- == Use in Auto-Suggest ==
+ == Use in Auto-Complete ==
  
- See also http://issues.apache.org/jira/browse/SOLR-1316, which is likely a better solution.
+ See also [[Suggester]], which can be a better solution in many scenarios.
  
- To use in auto-suggest, add what the user has typed as a prefix:
+ To use in auto-complete, add what the user has typed as a prefix:
  
- URL:
- {{{
- http://localhost:8983/solr/terms?terms.fl=name&terms.prefix=at
+ [[http://localhost:8983/solr/terms?terms.fl=name&terms.prefix=at]]
- }}}
  
  Result:
  {{{
@@ -139, +133 @@

  </response>
  }}}
  
- You can use omitHeader=true capability to omit responseHeader.
+ You can use the JSON response format, along with omitHeader=true to omit responseHeader
for an even smaller response:
  
- URL:
+ [[http://localhost:8983/solr/terms?terms.fl=name&terms.prefix=at&wt=json&omitHeader=true]]
+ 
+ Result:
  {{{
- http://localhost:8983/solr/terms?terms.fl=name&terms.prefix=at&indent=true&wt=json&omitHeader=true
+ {"terms":{"name":["ata",1,"ati",1]}}
  }}}
+ 
+ NOTE: there was a bug in Solr 1.4 that caused the "terms" map to appear as a list.
+ 
+ == Case insensitive Auto-Complete ==
+ 
+ If the analysis if the field preserves case, one can still get case insensitive auto-complete
by using the regexp support together with the "case_insensitive" regex flag.
+ 
+ [[http://localhost:8983/solr/terms?terms.fl=manu_exact&terms.regex=at.*&terms.regex.flag=case_insensitive]]
  
  Result:
  {{{
  {
+   "responseHeader":{
+     "status":0,
+     "QTime":0},
-  "terms":{
+   "terms":{
+     "manu_exact":[
+       "ATI Technologies",1]}}
-   "name : [
- 	"ata",1,
- 	"ati",1]}}
  }}}
  
- NOTE: there was a bug in Solr 1.4 that caused the "terms" map to appear as a list.
- 
- == Case insensitive Auto-Suggest ==
- 
- Use the regexp support together with the "case_insensitive" regex flag.
- 
- URL:
- {{{
- http://localhost:8983/solr/terms?terms.fl=name&terms.regex=At.*&terms.regex.flag=case_insensitive
- }}}
- 
- Result:
- {{{
- <?xml version="1.0" encoding="UTF-8"?>
- <response>
- 
- <lst name="responseHeader">
-  <int name="status">0</int>
-  <int name="QTime">120</int>
- </lst>
- <lst name="terms">
-  <lst name="name">
-   <int name="ata">5</int>
-   <int name="ati">5</int>
-  </lst>
- </lst>
- </response>
- }}}
- 

Mime
View raw message