SOLR Common Problem-Fayon

Source: Internet
Author: User
Tags solr solr query

This is a list of some of the problems I have encountered in the development process, some of which are taken from others on the Internet.

1. Org.apache.solr.client.solrj.SolrServerException:Timeout occured while waiting response from server at:http:// LOCALHOST/SOLR Request timed out

Workaround: Set Setconnectiontimeout and setsotimeout to 1 minutes

2. org.apache.solr.common.SolrException:undefined field Text

Workaround: Set solrconfig.xml <str name= "DF" >id</str> default is Text

3. Org.apache.solr.common.SolrException:Invalid date string time formatting problem

The main is SOLR using the standard Greenwich (GMT) time this (YYYY-MM-DD ' T ' HH:mm:ss. SSS ' Z ') Beijing in the East Zone eight default time will be-8 hours

So in order to satisfy him, this minus 8. My approach is to judge the time +8 by making the index format date type.

So recreate a Solrentitybinder class This class is a full copy of the Documentobjectbinder. Only one place has been modified.

Modified the Tosolrinputdocument method in the class

[HTML]View plain?
  1. <span style="color: #3333ff;" >//Determine if it is a date-------------//
  2. if (field.type==date.class) {
  3. Date D = (date) field.get (obj);
  4. Calendar cal = calendar.getinstance ();
  5. Cal.settimeinmillis (D.gettime ());
  6. Cal.add (Calendar.hour, 8);
  7. d = cal.gettime ();
  8. Doc.setfield (field.name,d,1.0f);
  9. }else{
  10. Doc.setfield (Field.name, Field.get (obj), 1.0f);
  11. }</span>
4.SOLR query string null value

Sometimes it is necessary to query a record of a field that is empty, such as when SOLR makes facets, a record of a field that is empty is counted, and therefore it is queried.
An example is the position record, where the company may be empty for some reason. At this point, if we want to query the company name is empty records can be implemented in the following syntax (it seems to be only feasible so far):
-company:[* to *] this way you will see that the records in the result set will contain all records with empty company names.

5.SOLR Auction Ranking feature if you have 3 doc that you want to bid on, then the 3 SOLR will put the 3 in front and then the other doc sorted by default. Reference WIKI:HTTP://WIKI.APACHE.ORG/SOLR/QUERYELEVATIONCOMPONENT6.SOLR Dismax Analysis to use Dismax, it must be enabled, After solr1.3, SOLR's Dismax function was parsed by Dismaxqparserplugin.
The version I tested was 3.3 and was enabled by adding Deftype=dismax to the query URL to enable the Dismax feature. It won't work if you pass the Qt=dismax.
With Deftype=dismax, the prepare method of the Querycomponent component of SOLR takes the value of the Deftype parameter to create the corresponding Quey parser. 7.SOLR Cross-core search you add Shards=localhost:9095/solr/core0,localhost:9095/solr/core1 to the query criteria. 8.SOLR First * Retrieve SOLR support * in the first bit of the search, just bad performance, to scan all the inverted chain.

SOLR Common Problem-Fayon

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.